From a52bc039c33b3c01dbb96b815dc24df7f03bc4be Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 9 Oct 2018 00:56:33 -0400 Subject: [PATCH 01/10] Properly remove deprecated stuff --- src/hb-glib.cc | 15 ++++++--------- src/hb-icu.cc | 15 ++++++--------- src/hb-ucdn.cc | 15 ++++++--------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/hb-glib.cc b/src/hb-glib.cc index fab3cddb3..a34acbba1 100644 --- a/src/hb-glib.cc +++ b/src/hb-glib.cc @@ -30,7 +30,6 @@ #include "hb-glib.h" -#include "hb-unicode.hh" #include "hb-machinery.hh" @@ -202,8 +201,6 @@ hb_glib_unicode_combining_class (hb_unicode_funcs_t *ufuncs HB_UNUSED, return (hb_unicode_combining_class_t) g_unichar_combining_class (unicode); } -#define hb_glib_unicode_eastasian_width nullptr - static hb_unicode_general_category_t hb_glib_unicode_general_category (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t unicode, @@ -328,8 +325,6 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, return ret; } -#define hb_glib_unicode_decompose_compatibility nullptr - #ifdef HB_USE_ATEXIT static void free_static_glib_funcs (void); @@ -341,10 +336,12 @@ static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader { hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr); -#define HB_UNICODE_FUNC_IMPLEMENT(name) \ - hb_unicode_funcs_set_##name##_func (funcs, hb_glib_unicode_##name, nullptr, nullptr); - HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS -#undef HB_UNICODE_FUNC_IMPLEMENT + hb_unicode_funcs_set_combining_class_func (funcs, hb_glib_unicode_combining_class, nullptr, nullptr); + hb_unicode_funcs_set_general_category_func (funcs, hb_glib_unicode_general_category, nullptr, nullptr); + hb_unicode_funcs_set_mirroring_func (funcs, hb_glib_unicode_mirroring, nullptr, nullptr); + hb_unicode_funcs_set_script_func (funcs, hb_glib_unicode_script, nullptr, nullptr); + hb_unicode_funcs_set_compose_func (funcs, hb_glib_unicode_compose, nullptr, nullptr); + hb_unicode_funcs_set_decompose_func (funcs, hb_glib_unicode_decompose, nullptr, nullptr); hb_unicode_funcs_make_immutable (funcs); diff --git a/src/hb-icu.cc b/src/hb-icu.cc index 8dbeaddd6..83a15e7f2 100644 --- a/src/hb-icu.cc +++ b/src/hb-icu.cc @@ -31,7 +31,6 @@ #include "hb-icu.h" -#include "hb-unicode.hh" #include "hb-machinery.hh" #include @@ -73,8 +72,6 @@ hb_icu_unicode_combining_class (hb_unicode_funcs_t *ufuncs HB_UNUSED, return (hb_unicode_combining_class_t) u_getCombiningClass (unicode); } -#define hb_icu_unicode_eastasian_width nullptr - static hb_unicode_general_category_t hb_icu_unicode_general_category (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t unicode, @@ -292,8 +289,6 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, return ret; } -#define hb_icu_unicode_decompose_compatibility nullptr - #ifdef HB_USE_ATEXIT static void free_static_icu_funcs (void); @@ -312,10 +307,12 @@ static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_ hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr); -#define HB_UNICODE_FUNC_IMPLEMENT(name) \ - hb_unicode_funcs_set_##name##_func (funcs, hb_icu_unicode_##name, user_data, nullptr); - HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS -#undef HB_UNICODE_FUNC_IMPLEMENT + hb_unicode_funcs_set_combining_class_func (funcs, hb_icu_unicode_combining_class, nullptr, nullptr); + hb_unicode_funcs_set_general_category_func (funcs, hb_icu_unicode_general_category, nullptr, nullptr); + hb_unicode_funcs_set_mirroring_func (funcs, hb_icu_unicode_mirroring, nullptr, nullptr); + hb_unicode_funcs_set_script_func (funcs, hb_icu_unicode_script, nullptr, nullptr); + hb_unicode_funcs_set_compose_func (funcs, hb_icu_unicode_compose, nullptr, nullptr); + hb_unicode_funcs_set_decompose_func (funcs, hb_icu_unicode_decompose, nullptr, nullptr); hb_unicode_funcs_make_immutable (funcs); diff --git a/src/hb-ucdn.cc b/src/hb-ucdn.cc index 3edd17eaa..3179683c2 100644 --- a/src/hb-ucdn.cc +++ b/src/hb-ucdn.cc @@ -16,7 +16,6 @@ #include "hb.hh" -#include "hb-unicode.hh" #include "hb-machinery.hh" #include "ucdn.h" @@ -182,8 +181,6 @@ hb_ucdn_combining_class(hb_unicode_funcs_t *ufuncs HB_UNUSED, return (hb_unicode_combining_class_t) ucdn_get_combining_class(unicode); } -#define hb_ucdn_eastasian_width nullptr - static hb_unicode_general_category_t hb_ucdn_general_category(hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t unicode, @@ -224,8 +221,6 @@ hb_ucdn_decompose(hb_unicode_funcs_t *ufuncs HB_UNUSED, return ucdn_decompose(ab, a, b); } -#define hb_ucdn_decompose_compatibility nullptr - #ifdef HB_USE_ATEXIT static void free_static_ucdn_funcs (void); @@ -237,10 +232,12 @@ static struct hb_ucdn_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader { hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr); -#define HB_UNICODE_FUNC_IMPLEMENT(name) \ - hb_unicode_funcs_set_##name##_func (funcs, hb_ucdn_##name, nullptr, nullptr); - HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS -#undef HB_UNICODE_FUNC_IMPLEMENT + hb_unicode_funcs_set_combining_class_func (funcs, hb_ucdn_combining_class, nullptr, nullptr); + hb_unicode_funcs_set_general_category_func (funcs, hb_ucdn_general_category, nullptr, nullptr); + hb_unicode_funcs_set_mirroring_func (funcs, hb_ucdn_mirroring, nullptr, nullptr); + hb_unicode_funcs_set_script_func (funcs, hb_ucdn_script, nullptr, nullptr); + hb_unicode_funcs_set_compose_func (funcs, hb_ucdn_compose, nullptr, nullptr); + hb_unicode_funcs_set_decompose_func (funcs, hb_ucdn_decompose, nullptr, nullptr); hb_unicode_funcs_make_immutable (funcs); From a353c1768dc1d7934b8ac293761620f561304bb2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 9 Oct 2018 01:05:28 -0400 Subject: [PATCH 02/10] Remove test for deprecated hb_set_invert() --- test/api/test-set.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/api/test-set.c b/test/api/test-set.c index eb2f22ece..1382adaa9 100644 --- a/test/api/test-set.c +++ b/test/api/test-set.c @@ -381,10 +381,6 @@ test_set_empty (void) test_empty (b); - hb_set_invert (b); - - test_empty (b); - g_assert (!hb_set_allocation_successful (b)); hb_set_clear (b); From b2fbe55b828ea5864bc0aed54db7109a2e189de2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 9 Oct 2018 01:07:36 -0400 Subject: [PATCH 03/10] [icu] Unbreak --- src/hb-icu.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-icu.cc b/src/hb-icu.cc index 83a15e7f2..e012314b5 100644 --- a/src/hb-icu.cc +++ b/src/hb-icu.cc @@ -311,8 +311,8 @@ static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_ hb_unicode_funcs_set_general_category_func (funcs, hb_icu_unicode_general_category, nullptr, nullptr); hb_unicode_funcs_set_mirroring_func (funcs, hb_icu_unicode_mirroring, nullptr, nullptr); hb_unicode_funcs_set_script_func (funcs, hb_icu_unicode_script, nullptr, nullptr); - hb_unicode_funcs_set_compose_func (funcs, hb_icu_unicode_compose, nullptr, nullptr); - hb_unicode_funcs_set_decompose_func (funcs, hb_icu_unicode_decompose, nullptr, nullptr); + hb_unicode_funcs_set_compose_func (funcs, hb_icu_unicode_compose, user_data, nullptr); + hb_unicode_funcs_set_decompose_func (funcs, hb_icu_unicode_decompose, user_data, nullptr); hb_unicode_funcs_make_immutable (funcs); From cc126f2817844a2e83e973129e5b2caa18de599f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 9 Oct 2018 01:10:15 -0400 Subject: [PATCH 04/10] Minor --- src/Makefile.am | 2 +- test/shaping/Makefile.am | 2 ++ test/subset/Makefile.am | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 73631992c..2eca356b4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,7 +13,7 @@ TESTS = check_PROGRAMS = # Convenience targets: -lib: $(BUILT_SOURCES) libharfbuzz.la libharfbuzz-subset.la +lib: $(BUILT_SOURCES) libharfbuzz.la libs: $(BUILT_SOURCES) $(lib_LTLIBRARIES) fuzzing: $(BUILT_SOURCES) libharfbuzz-fuzzing.la libharfbuzz-subset-fuzzing.la diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am index 732033650..5ca9bc197 100644 --- a/test/shaping/Makefile.am +++ b/test/shaping/Makefile.am @@ -8,6 +8,8 @@ SUBDIRS = data # Convenience targets: lib: @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib +libs: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs EXTRA_DIST += \ README.md \ diff --git a/test/subset/Makefile.am b/test/subset/Makefile.am index 336d33dfb..1673cfbd1 100644 --- a/test/subset/Makefile.am +++ b/test/subset/Makefile.am @@ -7,7 +7,7 @@ SUBDIRS = data # Convenience targets: lib: - @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs EXTRA_DIST += \ CMakeLists.txt \ From eb2be97f864c726feaa2434e290f962ddfa97069 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 9 Oct 2018 07:48:52 -0400 Subject: [PATCH 05/10] Port test off deprecated API --- test/api/test-shape.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/api/test-shape.c b/test/api/test-shape.c index 2a0024d04..146cf0f4a 100644 --- a/test/api/test-shape.c +++ b/test/api/test-shape.c @@ -55,7 +55,7 @@ glyph_h_advance_func (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED, static hb_bool_t glyph_func (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED, - hb_codepoint_t unicode, hb_codepoint_t variation_selector HB_UNUSED, + hb_codepoint_t unicode, hb_codepoint_t *glyph, void *user_data HB_UNUSED) { @@ -101,7 +101,7 @@ test_shape (void) ffuncs = hb_font_funcs_create (); hb_font_funcs_set_glyph_h_advance_func (ffuncs, glyph_h_advance_func, NULL, NULL); - hb_font_funcs_set_glyph_func (ffuncs, glyph_func, malloc (10), free); + hb_font_funcs_set_nominal_glyph_func (ffuncs, glyph_func, malloc (10), free); hb_font_funcs_set_glyph_h_kerning_func (ffuncs, glyph_h_kerning_func, NULL, NULL); hb_font_set_funcs (font, ffuncs, NULL, NULL); hb_font_funcs_destroy (ffuncs); From bee93e269711a3eda4e7d762b730522564fe6e87 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 9 Oct 2018 08:01:49 -0400 Subject: [PATCH 06/10] Add const to get_*_advances API Ouch! --- src/hb-font.cc | 10 +++++----- src/hb-font.h | 8 ++++---- src/hb-font.hh | 6 +++--- src/hb-ft.cc | 2 +- src/hb-ot-font.cc | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/hb-font.cc b/src/hb-font.cc index f4f2df7c7..fa5e6614b 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -179,7 +179,7 @@ static void hb_font_get_glyph_h_advances_default (hb_font_t* font, void* font_data HB_UNUSED, unsigned int count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned int glyph_stride, hb_position_t *first_advance, unsigned int advance_stride, @@ -211,7 +211,7 @@ static void hb_font_get_glyph_v_advances_default (hb_font_t* font, void* font_data HB_UNUSED, unsigned int count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned int glyph_stride, hb_position_t *first_advance, unsigned int advance_stride, @@ -808,7 +808,7 @@ hb_font_get_glyph_v_advance (hb_font_t *font, void hb_font_get_glyph_h_advances (hb_font_t* font, unsigned count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride) @@ -826,7 +826,7 @@ hb_font_get_glyph_h_advances (hb_font_t* font, void hb_font_get_glyph_v_advances (hb_font_t* font, unsigned count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride) @@ -1053,7 +1053,7 @@ HB_EXTERN void hb_font_get_glyph_advances_for_direction (hb_font_t* font, hb_direction_t direction, unsigned count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride) diff --git a/src/hb-font.h b/src/hb-font.h index e13b0916a..48450e99d 100644 --- a/src/hb-font.h +++ b/src/hb-font.h @@ -134,7 +134,7 @@ typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t; typedef void (*hb_font_get_glyph_advances_func_t) (hb_font_t* font, void* font_data, unsigned count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride, @@ -424,14 +424,14 @@ hb_font_get_glyph_v_advance (hb_font_t *font, HB_EXTERN void hb_font_get_glyph_h_advances (hb_font_t* font, unsigned count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride); HB_EXTERN void hb_font_get_glyph_v_advances (hb_font_t* font, unsigned count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride); @@ -487,7 +487,7 @@ HB_EXTERN void hb_font_get_glyph_advances_for_direction (hb_font_t* font, hb_direction_t direction, unsigned count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride); diff --git a/src/hb-font.hh b/src/hb-font.hh index 8b19dd715..47f5261e8 100644 --- a/src/hb-font.hh +++ b/src/hb-font.hh @@ -237,7 +237,7 @@ struct hb_font_t } inline void get_glyph_h_advances (unsigned int count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned int glyph_stride, hb_position_t *first_advance, unsigned int advance_stride) @@ -250,7 +250,7 @@ struct hb_font_t } inline void get_glyph_v_advances (unsigned int count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned int glyph_stride, hb_position_t *first_advance, unsigned int advance_stride) @@ -378,7 +378,7 @@ struct hb_font_t } inline void get_glyph_advances_for_direction (hb_direction_t direction, unsigned count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride) diff --git a/src/hb-ft.cc b/src/hb-ft.cc index fcd87a078..79ce8f49a 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -221,7 +221,7 @@ hb_ft_get_variation_glyph (hb_font_t *font HB_UNUSED, static void hb_ft_get_glyph_h_advances (hb_font_t* font, void* font_data, unsigned count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride, diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 582083979..686c873dd 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -66,7 +66,7 @@ hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED, static void hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data, unsigned count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride, @@ -86,7 +86,7 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data, static void hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data, unsigned count, - hb_codepoint_t *first_glyph, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride, From e4f27f368f8f0509fa47f6a28f3984e90b40588f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 9 Oct 2018 08:20:10 -0400 Subject: [PATCH 07/10] Try fixing older bots --- src/hb-ot-shape-fallback.cc | 42 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index bf1fc8fbb..556c34089 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -435,33 +435,33 @@ _hb_ot_shape_fallback_mark_position (const hb_ot_shape_plan_t *plan, } +struct hb_ot_shape_fallback_kern_driver_t +{ + hb_ot_shape_fallback_kern_driver_t (hb_font_t *font_, + hb_buffer_t *buffer) : + font (font_), direction (buffer->props.direction) {} + + hb_position_t get_kerning (hb_codepoint_t first, hb_codepoint_t second) const + { + hb_position_t kern = 0; + font->get_glyph_kerning_for_direction (first, second, + direction, + &kern, &kern); + return kern; + } + + hb_font_t *font; + hb_direction_t direction; +}; + /* Performs font-assisted kerning. */ void _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) { - struct driver_t - { - driver_t (hb_font_t *font_, - hb_buffer_t *buffer) : - font (font_), direction (buffer->props.direction) {} - - hb_position_t get_kerning (hb_codepoint_t first, hb_codepoint_t second) const - { - hb_position_t kern = 0; - font->get_glyph_kerning_for_direction (first, second, - direction, - &kern, &kern); - return kern; - } - - hb_font_t *font; - hb_direction_t direction; - } driver (font, buffer); - - hb_kern_machine_t machine (driver); - + hb_ot_shape_fallback_kern_driver_t driver (font, buffer); + hb_kern_machine_t machine (driver); machine.kern (font, buffer, plan->kern_mask); } From e640f3a6b16f41cee5f7868ec738fda01244e96a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 9 Oct 2018 08:28:07 -0400 Subject: [PATCH 08/10] Another old bot fix --- src/hb-aat-layout-kerx-table.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index 6a793a3e4..49d188c36 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -212,7 +212,7 @@ struct KerxSubTableFormat6 struct KerxTable { - friend kerx; + friend struct kerx; inline unsigned int get_size (void) const { return length; } inline unsigned int get_type (void) const { return coverage & SubtableType; } From 8e4ad1d7a0a35298ca04828ef1ef18b4c019ec03 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 25 Jul 2018 18:12:34 +0800 Subject: [PATCH 09/10] builds: Fix and clean up MSVC DLL builds Instead of passing a CFLAG/CXXFLAG to define HB_EXTERN, define it directly in src/hb.hh as __declspec(dllexport) extern when we are building HarfBuzz as DLLs on Visual Studio. Define HB_INTERNAL as nothing without defining HB_NO_VISIBILITY when building HarfBuzz as DLLs to avoid linker errors on Visual Studio builds. Also "install" harfbuzz-subset.dll into $(PREFIX)\bin as the hb-subset utility will depend on that DLL at runtime, when HarfBuzz is built as DLLs. Since it consists of private APIs that are subject to change, we do not install its headers nor .lib file. --- CMakeLists.txt | 7 ++++++- src/hb.hh | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 694965617..d97f7c269 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -574,7 +574,7 @@ if (HB_HAVE_GOBJECT) endif () if (BUILD_SHARED_LIBS AND WIN32 AND NOT MINGW) - add_definitions("-DHB_EXTERN=__declspec(dllexport) extern") + add_definitions("-DHB_DLL_EXPORT") endif () # On Windows, g-ir-scanner requires a DLL build in order for it to work @@ -772,6 +772,11 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/harfbuzz ) if (HB_BUILD_UTILS) + if (WIN32 AND BUILD_SHARED_LIBS) + install(TARGETS harfbuzz-subset + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + endif () install(TARGETS hb-view RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) diff --git a/src/hb.hh b/src/hb.hh index cfe6d68fb..152285221 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -39,6 +39,10 @@ #define _POSIX_C_SOURCE 200809L #endif +#if defined (_MSC_VER) && defined (HB_DLL_EXPORT) +#define HB_EXTERN __declspec (dllexport) extern +#endif + #include "hb.h" #define HB_H_IN #ifdef HAVE_OT @@ -178,8 +182,10 @@ struct _hb_alignof # if !defined(HB_NO_VISIBILITY) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_MSC_VER) && !defined(__SUNPRO_CC) # define HB_INTERNAL __attribute__((__visibility__("hidden"))) # elif defined(__MINGW32__) - /* We use -export-symbols on mingw32, since it does not support visibility - * attribute. */ + /* We use -export-symbols on mingw32, since it does not support visibility attributes. */ +# define HB_INTERNAL +# elif defined (_MSC_VER) && defined (HB_DLL_EXPORT) + /* We do not try to export internal symbols on Visual Studio */ # define HB_INTERNAL #else # define HB_INTERNAL From 4035158de46ce373b7521daf61c5b6df83312968 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 25 Jul 2018 18:26:10 +0800 Subject: [PATCH 10/10] test/api/test-subset-*.c: Fix build on pre-C99 Ensure that we have the variables at the beginning of the block. These are the only fixes that we need for building HarfBuzz on older compilers. --- test/api/test-collect-unicodes.c | 9 ++++++--- test/api/test-subset-glyf.c | 19 +++++++++++++------ test/api/test-subset-hdmx.c | 8 ++++++-- test/api/test-subset-hmtx.c | 3 ++- test/api/test-subset-post.c | 3 ++- test/api/test-subset-vmtx.c | 6 ++++-- test/api/test-subset.c | 12 +++++++++--- 7 files changed, 42 insertions(+), 18 deletions(-) diff --git a/test/api/test-collect-unicodes.c b/test/api/test-collect-unicodes.c index affe93149..f7a781302 100644 --- a/test/api/test-collect-unicodes.c +++ b/test/api/test-collect-unicodes.c @@ -32,10 +32,11 @@ test_collect_unicodes_format4 (void) { hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format4.ttf"); hb_set_t *codepoints = hb_set_create(); + hb_codepoint_t cp; hb_face_collect_unicodes (face, codepoints); - hb_codepoint_t cp = HB_SET_VALUE_INVALID; + cp = HB_SET_VALUE_INVALID; g_assert (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x61, ==, cp); g_assert (hb_set_next (codepoints, &cp)); @@ -53,10 +54,11 @@ test_collect_unicodes_format12 (void) { hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format12.ttf"); hb_set_t *codepoints = hb_set_create(); + hb_codepoint_t cp; hb_face_collect_unicodes (face, codepoints); - hb_codepoint_t cp = HB_SET_VALUE_INVALID; + cp = HB_SET_VALUE_INVALID; g_assert (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x61, ==, cp); g_assert (hb_set_next (codepoints, &cp)); @@ -74,10 +76,11 @@ test_collect_unicodes (void) { hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf"); hb_set_t *codepoints = hb_set_create(); + hb_codepoint_t cp; hb_face_collect_unicodes (face, codepoints); - hb_codepoint_t cp = HB_SET_VALUE_INVALID; + cp = HB_SET_VALUE_INVALID; g_assert (hb_set_next (codepoints, &cp)); g_assert_cmpuint (0x61, ==, cp); g_assert (hb_set_next (codepoints, &cp)); diff --git a/test/api/test-subset-glyf.c b/test/api/test-subset-glyf.c index 6f669daef..af9439c0f 100644 --- a/test/api/test-subset-glyf.c +++ b/test/api/test-subset-glyf.c @@ -105,16 +105,18 @@ test_subset_glyf_with_gsub (void) { hb_face_t *face_fil = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fil.ttf"); hb_face_t *face_fi = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fi.ttf"); + hb_subset_input_t *input; + hb_face_t *face_subset; hb_set_t *codepoints = hb_set_create(); hb_set_add (codepoints, 102); // f hb_set_add (codepoints, 105); // i - hb_subset_input_t *input = hb_subset_test_create_input (codepoints); + input = hb_subset_test_create_input (codepoints); hb_set_destroy (codepoints); hb_subset_input_set_drop_layout (input, false); - hb_face_t *face_subset = hb_subset_test_create_subset (face_fil, input); + face_subset = hb_subset_test_create_subset (face_fil, input); hb_subset_test_check (face_fi, face_subset, HB_TAG ('g','l','y','f')); hb_subset_test_check (face_fi, face_subset, HB_TAG ('l','o','c', 'a')); @@ -130,16 +132,18 @@ test_subset_glyf_without_gsub (void) { hb_face_t *face_fil = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fil.ttf"); hb_face_t *face_fi = hb_subset_test_open_font ("fonts/Roboto-Regular.nogsub.fi.ttf"); + hb_subset_input_t *input; + hb_face_t *face_subset; hb_set_t *codepoints = hb_set_create(); hb_set_add (codepoints, 102); // f hb_set_add (codepoints, 105); // i - hb_subset_input_t *input = hb_subset_test_create_input (codepoints); + input = hb_subset_test_create_input (codepoints); hb_set_destroy (codepoints); hb_subset_input_set_drop_layout (input, true); - hb_face_t *face_subset = hb_subset_test_create_subset (face_fil, input); + face_subset = hb_subset_test_create_subset (face_fil, input); hb_subset_test_check (face_fi, face_subset, HB_TAG ('g','l','y','f')); hb_subset_test_check (face_fi, face_subset, HB_TAG ('l','o','c', 'a')); @@ -233,16 +237,19 @@ test_subset_glyf_strip_hints_invalid (void) '3', '@', '_', '%', '&', ')', '*', '$', '!' }; unsigned int i; + hb_subset_input_t *input; + hb_face_t *face_subset; + for (i = 0; i < sizeof (text) / sizeof (hb_codepoint_t); i++) { hb_set_add (codepoints, text[i]); } - hb_subset_input_t *input = hb_subset_test_create_input (codepoints); + input = hb_subset_test_create_input (codepoints); hb_subset_input_set_drop_hints (input, true); hb_set_destroy (codepoints); - hb_face_t *face_subset = hb_subset_test_create_subset (face, input); + face_subset = hb_subset_test_create_subset (face, input); g_assert (face_subset); g_assert (face_subset == hb_face_get_empty ()); diff --git a/test/api/test-subset-hdmx.c b/test/api/test-subset-hdmx.c index 8a1e821a3..ddcdedce3 100644 --- a/test/api/test-subset-hdmx.c +++ b/test/api/test-subset-hdmx.c @@ -76,11 +76,13 @@ test_subset_hdmx_invalid (void) hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_set_t *codepoints = hb_subset_input_unicode_set (input); + hb_face_t *subset; + hb_set_add (codepoints, 'a'); hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'c'); - hb_face_t *subset = hb_subset (face, input); + subset = hb_subset (face, input); g_assert (subset); g_assert (subset == hb_face_get_empty ()); @@ -96,11 +98,13 @@ test_subset_hdmx_fails_sanitize (void) hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_set_t *codepoints = hb_subset_input_unicode_set (input); + hb_face_t *subset; + hb_set_add (codepoints, 'a'); hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'c'); - hb_face_t *subset = hb_subset (face, input); + subset = hb_subset (face, input); g_assert (subset); g_assert (subset == hb_face_get_empty ()); diff --git a/test/api/test-subset-hmtx.c b/test/api/test-subset-hmtx.c index 8b57ca7c6..551e50672 100644 --- a/test/api/test-subset-hmtx.c +++ b/test/api/test-subset-hmtx.c @@ -154,6 +154,7 @@ static void test_subset_invalid_hmtx (void) { hb_face_t *face = hb_subset_test_open_font("fonts/crash-e4e0bb1458a91b692eba492c907ae1f94e635480"); + hb_face_t *subset; hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_set_t *codepoints = hb_subset_input_unicode_set (input); @@ -161,7 +162,7 @@ test_subset_invalid_hmtx (void) hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'c'); - hb_face_t *subset = hb_subset (face, input); + subset = hb_subset (face, input); g_assert (subset); g_assert (subset == hb_face_get_empty ()); diff --git a/test/api/test-subset-post.c b/test/api/test-subset-post.c index 948b18a23..c14741e4a 100644 --- a/test/api/test-subset-post.c +++ b/test/api/test-subset-post.c @@ -34,11 +34,12 @@ test_post_drops_glyph_names (void) { hb_face_t *face_full = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf"); hb_face_t *face_subset = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E.ttf"); + hb_face_t *face_full_subset; hb_set_t *codepoints = hb_set_create (); hb_set_add (codepoints, 0x660E); - hb_face_t *face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints)); + face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints)); hb_set_destroy (codepoints); hb_subset_test_check (face_subset, face_full_subset, HB_TAG ('p','o','s','t')); diff --git a/test/api/test-subset-vmtx.c b/test/api/test-subset-vmtx.c index 437f0c2f5..40ea8f872 100644 --- a/test/api/test-subset-vmtx.c +++ b/test/api/test-subset-vmtx.c @@ -48,11 +48,12 @@ test_subset_vmtx_simple_subset (void) { hb_face_t *face_full = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf"); hb_face_t *face_subset = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E.ttf"); + hb_face_t *face_full_subset; hb_set_t *codepoints = hb_set_create (); hb_set_add (codepoints, 0x660E); - hb_face_t *face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints)); + face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints)); hb_set_destroy (codepoints); check_num_vmetrics(face_full_subset, 1); /* nothing has same width */ @@ -67,6 +68,7 @@ static void test_subset_vmtx_noop (void) { hb_face_t *face_full = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf"); + hb_face_t *face_full_subset; hb_set_t *codepoints = hb_set_create(); hb_set_add (codepoints, 0x660E); @@ -75,7 +77,7 @@ test_subset_vmtx_noop (void) hb_set_add (codepoints, 0x5EA6); hb_set_add (codepoints, 0x8F38); hb_set_add (codepoints, 0x6E05); - hb_face_t *face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints)); + face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints)); hb_set_destroy (codepoints); check_num_vmetrics(face_full_subset, 1); /* all have the same width */ diff --git a/test/api/test-subset.c b/test/api/test-subset.c index b0a3446c7..2fc885a6d 100644 --- a/test/api/test-subset.c +++ b/test/api/test-subset.c @@ -36,11 +36,13 @@ test_subset_32_tables (void) hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_set_t *codepoints = hb_subset_input_unicode_set (input); + hb_face_t *subset; + hb_set_add (codepoints, 'a'); hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'c'); - hb_face_t *subset = hb_subset (face, input); + subset = hb_subset (face, input); g_assert (subset); g_assert (subset != hb_face_get_empty ()); @@ -56,11 +58,13 @@ test_subset_no_inf_loop (void) hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_set_t *codepoints = hb_subset_input_unicode_set (input); + hb_face_t *subset; + hb_set_add (codepoints, 'a'); hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'c'); - hb_face_t *subset = hb_subset (face, input); + subset = hb_subset (face, input); g_assert (subset); g_assert (subset == hb_face_get_empty ()); @@ -76,11 +80,13 @@ test_subset_crash (void) hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_set_t *codepoints = hb_subset_input_unicode_set (input); + hb_face_t *subset; + hb_set_add (codepoints, 'a'); hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'c'); - hb_face_t *subset = hb_subset (face, input); + subset = hb_subset (face, input); g_assert (subset); g_assert (subset == hb_face_get_empty ());