diff options
| author | Paul Eggert | 2018-12-13 11:58:09 -0800 |
|---|---|---|
| committer | Paul Eggert | 2018-12-13 11:58:09 -0800 |
| commit | a7214683bede0bb05ee23d63331d289c37d3b667 (patch) | |
| tree | d6cc8dea09933245cd388b5e3fc9d3273760f1bc /src | |
| parent | 981b3d292aff49452c2b5f0217b57ec1a2829a8b (diff) | |
| download | emacs-a7214683bede0bb05ee23d63331d289c37d3b667.tar.gz emacs-a7214683bede0bb05ee23d63331d289c37d3b667.zip | |
Simplify mainline Harfbuzz-using code
* src/ftfont.c (ft_face_destroy): Omit unnecessary cast.
(hb_ft_font_create_referenced) [!HAVE_HB_FT_FONT_CREATE_REFERENCED]:
New function.
(ftfont_get_hb_font): Use it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ftfont.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/ftfont.c b/src/ftfont.c index a645bbf0294..47442df0e5a 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -478,28 +478,27 @@ ftfont_get_otf (struct ftfont_info *ftfont_info) | |||
| 478 | 478 | ||
| 479 | #ifdef HAVE_HARFBUZZ | 479 | #ifdef HAVE_HARFBUZZ |
| 480 | 480 | ||
| 481 | #ifndef HAVE_HB_FT_FONT_CREATE_REFERENCED | 481 | # ifndef HAVE_HB_FT_FONT_CREATE_REFERENCED |
| 482 | static void | 482 | static void |
| 483 | ft_face_destroy (void *data) | 483 | ft_face_destroy (void *data) |
| 484 | { | 484 | { |
| 485 | FT_Done_Face ((FT_Face) data); | 485 | FT_Done_Face (data); |
| 486 | } | 486 | } |
| 487 | #endif | 487 | |
| 488 | static hb_font_t * | ||
| 489 | hb_ft_font_create_referenced (FT_Face face) | ||
| 490 | { | ||
| 491 | FT_Reference_Face (face); | ||
| 492 | return hb_ft_font_create (face, ft_face_destroy); | ||
| 493 | } | ||
| 494 | # endif | ||
| 488 | 495 | ||
| 489 | static hb_font_t * | 496 | static hb_font_t * |
| 490 | ftfont_get_hb_font (struct ftfont_info *ftfont_info) | 497 | ftfont_get_hb_font (struct ftfont_info *ftfont_info) |
| 491 | { | 498 | { |
| 492 | if (! ftfont_info->hb_font) | 499 | if (! ftfont_info->hb_font) |
| 493 | { | 500 | ftfont_info->hb_font |
| 494 | hb_font_t *hb_font; | 501 | = hb_ft_font_create_referenced (ftfont_info->ft_size->face); |
| 495 | #ifdef HAVE_HB_FT_FONT_CREATE_REFERENCED | ||
| 496 | hb_font = hb_ft_font_create_referenced (ftfont_info->ft_size->face); | ||
| 497 | #else | ||
| 498 | FT_Reference_Face (ftfont_info->ft_size->face); | ||
| 499 | hb_font = hb_ft_font_create (ftfont_info->ft_size->face, ft_face_destroy); | ||
| 500 | #endif | ||
| 501 | ftfont_info->hb_font = hb_font; | ||
| 502 | } | ||
| 503 | return ftfont_info->hb_font; | 502 | return ftfont_info->hb_font; |
| 504 | } | 503 | } |
| 505 | 504 | ||