aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2019-07-25 19:47:56 +0300
committerEli Zaretskii2019-07-25 19:47:56 +0300
commit28d231dbbb1f71bf1836148bb52969c31a05fe71 (patch)
treefbb1a3551febf7b2dbbb439e8593201ead615856 /src
parent9c1ecca333b68b8d11c0acb8a273d71bea8cf505 (diff)
downloademacs-28d231dbbb1f71bf1836148bb52969c31a05fe71.tar.gz
emacs-28d231dbbb1f71bf1836148bb52969c31a05fe71.zip
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 <stephen_leake@stephe-leake.org>. Solution suggested by Khaled Hosny <dr.khaled.hosny@gmail.com> in https://lists.freedesktop.org/archives/harfbuzz/2019-July/007412.html.
Diffstat (limited to 'src')
-rw-r--r--src/w32uniscribe.c11
1 files changed, 10 insertions, 1 deletions
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 <https://www.gnu.org/licenses/>. */
32#include <usp10.h> 32#include <usp10.h>
33#ifdef HAVE_HARFBUZZ 33#ifdef HAVE_HARFBUZZ
34# include <hb.h> 34# include <hb.h>
35# include <hb-ot.h> /* for hb_ot_font_set_funcs */
35# if GNUC_PREREQ (4, 3, 0) 36# if GNUC_PREREQ (4, 3, 0)
36# define bswap_32(v) __builtin_bswap32(v) 37# define bswap_32(v) __builtin_bswap32(v)
37# else 38# else
@@ -87,6 +88,7 @@ DEF_DLL_FN (hb_bool_t, hb_font_get_nominal_glyph,
87 (hb_font_t *, hb_codepoint_t, hb_codepoint_t *)); 88 (hb_font_t *, hb_codepoint_t, hb_codepoint_t *));
88DEF_DLL_FN (hb_bool_t, hb_font_get_variation_glyph, 89DEF_DLL_FN (hb_bool_t, hb_font_get_variation_glyph,
89 (hb_font_t *, hb_codepoint_t, hb_codepoint_t, hb_codepoint_t *)); 90 (hb_font_t *, hb_codepoint_t, hb_codepoint_t, hb_codepoint_t *));
91DEF_DLL_FN (void, hb_ot_font_set_funcs, (hb_font_t *));
90 92
91#define hb_blob_create fn_hb_blob_create 93#define hb_blob_create fn_hb_blob_create
92#define hb_face_create_for_tables fn_hb_face_create_for_tables 94#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,
97#define hb_face_get_upem fn_hb_face_get_upem 99#define hb_face_get_upem fn_hb_face_get_upem
98#define hb_font_get_nominal_glyph fn_hb_font_get_nominal_glyph 100#define hb_font_get_nominal_glyph fn_hb_font_get_nominal_glyph
99#define hb_font_get_variation_glyph fn_hb_font_get_variation_glyph 101#define hb_font_get_variation_glyph fn_hb_font_get_variation_glyph
102#define hb_ot_font_set_funcs fn_hb_ot_font_set_funcs
100#endif 103#endif
101 104
102/* Used by uniscribe_otf_capability. */ 105/* Used by uniscribe_otf_capability. */
@@ -1305,7 +1308,12 @@ w32hb_get_font (struct font *font, double *scale)
1305 hb_face_t *hb_face = 1308 hb_face_t *hb_face =
1306 hb_face_create_for_tables (w32hb_get_font_table, font_handle, NULL); 1309 hb_face_create_for_tables (w32hb_get_font_table, font_handle, NULL);
1307 if (hb_face_get_glyph_count (hb_face) > 0) 1310 if (hb_face_get_glyph_count (hb_face) > 0)
1308 hb_font = hb_font_create (hb_face); 1311 {
1312 hb_font = hb_font_create (hb_face);
1313 /* This is needed for HarfBuzz before 2.0.0; it is the default
1314 in later versions. */
1315 hb_ot_font_set_funcs (hb_font);
1316 }
1309 1317
1310 struct uniscribe_font_info *uniscribe_font = 1318 struct uniscribe_font_info *uniscribe_font =
1311 (struct uniscribe_font_info *) font; 1319 (struct uniscribe_font_info *) font;
@@ -1486,6 +1494,7 @@ load_harfbuzz_funcs (HMODULE library)
1486 LOAD_DLL_FN (library, hb_face_destroy); 1494 LOAD_DLL_FN (library, hb_face_destroy);
1487 LOAD_DLL_FN (library, hb_font_get_nominal_glyph); 1495 LOAD_DLL_FN (library, hb_font_get_nominal_glyph);
1488 LOAD_DLL_FN (library, hb_font_get_variation_glyph); 1496 LOAD_DLL_FN (library, hb_font_get_variation_glyph);
1497 LOAD_DLL_FN (library, hb_ot_font_set_funcs);
1489 return hbfont_init_w32_funcs (library); 1498 return hbfont_init_w32_funcs (library);
1490} 1499}
1491#endif /* HAVE_HARFBUZZ */ 1500#endif /* HAVE_HARFBUZZ */