From 28d231dbbb1f71bf1836148bb52969c31a05fe71 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 25 Jul 2019 19:47:56 +0300 Subject: [PATCH] Fix HarfBuzz support on MS-Windows * src/w32uniscribe.c [HAVE_HARFBUZZ]: Include hb-ot.h. (fn_hb_ot_font_set_funcs, hb_ot_font_set_funcs): Define. (w32hb_get_font): Call hb_ot_font_set_funcs after creating the hb_font_t object, to make the code work with versions of HarfBuzz before 2.0.0. Problem reported by Stephen Leake . Solution suggested by Khaled Hosny in https://lists.freedesktop.org/archives/harfbuzz/2019-July/007412.html. --- src/w32uniscribe.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index aa6bebdc024..8fbbe7e4a9e 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -32,6 +32,7 @@ along with GNU Emacs. If not, see . */ #include #ifdef HAVE_HARFBUZZ # include +# include /* for hb_ot_font_set_funcs */ # if GNUC_PREREQ (4, 3, 0) # define bswap_32(v) __builtin_bswap32(v) # else @@ -87,6 +88,7 @@ DEF_DLL_FN (hb_bool_t, hb_font_get_nominal_glyph, (hb_font_t *, hb_codepoint_t, hb_codepoint_t *)); DEF_DLL_FN (hb_bool_t, hb_font_get_variation_glyph, (hb_font_t *, hb_codepoint_t, hb_codepoint_t, hb_codepoint_t *)); +DEF_DLL_FN (void, hb_ot_font_set_funcs, (hb_font_t *)); #define hb_blob_create fn_hb_blob_create #define hb_face_create_for_tables fn_hb_face_create_for_tables @@ -97,6 +99,7 @@ DEF_DLL_FN (hb_bool_t, hb_font_get_variation_glyph, #define hb_face_get_upem fn_hb_face_get_upem #define hb_font_get_nominal_glyph fn_hb_font_get_nominal_glyph #define hb_font_get_variation_glyph fn_hb_font_get_variation_glyph +#define hb_ot_font_set_funcs fn_hb_ot_font_set_funcs #endif /* Used by uniscribe_otf_capability. */ @@ -1305,7 +1308,12 @@ w32hb_get_font (struct font *font, double *scale) hb_face_t *hb_face = hb_face_create_for_tables (w32hb_get_font_table, font_handle, NULL); if (hb_face_get_glyph_count (hb_face) > 0) - hb_font = hb_font_create (hb_face); + { + hb_font = hb_font_create (hb_face); + /* This is needed for HarfBuzz before 2.0.0; it is the default + in later versions. */ + hb_ot_font_set_funcs (hb_font); + } struct uniscribe_font_info *uniscribe_font = (struct uniscribe_font_info *) font; @@ -1486,6 +1494,7 @@ load_harfbuzz_funcs (HMODULE library) LOAD_DLL_FN (library, hb_face_destroy); LOAD_DLL_FN (library, hb_font_get_nominal_glyph); LOAD_DLL_FN (library, hb_font_get_variation_glyph); + LOAD_DLL_FN (library, hb_ot_font_set_funcs); return hbfont_init_w32_funcs (library); } #endif /* HAVE_HARFBUZZ */ -- 2.39.2