emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 28d231d: Fix HarfBuzz support on MS-Windows


From: Eli Zaretskii
Subject: [Emacs-diffs] master 28d231d: Fix HarfBuzz support on MS-Windows
Date: Thu, 25 Jul 2019 12:49:10 -0400 (EDT)

branch: master
commit 28d231dbbb1f71bf1836148bb52969c31a05fe71
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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
    <address@hidden>.  Solution suggested by
    Khaled Hosny <address@hidden> 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 aa6bebd..8fbbe7e 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -32,6 +32,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <usp10.h>
 #ifdef HAVE_HARFBUZZ
 # include <hb.h>
+# include <hb-ot.h>    /* 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 */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]