.circleci/config.yml | 43 +++++++++++++++++++------------------- src/hb-buffer.cc | 2 + src/hb-buffer.hh | 3 +- src/hb-common.cc | 7 ++++++ src/hb-common.h | 4 +-- src/hb-font.cc | 12 ++++++++++ src/hb-ft.cc | 19 ---------------- src/hb-ot-font.cc | 22 ------------------- src/hb-ot-layout.hh | 12 ++++++++-- src/hb-ot-map.hh | 2 + src/hb-ot-shape-complex-arabic.cc | 3 ++ src/hb-ot-shape-complex-indic.cc | 34 +++++++++++++++--------------- src/hb-ot-shape-complex-khmer.cc | 18 +++++++-------- test/api/test-multithread.c | 2 - util/options.cc | 12 +++++----- util/options.hh | 34 +++++++++++++++++++----------- 16 files changed, 117 insertions(+), 112 deletions(-)
New commits: commit 89ed040b21b366c927199bedd0e4cb060389d076 Author: Behdad Esfahbod <beh...@behdad.org> Date: Sun Sep 30 06:06:26 2018 -0400 [util] Fix more non-virtual-destructor warnings diff --git a/util/options.hh b/util/options.hh index 1a26697d..4d920ad0 100644 --- a/util/options.hh +++ b/util/options.hh @@ -67,7 +67,8 @@ struct option_group_t struct option_parser_t { - option_parser_t (const char *usage) { + option_parser_t (const char *usage) + { memset (this, 0, sizeof (*this)); usage_str = usage; context = g_option_context_new (usage); @@ -75,7 +76,8 @@ struct option_parser_t add_main_options (); } - ~option_parser_t (void) { + virtual ~option_parser_t (void) + { g_option_context_free (context); g_ptr_array_foreach (to_free, (GFunc) g_free, nullptr); g_ptr_array_free (to_free, TRUE); @@ -115,7 +117,8 @@ struct option_parser_t struct view_options_t : option_group_t { - view_options_t (option_parser_t *parser) { + view_options_t (option_parser_t *parser) + { annotate = false; fore = nullptr; back = nullptr; @@ -124,7 +127,7 @@ struct view_options_t : option_group_t add_options (parser); } - ~view_options_t (void) + virtual ~view_options_t (void) { g_free (fore); g_free (back); @@ -159,7 +162,7 @@ struct shape_options_t : option_group_t add_options (parser); } - ~shape_options_t (void) + virtual ~shape_options_t (void) { g_free (direction); g_free (language); @@ -463,7 +466,8 @@ struct font_options_t : option_group_t add_options (parser); } - ~font_options_t (void) { + virtual ~font_options_t (void) + { g_free (font_file); free (variations); g_free (font_funcs); @@ -496,7 +500,8 @@ struct font_options_t : option_group_t struct text_options_t : option_group_t { - text_options_t (option_parser_t *parser) { + text_options_t (option_parser_t *parser) + { text_before = nullptr; text_after = nullptr; @@ -510,7 +515,8 @@ struct text_options_t : option_group_t add_options (parser); } - ~text_options_t (void) { + virtual ~text_options_t (void) + { g_free (text_before); g_free (text_after); g_free (text); @@ -548,7 +554,8 @@ struct text_options_t : option_group_t struct output_options_t : option_group_t { output_options_t (option_parser_t *parser, - const char **supported_formats_ = nullptr) { + const char **supported_formats_ = nullptr) + { output_file = nullptr; output_format = nullptr; supported_formats = supported_formats_; @@ -558,7 +565,8 @@ struct output_options_t : option_group_t add_options (parser); } - ~output_options_t (void) { + virtual ~output_options_t (void) + { g_free (output_file); g_free (output_format); if (fp) commit 2382dd07fa6ff49638b146a523e9d2e93cf69ceb Author: Behdad Esfahbod <beh...@behdad.org> Date: Sun Sep 30 05:54:47 2018 -0400 Minor diff --git a/util/options.hh b/util/options.hh index 0c929a22..1a26697d 100644 --- a/util/options.hh +++ b/util/options.hh @@ -56,12 +56,12 @@ void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN G_GN struct option_group_t { - virtual ~option_group_t () {} + virtual ~option_group_t (void) {} virtual void add_options (struct option_parser_t *parser) = 0; - virtual void pre_parse (GError **error G_GNUC_UNUSED) {}; - virtual void post_parse (GError **error G_GNUC_UNUSED) {}; + virtual void pre_parse (GError **error G_GNUC_UNUSED) {} + virtual void post_parse (GError **error G_GNUC_UNUSED) {} }; commit 9caa432d0c5c09c8151cfce1e2cc184fbdd89594 Author: Behdad Esfahbod <beh...@behdad.org> Date: Sun Sep 30 05:49:08 2018 -0400 [util] Use HB_FALLTHROUGH Sure, gcc knows to warn about this as well: ../../util/options.cc:175:17: warning: this statement may fall through [-Wimplicit-fallthrough=] case 1: m.r = m.t; ~~~~^~~~~ ../../util/options.cc:176:5: note: here case 2: m.b = m.t; ^~~~ But HOLY SMOKES, look at clang -Weverything bot message: options.cc:176:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough] case 2: m.b = m.t; ^ options.cc:176:5: note: insert 'HB_FALLTHROUGH;' to silence this warning case 2: m.b = m.t; ^ HB_FALLTHROUGH; Right, it's telling me to insert "HB_FALLTHROUGH;" there!!!!!!!!! diff --git a/util/options.cc b/util/options.cc index 2897ec8f..bfb11b45 100644 --- a/util/options.cc +++ b/util/options.cc @@ -172,9 +172,9 @@ parse_margin (const char *name G_GNUC_UNUSED, view_options_t *view_opts = (view_options_t *) data; view_options_t::margin_t &m = view_opts->margin; switch (sscanf (arg, "%lf%*[ ,]%lf%*[ ,]%lf%*[ ,]%lf", &m.t, &m.r, &m.b, &m.l)) { - case 1: m.r = m.t; - case 2: m.b = m.t; - case 3: m.l = m.r; + case 1: m.r = m.t; HB_FALLTHROUGH; + case 2: m.b = m.t; HB_FALLTHROUGH; + case 3: m.l = m.r; HB_FALLTHROUGH; case 4: return true; default: g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, @@ -489,7 +489,7 @@ parse_font_size (const char *name G_GNUC_UNUSED, return true; } switch (sscanf (arg, "%lf%*[ ,]%lf", &font_opts->font_size_x, &font_opts->font_size_y)) { - case 1: font_opts->font_size_y = font_opts->font_size_x; + case 1: font_opts->font_size_y = font_opts->font_size_x; HB_FALLTHROUGH; case 2: return true; default: g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, @@ -507,7 +507,7 @@ parse_font_ppem (const char *name G_GNUC_UNUSED, { font_options_t *font_opts = (font_options_t *) data; switch (sscanf (arg, "%d%*[ ,]%d", &font_opts->x_ppem, &font_opts->y_ppem)) { - case 1: font_opts->y_ppem = font_opts->x_ppem; + case 1: font_opts->y_ppem = font_opts->x_ppem; HB_FALLTHROUGH; case 2: return true; default: g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, commit 2e728a7d86c714d845524a0722c2b653feb9d915 Author: Behdad Esfahbod <beh...@behdad.org> Date: Sun Sep 30 05:47:36 2018 -0400 [util] Mark var static From clang -Weverything bot: options.cc:39:3: warning: no previous extern declaration for non-static variable 'supported_font_funcs' [-Wmissing-variable-declarations] diff --git a/util/options.cc b/util/options.cc index 0ab16d62..2897ec8f 100644 --- a/util/options.cc +++ b/util/options.cc @@ -33,7 +33,7 @@ #include <hb-ot.h> #endif -struct supported_font_funcs_t { +static struct supported_font_funcs_t { char name[4]; void (*func) (hb_font_t *); } supported_font_funcs[] = commit e910a1aef4b2413c627240fc06d2a5696b24747a Author: Behdad Esfahbod <beh...@behdad.org> Date: Sun Sep 30 05:46:20 2018 -0400 [util] Add empty virtual destructor to option_group_t From clang -Weverything bot: ./options.hh:57:8: warning: 'option_group_t' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor] struct option_group_t ^ diff --git a/util/options.hh b/util/options.hh index 456e0a0f..0c929a22 100644 --- a/util/options.hh +++ b/util/options.hh @@ -56,6 +56,8 @@ void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN G_GN struct option_group_t { + virtual ~option_group_t () {} + virtual void add_options (struct option_parser_t *parser) = 0; virtual void pre_parse (GError **error G_GNUC_UNUSED) {}; commit b1e07e1e6cc7a8e5445c7aeb9491ae629029011b Author: Behdad Esfahbod <beh...@behdad.org> Date: Sun Sep 30 05:43:22 2018 -0400 [indic/khmer] Remove use of global constructors Alternative woul have been to resurrect F_COMBINE that I removed in 70136a78cb9eda244767f8e8a3d30d0f3c569d01 But this does it for now. I'm not sure why check-static-inits.sh didn't catch this before. Clang -Weverything bot did: CXX libharfbuzz_la-hb-ot-shape-complex-indic.lo hb-ot-shape-complex-indic.cc:99:1: warning: declaration requires a global constructor [-Wglobal-constructors] indic_features[] = ^ 1 warning generated. CXX libharfbuzz_la-hb-ot-shape-complex-khmer.lo hb-ot-shape-complex-khmer.cc:36:1: warning: declaration requires a global constructor [-Wglobal-constructors] khmer_features[] = ^ 1 warning generated. diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index 13bbc8fe..cc8b8d84 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -174,11 +174,13 @@ enum hb_ot_map_feature_flags_t F_MANUAL_ZWNJ = 0x0004u, /* Don't skip over ZWNJ when matching **context**. */ F_MANUAL_ZWJ = 0x0008u, /* Don't skip over ZWJ when matching **input**. */ F_MANUAL_JOINERS = F_MANUAL_ZWNJ | F_MANUAL_ZWJ, + F_GLOBAL_MANUAL_JOINERS= F_GLOBAL | F_MANUAL_JOINERS, F_GLOBAL_SEARCH = 0x0010u, /* If feature not found in LangSys, look for it in global feature list and pick one. */ F_RANDOM = 0x0020u /* Randomly select a glyph from an AlternateSubstFormat1 subtable. */ }; HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t); + struct hb_ot_map_feature_t { hb_tag_t tag; diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 1fec0e56..4131e705 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -102,29 +102,29 @@ indic_features[] = * Basic features. * These features are applied in order, one at a time, after initial_reordering. */ - {HB_TAG('n','u','k','t'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('a','k','h','n'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('r','p','h','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('r','k','r','f'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('p','r','e','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('b','l','w','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('a','b','v','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('h','a','l','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('p','s','t','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('v','a','t','u'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('c','j','c','t'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('n','u','k','t'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('a','k','h','n'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('r','p','h','f'), F_MANUAL_JOINERS}, + {HB_TAG('r','k','r','f'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('p','r','e','f'), F_MANUAL_JOINERS}, + {HB_TAG('b','l','w','f'), F_MANUAL_JOINERS}, + {HB_TAG('a','b','v','f'), F_MANUAL_JOINERS}, + {HB_TAG('h','a','l','f'), F_MANUAL_JOINERS}, + {HB_TAG('p','s','t','f'), F_MANUAL_JOINERS}, + {HB_TAG('v','a','t','u'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('c','j','c','t'), F_GLOBAL_MANUAL_JOINERS}, /* * Other features. * These features are applied all at once, after final_reordering. * Default Bengali font in Windows for example has intermixed * lookups for init,pres,abvs,blws features. */ - {HB_TAG('i','n','i','t'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('p','r','e','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('a','b','v','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('b','l','w','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('p','s','t','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('h','a','l','n'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('i','n','i','t'), F_MANUAL_JOINERS}, + {HB_TAG('p','r','e','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('a','b','v','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('b','l','w','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('p','s','t','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('h','a','l','n'), F_GLOBAL_MANUAL_JOINERS}, /* * Positioning features. * We don't care about the types. diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index f8c0a4be..d46f0b3a 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -39,19 +39,19 @@ khmer_features[] = * Basic features. * These features are applied in order, one at a time, after reordering. */ - {HB_TAG('p','r','e','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('b','l','w','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('a','b','v','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('p','s','t','f'), F_NONE | F_MANUAL_JOINERS}, - {HB_TAG('c','f','a','r'), F_NONE | F_MANUAL_JOINERS}, + {HB_TAG('p','r','e','f'), F_MANUAL_JOINERS}, + {HB_TAG('b','l','w','f'), F_MANUAL_JOINERS}, + {HB_TAG('a','b','v','f'), F_MANUAL_JOINERS}, + {HB_TAG('p','s','t','f'), F_MANUAL_JOINERS}, + {HB_TAG('c','f','a','r'), F_MANUAL_JOINERS}, /* * Other features. * These features are applied all at once. */ - {HB_TAG('p','r','e','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('a','b','v','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('b','l','w','s'), F_GLOBAL | F_MANUAL_JOINERS}, - {HB_TAG('p','s','t','s'), F_GLOBAL | F_MANUAL_JOINERS}, + {HB_TAG('p','r','e','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('a','b','v','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('b','l','w','s'), F_GLOBAL_MANUAL_JOINERS}, + {HB_TAG('p','s','t','s'), F_GLOBAL_MANUAL_JOINERS}, /* * Positioning features. * We don't care about the types. commit 00cd00e64130694ff7b49456d4bc421a153b4e6d Author: Behdad Esfahbod <beh...@behdad.org> Date: Sun Sep 30 05:34:30 2018 -0400 Tweak HB_TAG and HB_UNTAG uint32_t was getting promoted to signed int, which is not what we wanted... Wow, clang has become good at generating warnings... ../../src/hb-common.h:349:29: warning: signed shift result (0xFF000000) sets the sign bit of the shift expression's type ('int') and becomes negative [-Wshift-sign-overflow] _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX, /*< skip >*/ ^~~~~~~~~~ ../../src/hb-common.h:93:20: note: expanded from macro 'HB_TAG_MAX' define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/hb-common.h:89:57: note: expanded from macro 'HB_TAG' define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint8_t)(c1))<<24)|(((uint8_t)(c2))<<16)|(((uint8_t)(c3))<<8)|((uint8_t)(c4)))) ~~~~~~~~~~~~~~~^ ~~ ../../src/hb-common.h:349:3: warning: ISO C restricts enumerator values to range of 'int' (4294967295 is too large) [-Wpedantic] _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX, /*< skip >*/ ^ ~~~~~~~~~~ diff --git a/src/hb-common.h b/src/hb-common.h index fdceff9d..37bbb2b1 100644 --- a/src/hb-common.h +++ b/src/hb-common.h @@ -86,8 +86,8 @@ typedef union _hb_var_int_t { typedef uint32_t hb_tag_t; -#define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint8_t)(c1))<<24)|(((uint8_t)(c2))<<16)|(((uint8_t)(c3))<<8)|((uint8_t)(c4)))) -#define HB_UNTAG(tag) ((uint8_t)((tag)>>24)), ((uint8_t)((tag)>>16)), ((uint8_t)((tag)>>8)), ((uint8_t)(tag)) +#define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint32_t)(c1)&0xFF)<<24)|(((uint32_t)(c2)&0xFF)<<16)|(((uint32_t)(c3)&0xFF)<<8)|((uint32_t)(c4)&0xFF))) +#define HB_UNTAG(tag) (((tag)>>24)&0xFF), (((tag)>>16)&0xFF), (((tag)>>8)&0xFF), ((tag)&0xFF) #define HB_TAG_NONE HB_TAG(0,0,0,0) #define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff) commit 8a31e406291f4cb27480fc85049f08abd739cb59 Author: Behdad Esfahbod <beh...@behdad.org> Date: Sun Sep 30 05:27:39 2018 -0400 [font] Make *_advance() fallback to *_advances And remove redundant implementations. diff --git a/src/hb-font.cc b/src/hb-font.cc index 77762f2d..c0beea66 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -141,6 +141,12 @@ hb_font_get_glyph_h_advance_default (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { + if (font->has_glyph_h_advances_func ()) + { + hb_position_t ret; + font->get_glyph_h_advances (1, &glyph, 0, &ret, 0); + return ret; + } return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph)); } @@ -159,6 +165,12 @@ hb_font_get_glyph_v_advance_default (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { + if (font->has_glyph_v_advances_func ()) + { + hb_position_t ret; + font->get_glyph_v_advances (1, &glyph, 0, &ret, 0); + return ret; + } return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph)); } diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 50182f1b..6da31fc2 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -218,24 +218,6 @@ hb_ft_get_variation_glyph (hb_font_t *font HB_UNUSED, return true; } -static hb_position_t -hb_ft_get_glyph_h_advance (hb_font_t *font, - void *font_data, - hb_codepoint_t glyph, - void *user_data HB_UNUSED) -{ - const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data; - FT_Fixed v; - - if (unlikely (FT_Get_Advance (ft_font->ft_face, glyph, ft_font->load_flags, &v))) - return 0; - - if (font->x_scale < 0) - v = -v; - - return (v + (1<<9)) >> 10; -} - static void hb_ft_get_glyph_h_advances (hb_font_t* font, void* font_data, unsigned count, @@ -480,7 +462,6 @@ static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft //hb_font_funcs_set_font_v_extents_func (funcs, hb_ft_get_font_v_extents, nullptr, nullptr); hb_font_funcs_set_nominal_glyph_func (funcs, hb_ft_get_nominal_glyph, nullptr, nullptr); hb_font_funcs_set_variation_glyph_func (funcs, hb_ft_get_variation_glyph, nullptr, nullptr); - hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ft_get_glyph_h_advance, nullptr, nullptr); hb_font_funcs_set_glyph_h_advances_func (funcs, hb_ft_get_glyph_h_advances, nullptr, nullptr); hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ft_get_glyph_v_advance, nullptr, nullptr); //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ft_get_glyph_h_origin, nullptr, nullptr); diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index faacecb9..280ade5b 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -63,16 +63,6 @@ hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED, return ot_face->cmap.get_relaxed ()->get_variation_glyph (unicode, variation_selector, glyph); } -static hb_position_t -hb_ot_get_glyph_h_advance (hb_font_t *font, - void *font_data, - hb_codepoint_t glyph, - void *user_data HB_UNUSED) -{ - const hb_ot_face_data_t *ot_face = (const hb_ot_face_data_t *) font_data; - return font->em_scale_x (ot_face->hmtx.get_relaxed ()->get_advance (glyph, font)); -} - static void hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data, unsigned count, @@ -93,16 +83,6 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data, } } -static hb_position_t -hb_ot_get_glyph_v_advance (hb_font_t *font, - void *font_data, - hb_codepoint_t glyph, - void *user_data HB_UNUSED) -{ - const hb_ot_face_data_t *ot_face = (const hb_ot_face_data_t *) font_data; - return font->em_scale_y (-(int) ot_face->vmtx.get_relaxed ()->get_advance (glyph, font)); -} - static void hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data, unsigned count, @@ -217,9 +197,7 @@ static struct hb_ot_face_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot hb_font_funcs_set_font_v_extents_func (funcs, hb_ot_get_font_v_extents, nullptr, nullptr); hb_font_funcs_set_nominal_glyph_func (funcs, hb_ot_get_nominal_glyph, nullptr, nullptr); hb_font_funcs_set_variation_glyph_func (funcs, hb_ot_get_variation_glyph, nullptr, nullptr); - hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ot_get_glyph_h_advance, nullptr, nullptr); hb_font_funcs_set_glyph_h_advances_func (funcs, hb_ot_get_glyph_h_advances, nullptr, nullptr); - hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ot_get_glyph_v_advance, nullptr, nullptr); hb_font_funcs_set_glyph_v_advances_func (funcs, hb_ot_get_glyph_v_advances, nullptr, nullptr); //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ot_get_glyph_h_origin, nullptr, nullptr); //hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ot_get_glyph_v_origin, nullptr, nullptr); commit bd07d2878ff28baecf7b4b587a18ffbb744b7eb1 Author: Behdad Esfahbod <beh...@behdad.org> Date: Sun Sep 30 03:54:40 2018 -0400 Use buffer scratch_flags to remember if we had any joiners diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index bcaf066c..24d46400 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -68,7 +68,8 @@ enum hb_buffer_scratch_flags_t { HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK = 0x00000004u, HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT = 0x00000008u, HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK = 0x00000010u, - HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000020u, + HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS = 0x00000020u, + HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000040u, /* Reserved for complex shapers' internal use. */ HB_BUFFER_SCRATCH_FLAG_COMPLEX0 = 0x01000000u, diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh index 7a787b77..d9b954f4 100644 --- a/src/hb-ot-layout.hh +++ b/src/hb-ot-layout.hh @@ -224,8 +224,16 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer) { buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES; props |= UPROPS_MASK_IGNORABLE; - if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ; - else if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ; + if (u == 0x200Cu) + { + props |= UPROPS_MASK_Cf_ZWNJ; + buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS; + } + else if (u == 0x200Du) + { + props |= UPROPS_MASK_Cf_ZWJ; + buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS; + } /* Mongolian Free Variation Selectors need to be remembered * because although we need to hide them like default-ignorables, * they need to non-ignorable during shaping. This is similar to diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index d136a664..c4a695ab 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -399,6 +399,9 @@ flip_joiners (const hb_ot_shape_plan_t *plan HB_UNUSED, hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) { + if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_JOINERS)) + return; + unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; for (unsigned int i = 0; i < count; i++) commit ba0f0f156fe05bda760efcb0c8d34f303fa26ab0 Author: Behdad Esfahbod <beh...@behdad.org> Date: Sun Sep 30 03:49:52 2018 -0400 Document setlocale() threadsafety issue "Fixes" //github.com/harfbuzz/harfbuzz/issues/1191 diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 8fecea72..c9824ec3 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -1499,6 +1499,8 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer) * it will be set to the process's default language as returned by * hb_language_get_default(). This may change in the future by * taking buffer script into consideration when choosing a language. + * Note that hb_language_get_default() is NOT threadsafe the first time + * it is called. See documentation for that function for details. * * Since: 0.9.7 **/ diff --git a/src/hb-common.cc b/src/hb-common.cc index a9c62e80..16f87014 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -361,7 +361,14 @@ hb_language_to_string (hb_language_t language) /** * hb_language_get_default: * + * Get default language from current locale. * + * Note that the first time this function is called, it calls + * "setlocale (LC_CTYPE, nullptr)" to fetch current locale. The underlying + * setlocale function is, in many implementations, NOT threadsafe. To avoid + * problems, call this function once before multiple threads can call it. + * This function is only used from hb_buffer_guess_segment_properties() by + * HarfBuzz itself. * * Return value: (transfer none): * commit 06be2aa93fa6ea8cc32684a4b51bfe927c5202bb Author: Ebrahim Byagowi <ebra...@gnu.org> Date: Sun Sep 30 00:15:25 2018 +0330 [ci] Build glib and freetype and enable msan bot (#1198) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4d1adad2..c96e2921 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,7 +35,7 @@ jobs: - run: apt update && apt install -y ninja-build binutils libtool autoconf automake make cmake gcc g++ pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: ./autogen.sh - - run: make + - run: make -j32 - run: make distcheck || .ci/fail.sh - run: rm -rf harfbuzz-* - run: make distdir && cd harfbuzz-* && cmake -DHB_CHECK=ON -Bbuild -H. -GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test && ninja -Cbuild install @@ -48,7 +48,7 @@ jobs: - run: apk update && apk add ragel make pkgconfig libtool autoconf automake gettext gcc g++ glib-dev freetype-dev cairo-dev # C??FLAGS are not needed for a regular build - run: CFLAGS="-O3" CXXFLAGS="-O3 -DHB_NO_MMAP" ./autogen.sh - - run: make + - run: make -j32 - run: make check || .ci/fail.sh archlinux-debug-O0-py3: @@ -60,7 +60,7 @@ jobs: - run: pip install fonttools # C??FLAGS are not needed for a regular build - run: CFLAGS="-O0" CXXFLAGS="-O0" CPPFLAGS="-DHB_DEBUG" ./autogen.sh --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: make check || .ci/fail.sh clang-O3-O0: @@ -71,12 +71,12 @@ jobs: - run: apt update || true - run: apt install -y ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure && make -j4 && cd .. + - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure && make -j32 && cd .. - run: CFLAGS="-O3" CXXFLAGS="-O3" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh - run: CFLAGS="-O0" CXXFLAGS="-O0" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh clang-everything: @@ -92,7 +92,7 @@ jobs: - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: make check || .ci/fail.sh clang-asan: @@ -108,7 +108,7 @@ jobs: - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: CPPFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: make check || .ci/fail.sh | asan_symbolize | c++filt clang-msan: @@ -121,11 +121,13 @@ jobs: - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdev.list - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdevsrc.list - run: apt update || true - - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt install -y clang lld binutils libtool autoconf automake automake1.11 gtk-doc-tools gettext make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools + - run: wget https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.0.tar.bz2 && tar xf glib-2.28.0.tar.bz2 && cd glib-2.28.0 && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh || true && ./configure && make -j32 --ignore-errors && cd .. + - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh && ./configure && make -j32 && cd .. - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=memory -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make - - run: MSAN_OPTIONS=exitcode=42 make check || .ci/fail.sh | asan_symbolize | c++filt + - run: make -j32 + - run: MSAN_OPTIONS=exitcode=42 LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs:$PWD/glib-2.28.0/glib/.libs" make check || .ci/fail.sh | asan_symbolize | c++filt clang-tsan: docker: @@ -139,10 +141,9 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh && ./configure && make -j4 && cd .. - run: CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=thread -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make - - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh | asan_symbolize | c++filt + - run: make -j32 + - run: make check || .ci/fail.sh | asan_symbolize | c++filt clang-ubsan: docker: @@ -157,7 +158,7 @@ jobs: - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - run: CPPFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined -O1 -g -fno-omit-frame-pointer" CFLAGS="-fsanitize=undefined -O1 -g -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=undefined -O1 -g -fno-omit-frame-pointer" LD=ld.lld CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - - run: make + - run: make -j32 - run: make check || .ci/fail.sh | asan_symbolize | c++filt fedora-outoftreebuild: @@ -189,7 +190,7 @@ jobs: - run: dnf install -y gcc ragel cmake make which glib2-devel freetype-devel cairo-devel libicu-devel graphite2-devel wget tar bzip2 python libnsl || true - run: wget http://$ODSUSER:$odsp...@behdad.org/harfbuzz-private/OracleDeveloperStudio12.6-linux-x86-bin.tar.bz2 && tar xf OracleDeveloperStudio12.6-linux-x86-bin.tar.bz2 --owner root --group root --no-same-owner - run: CC=/root/project/OracleDeveloperStudio12.6-linux-x86-bin/developerstudio12.6/bin/suncc CXX=/root/project/OracleDeveloperStudio12.6-linux-x86-bin/developerstudio12.6/bin/sunCC cmake -DHB_HAVE_GRAPHITE2=ON -DHB_BUILTIN_UCDN=ON -DHB_HAVE_GLIB=ON -DHB_HAVE_FREETYPE=ON -Bbuild -H. - - run: make -Cbuild + - run: make -Cbuild -j32 - run: CTEST_OUTPUT_ON_FAILURE=1 make -Cbuild test - run: make -Cbuild install @@ -200,7 +201,7 @@ jobs: - checkout - run: apt update && apt install -y ragel pkg-config libtool autoconf - run: CFLAGS="-Wno-attributes" CXXFLAGS="-Wno-attributes" ./autogen.sh --prefix=/usr/local/djgpp --host=i586-pc-msdosdjgpp - - run: make + - run: make -j32 crosscompile-notest-freebsd9: docker: @@ -209,7 +210,7 @@ jobs: - checkout - run: apt update && apt install -y pkg-config ragel - run: ./autogen.sh --prefix=/freebsd --host=x86_64-pc-freebsd9 - - run: make + - run: make -j32 crosscompile-notest-psvita: docker: @@ -219,7 +220,7 @@ jobs: - run: apt update && apt install ragel - run: git clone https://github.com/vitasdk/vdpm && cd vdpm && ./bootstrap-vitasdk.sh - run: ./autogen.sh --prefix=/usr/local/vitasdk/arm-vita-eabi --host=arm-vita-eabi - - run: make + - run: make -j32 crosscompile-cmake-notest-android-arm: docker: @@ -283,7 +284,7 @@ workflows: - clang-O3-O0 - clang-everything - clang-asan - #- clang-msan # https://github.com/harfbuzz/harfbuzz/issues/1175 + - clang-msan - clang-tsan - clang-ubsan - fedora-outoftreebuild commit cefdef0247026f941eba8930c73b66b0498bb63c Author: Ebrahim Byagowi <ebra...@gnu.org> Date: Sat Sep 29 10:19:54 2018 +0330 Minor on test-multithread, align the actual and expected results diff --git a/test/api/test-multithread.c b/test/api/test-multithread.c index 116260bd..7e357fd5 100644 --- a/test/api/test-multithread.c +++ b/test/api/test-multithread.c @@ -70,7 +70,7 @@ validity_check (hb_buffer_t *buffer) { out, sizeof (out), NULL, font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES); - fprintf (stderr, "Actual: %s\n", out); + fprintf (stderr, "Actual: %s\n", out); hb_buffer_serialize_glyphs (ref_buffer, 0, hb_buffer_get_length (ref_buffer), out, sizeof (out), NULL, commit 678beff64ca3b2963de25d8a76a2bf3710c3d7a6 Author: Ebrahim Byagowi <ebra...@gnu.org> Date: Sat Sep 29 10:16:14 2018 +0330 [circleci] Add -Wno-reserved-id-macro to clang-everything diff --git a/.circleci/config.yml b/.circleci/config.yml index 67caff06..4d1adad2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,7 +91,7 @@ jobs: - run: apt update || true - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 - run: make - run: make check || .ci/fail.sh _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz