diff options
| author | Kenichi Handa | 2007-12-10 07:36:01 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2007-12-10 07:36:01 +0000 |
| commit | 365131acac2845938da31563bd4453a9c5e71ebc (patch) | |
| tree | e90ce89193f0ccc90a1a17936cdb8ef128429534 /src | |
| parent | 82233679477ccc76aa7cbcb24d80133e1082379a (diff) | |
| download | emacs-365131acac2845938da31563bd4453a9c5e71ebc.tar.gz emacs-365131acac2845938da31563bd4453a9c5e71ebc.zip | |
(struct xftfont_info): Delete the member ft_face.
(xftfont_open): Don't keep locking face.
(xftfont_close): Don't unlock face.
(xftfont_anchor_point): Lock and unlock face.
(xftfont_shape): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xftfont.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/xftfont.c b/src/xftfont.c index 51049b81985..d606bb21b39 100644 --- a/src/xftfont.c +++ b/src/xftfont.c | |||
| @@ -50,7 +50,6 @@ struct xftfont_info | |||
| 50 | Display *display; | 50 | Display *display; |
| 51 | int screen; | 51 | int screen; |
| 52 | XftFont *xftfont; | 52 | XftFont *xftfont; |
| 53 | FT_Face ft_face; /* Set to the value of XftLockFace (xftfont). */ | ||
| 54 | #ifdef HAVE_LIBOTF | 53 | #ifdef HAVE_LIBOTF |
| 55 | int maybe_otf; /* Flag to tell if this may be OTF or not. */ | 54 | int maybe_otf; /* Flag to tell if this may be OTF or not. */ |
| 56 | OTF *otf; | 55 | OTF *otf; |
| @@ -230,6 +229,7 @@ xftfont_open (f, entity, pixel_size) | |||
| 230 | char *name; | 229 | char *name; |
| 231 | int len; | 230 | int len; |
| 232 | XGlyphInfo extents; | 231 | XGlyphInfo extents; |
| 232 | FT_Face ft_face; | ||
| 233 | 233 | ||
| 234 | val = AREF (entity, FONT_EXTRA_INDEX); | 234 | val = AREF (entity, FONT_EXTRA_INDEX); |
| 235 | if (XTYPE (val) != Lisp_Misc | 235 | if (XTYPE (val) != Lisp_Misc |
| @@ -269,9 +269,10 @@ xftfont_open (f, entity, pixel_size) | |||
| 269 | xftfont_info->display = display; | 269 | xftfont_info->display = display; |
| 270 | xftfont_info->screen = FRAME_X_SCREEN_NUMBER (f); | 270 | xftfont_info->screen = FRAME_X_SCREEN_NUMBER (f); |
| 271 | xftfont_info->xftfont = xftfont; | 271 | xftfont_info->xftfont = xftfont; |
| 272 | xftfont_info->ft_face = XftLockFace (xftfont); | ||
| 273 | #ifdef HAVE_LIBOTF | 272 | #ifdef HAVE_LIBOTF |
| 274 | xftfont_info->maybe_otf = xftfont_info->ft_face->face_flags & FT_FACE_FLAG_SFNT; | 273 | ft_face = XftLockFace (xftfont); |
| 274 | xftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; | ||
| 275 | XftUnlockFace (xftfont); | ||
| 275 | xftfont_info->otf = NULL; | 276 | xftfont_info->otf = NULL; |
| 276 | #endif /* HAVE_LIBOTF */ | 277 | #endif /* HAVE_LIBOTF */ |
| 277 | 278 | ||
| @@ -394,7 +395,6 @@ xftfont_close (f, font) | |||
| 394 | if (xftfont_info->otf) | 395 | if (xftfont_info->otf) |
| 395 | OTF_close (xftfont_info->otf); | 396 | OTF_close (xftfont_info->otf); |
| 396 | #endif | 397 | #endif |
| 397 | XftUnlockFace (xftfont_info->xftfont); | ||
| 398 | XftFontClose (xftfont_info->display, xftfont_info->xftfont); | 398 | XftFontClose (xftfont_info->display, xftfont_info->xftfont); |
| 399 | if (font->font.name) | 399 | if (font->font.name) |
| 400 | free (font->font.name); | 400 | free (font->font.name); |
| @@ -564,17 +564,22 @@ xftfont_anchor_point (font, code, index, x, y) | |||
| 564 | int *x, *y; | 564 | int *x, *y; |
| 565 | { | 565 | { |
| 566 | struct xftfont_info *xftfont_info = (struct xftfont_info *) font; | 566 | struct xftfont_info *xftfont_info = (struct xftfont_info *) font; |
| 567 | FT_Face ft_face = xftfont_info->ft_face; | 567 | FT_Face ft_face = XftLockFace (xftfont_info->xftfont); |
| 568 | int result; | ||
| 568 | 569 | ||
| 569 | if (FT_Load_Glyph (ft_face, code, FT_LOAD_DEFAULT) != 0) | 570 | if (FT_Load_Glyph (ft_face, code, FT_LOAD_DEFAULT) != 0) |
| 570 | return -1; | 571 | result = -1; |
| 571 | if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) | 572 | else if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) |
| 572 | return -1; | 573 | result = -1; |
| 573 | if (index >= ft_face->glyph->outline.n_points) | 574 | else if (index >= ft_face->glyph->outline.n_points) |
| 574 | return -1; | 575 | result = -1; |
| 575 | *x = ft_face->glyph->outline.points[index].x; | 576 | else |
| 576 | *y = ft_face->glyph->outline.points[index].y; | 577 | { |
| 577 | return 0; | 578 | *x = ft_face->glyph->outline.points[index].x; |
| 579 | *y = ft_face->glyph->outline.points[index].y; | ||
| 580 | } | ||
| 581 | XftUnlockFace (xftfont_info->xftfont); | ||
| 582 | return result; | ||
| 578 | } | 583 | } |
| 579 | 584 | ||
| 580 | static int | 585 | static int |
| @@ -601,27 +606,32 @@ xftfont_shape (lgstring) | |||
| 601 | { | 606 | { |
| 602 | struct font *font; | 607 | struct font *font; |
| 603 | struct xftfont_info *xftfont_info; | 608 | struct xftfont_info *xftfont_info; |
| 609 | int result; | ||
| 610 | FT_Face ft_face; | ||
| 604 | 611 | ||
| 605 | CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); | 612 | CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); |
| 606 | xftfont_info = (struct xftfont_info *) font; | 613 | xftfont_info = (struct xftfont_info *) font; |
| 607 | if (! xftfont_info->maybe_otf) | 614 | if (! xftfont_info->maybe_otf) |
| 608 | return Qnil; | 615 | return Qnil; |
| 616 | ft_face = XftLockFace (xftfont_info->xftfont); | ||
| 609 | if (! xftfont_info->otf) | 617 | if (! xftfont_info->otf) |
| 610 | { | 618 | { |
| 611 | OTF *otf = OTF_open_ft_face (xftfont_info->ft_face); | 619 | OTF *otf = OTF_open_ft_face (ft_face); |
| 612 | 620 | ||
| 613 | if (! otf || OTF_get_table (otf, "head") < 0) | 621 | if (! otf || OTF_get_table (otf, "head") < 0) |
| 614 | { | 622 | { |
| 615 | if (otf) | 623 | if (otf) |
| 616 | OTF_close (otf); | 624 | OTF_close (otf); |
| 617 | xftfont_info->maybe_otf = 0; | 625 | xftfont_info->maybe_otf = 0; |
| 626 | XftUnlockFace (xftfont_info->xftfont); | ||
| 618 | return 0; | 627 | return 0; |
| 619 | } | 628 | } |
| 620 | xftfont_info->otf = otf; | 629 | xftfont_info->otf = otf; |
| 621 | } | 630 | } |
| 622 | 631 | ||
| 623 | return ftfont_shape_by_flt (lgstring, font, xftfont_info->ft_face, | 632 | result = ftfont_shape_by_flt (lgstring, font, ft_face, xftfont_info->otf); |
| 624 | xftfont_info->otf); | 633 | XftUnlockFace (xftfont_info->xftfont); |
| 634 | return result; | ||
| 625 | } | 635 | } |
| 626 | #endif /* HAVE_M17N_FLT */ | 636 | #endif /* HAVE_M17N_FLT */ |
| 627 | #endif /* HAVE_LIBOTF */ | 637 | #endif /* HAVE_LIBOTF */ |