[HarfBuzz] harfbuzz: Branch 'master' - 13 commits
.circleci/config.yml | 17 + BUILD.md |2 CMakeLists.txt |8 README.python.md |2 README.wine.md |6 src/Makefile.am |4 src/hb-aat-layout-kerx-table.hh |8 src/hb-common.cc |2 src/hb-coretext.cc |4 src/hb-machinery.hh |2 src/hb-map.hh |2 src/hb-null.hh |4 src/hb-open-file.hh |2 src/hb-ot-layout-common.hh |2 src/hb-ot-layout-gdef-table.hh |2 src/hb-ot-layout-gpos-table.hh |2 src/hb-ot-layout-gsub-table.hh |2 src/hb-ot-layout-gsubgpos.hh |4 src/hb-ot-tag.cc |2 src/hb-shape-plan.cc |8 test/api/Makefile.am | 10 test/api/test-map.c | 117 ++ test/api/test-ot-name.c | 18 - test/api/test-set.c |3 test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5728971283496960 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-5713868010553344 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6278851874258944 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5649959857160192 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5664873493561344 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5762953198960640 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5764636557705216 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5690658895953920 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5695279609675776 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5718215406125056 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5743250149736448 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5765071062958080 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-subset-get-codepoints-fuzzer-5930139383758848 |binary test/fuzzing/hb-shape-fuzzer.cc | 42 +-- test/fuzzing/run-shape-fuzzer-tests.py | 31 ++ 39 files changed, 240 insertions(+), 66 deletions(-) New commits: commit 2352cc3539b2e58d0481cdb8b9cd48cbc09a778e Author: Behdad Esfahbod Date: Fri Oct 19 09:58:45 2018 -0700 [kerx] Whitespace diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index c09a6d31..9727e396 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -143,12 +143,12 @@ struct KerxSubTableFormat1 if (flags & Reset) { -depth = 0; + depth = 0; } if (flags & Push) { -if (likely (depth < ARRAY_LENGTH (stack))) + if (likely (depth < ARRAY_LENGTH (stack))) stack[depth++] = buffer->idx; else
[HarfBuzz] harfbuzz: Branch 'master' - 13 commits
.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 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 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 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; ^~~~
[HarfBuzz] harfbuzz: Branch 'master' - 13 commits
src/Makefile.am |2 src/Makefile.sources|3 src/hb-common.cc| 334 src/hb-common.h | 31 src/hb-font.cc |4 src/hb-ft.cc|2 src/hb-ot-layout-private.hh |6 src/hb-ot-layout.cc |4 src/hb-ot-math.cc |7 src/hb-ot-var-fvar-table.hh | 208 +++ src/hb-ot-var.cc| 100 + src/hb-ot-var.h | 96 src/hb-ot.h |1 src/hb-shape.cc | 248 src/hb-shape.h | 16 -- test/api/test-ot-math.c | 32 +++- 16 files changed, 812 insertions(+), 282 deletions(-) New commits: commit b3c0714b4bbb726b2b3e5e0416ac84cb5c6eb34e Author: Behdad EsfahbodDate: Fri Jan 20 20:30:03 2017 -0800 [var] Add hb_var_coord_t and parsing routines diff --git a/src/hb-common.cc b/src/hb-common.cc index 04d9fb0..25c979c 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -607,7 +607,8 @@ hb_version_atleast (unsigned int major, } -/* hb_feature_t */ + +/* hb_feature_t and hb_var_coord_t */ static bool parse_space (const char **pp, const char *end) @@ -654,6 +655,28 @@ parse_uint (const char **pp, const char *end, unsigned int *pv) } static bool +parse_float (const char **pp, const char *end, float *pv) +{ + char buf[32]; + unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp)); + strncpy (buf, *pp, len); + buf[len] = '\0'; + + char *p = buf; + char *pend = p; + float v; + + errno = 0; + v = strtof (p, ); + if (errno || p == pend) +return false; + + *pv = v; + *pp += pend - p; + return true; +} + +static bool parse_bool (const char **pp, const char *end, unsigned int *pv) { parse_space (pp, end); @@ -673,6 +696,8 @@ parse_bool (const char **pp, const char *end, unsigned int *pv) return true; } +/* hb_feature_t */ + static bool parse_feature_value_prefix (const char **pp, const char *end, hb_feature_t *feature) { @@ -687,7 +712,7 @@ parse_feature_value_prefix (const char **pp, const char *end, hb_feature_t *feat } static bool -parse_feature_tag (const char **pp, const char *end, hb_feature_t *feature) +parse_tag (const char **pp, const char *end, hb_tag_t *tag) { parse_space (pp, end); @@ -706,7 +731,7 @@ parse_feature_tag (const char **pp, const char *end, hb_feature_t *feature) if (p == *pp || *pp - p > 4) return false; - feature->tag = hb_tag_from_string (p, *pp - p); + *tag = hb_tag_from_string (p, *pp - p); if (quote) { @@ -759,12 +784,11 @@ parse_feature_value_postfix (const char **pp, const char *end, hb_feature_t *fea return !had_equal || had_value; } - static bool parse_one_feature (const char **pp, const char *end, hb_feature_t *feature) { return parse_feature_value_prefix (pp, end, feature) && -parse_feature_tag (pp, end, feature) && +parse_tag (pp, end, >tag) && parse_feature_indices (pp, end, feature) && parse_feature_value_postfix (pp, end, feature) && parse_space (pp, end) && @@ -855,3 +879,63 @@ hb_feature_to_string (hb_feature_t *feature, memcpy (buf, s, len); buf[len] = '\0'; } + +/* hb_var_coord_t */ + +static bool +parse_var_coord_value (const char **pp, const char *end, hb_var_coord_t *var_coord) +{ + parse_char (pp, end, '='); /* Optional. */ + return parse_float (pp, end, _coord->value); +} + +static bool +parse_one_var_coord (const char **pp, const char *end, hb_var_coord_t *var_coord) +{ + return parse_tag (pp, end, _coord->tag) && +parse_var_coord_value (pp, end, var_coord) && +parse_space (pp, end) && +*pp == end; +} + +hb_bool_t +hb_var_coord_from_string (const char *str, int len, + hb_var_coord_t *var_coord) +{ + hb_var_coord_t coord; + + if (len < 0) +len = strlen (str); + + if (likely (parse_one_var_coord (, str + len, ))) + { +if (var_coord) + *var_coord = coord; +return true; + } + + if (var_coord) +memset (var_coord, 0, sizeof (*var_coord)); + return false; +} + +void +hb_var_coord_to_string (hb_var_coord_t *var_coord, + char *buf, unsigned int size) +{ + if (unlikely (!size)) return; + + char s[128]; + unsigned int len = 0; + hb_tag_to_string (var_coord->tag, s + len); + len += 4; + while (len && s[len - 1] == ' ') +len--; + s[len++] = '='; + len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", var_coord->value)); + + assert (len < ARRAY_LENGTH (s)); + len = MIN (len, size - 1); + memcpy (buf, s, len); + buf[len] = '\0'; +} diff --git a/src/hb-common.h b/src/hb-common.h index dd72a9d..e483fb8 100644 --- a/src/hb-common.h +++ b/src/hb-common.h @@ -362,7 +362,7 @@ typedef struct hb_user_data_key_t { typedef void (*hb_destroy_func_t) (void *user_data); -/* Font
[HarfBuzz] harfbuzz: Branch 'master' - 13 commits
src/hb-common.h |2 src/hb-open-type-private.hh |2 src/hb-ot-layout-private.hh |2 src/hb-private.hh |2 src/hb-shape.cc | 102 +--- util/options.cc |4 + 6 files changed, 85 insertions(+), 29 deletions(-) New commits: commit fe6788bc570d77d5b3aafc68efd51ca6b80499b1 Author: Behdad Esfahbod beh...@behdad.org Date: Fri Jul 25 12:40:56 2014 -0400 Typo diff --git a/src/hb-common.h b/src/hb-common.h index 32a62e5..f5141b9 100644 --- a/src/hb-common.h +++ b/src/hb-common.h @@ -316,7 +316,7 @@ typedef enum hb_script_t hb_script_from_iso15924_tag (hb_tag_t tag); -/* suger for tag_from_string() then script_from_iso15924_tag */ +/* sugar for tag_from_string() then script_from_iso15924_tag */ /* len=-1 means s is NUL-terminated */ hb_script_t hb_script_from_string (const char *s, int len); commit 0de25d4184d2d92b1a2ebb6fa054275aaae4c316 Author: Behdad Esfahbod beh...@behdad.org Date: Fri Jul 25 12:35:03 2014 -0400 [util] Note CSS compatibility in --help-features diff --git a/util/options.cc b/util/options.cc index 738fb7a..0adc179 100644 --- a/util/options.cc +++ b/util/options.cc @@ -304,7 +304,9 @@ shape_options_t::add_options (option_parser_t *parser) const gchar *features_help = Comma-separated list of font features\n \n Features can be enabled or disabled, either globally or limited to\n -specific character ranges.\n +specific character ranges. The format for specifying feature settings\n +follows. All valid CSS font-feature-settings values other than 'normal'\n +and 'inherited' are also accepted, though, not documented below.\n \n The range indices refer to the positions between Unicode characters,\n unless the --utf8-clusters is provided, in which case range indices\n commit 6e69200a2aadbc6bba35ffb4a058c14286b84f46 Author: Behdad Esfahbod beh...@behdad.org Date: Fri Jul 25 12:30:47 2014 -0400 Fix snprintf() format Patch from Maks Naumov. Fixes https://github.com/behdad/harfbuzz/pull/22 diff --git a/src/hb-shape.cc b/src/hb-shape.cc index efe3bff..812cf59 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -257,18 +257,18 @@ hb_feature_to_string (hb_feature_t *feature, { s[len++] = '['; if (feature-start) - len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, %d, feature-start)); + len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, %u, feature-start)); if (feature-end != feature-start + 1) { s[len++] = ':'; if (feature-end != (unsigned int) -1) - len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, %d, feature-end)); + len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, %u, feature-end)); } s[len++] = ']'; } if (feature-value 1) { s[len++] = '='; -len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, %d, feature-value)); +len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, %u, feature-value)); } assert (len ARRAY_LENGTH (s)); len = MIN (len, size - 1); commit 5c5cdbbdf8be231c433e21b050a6c6991d327b61 Author: Behdad Esfahbod beh...@behdad.org Date: Fri Jul 25 12:21:49 2014 -0400 Make sure broken feature strings are not partially parsed If user doesn't check hb_feature_from_string() return value, we don't want them to end up see the partially-parsed feature. diff --git a/src/hb-shape.cc b/src/hb-shape.cc index f5a4ef2..efe3bff 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -37,8 +37,7 @@ static bool parse_space (const char **pp, const char *end) { - char c; - while (*pp end (c = **pp, ISSPACE (c))) + while (*pp end ISSPACE (**pp)) (*pp)++; return true; } @@ -201,7 +200,7 @@ parse_one_feature (const char **pp, const char *end, hb_feature_t *feature) * hb_feature_from_string: * @str: (array length=len): * @len: - * @feature: (out): + * @feature: (out) (allow-none): * * * @@ -213,10 +212,21 @@ hb_bool_t hb_feature_from_string (const char *str, int len, hb_feature_t *feature) { + hb_feature_t feat; + if (len 0) len = strlen (str); - return parse_one_feature (str, str + len, feature); + if (likely (parse_one_feature (str, str + len, feat))) + { +if (feature) + *feature = feat; +return true; + } + + if (feature) +memset (feature, 0, sizeof (*feature)); + return false; } /** commit a795fe637846e0d9561d2f7cdd84cfafd58b23a7 Author: Behdad Esfahbod beh...@behdad.org Date: Fri Jul 25 12:15:33 2014 -0400 Allow quotation marks around feature tag in hb_feature_from_string() With this, I believe we accept CSS feature strings completely. diff --git a/src/hb-shape.cc b/src/hb-shape.cc index 2ed6ce9..f5a4ef2 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -117,16 +117,34 @@ parse_feature_tag (const char **pp, const