[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-cff-interp-common.hh | 88 +- src/hb-cff-interp-dict-common.hh | 10 - src/hb-cff2-interp-cs.hh |6 test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5647267827023872 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5725855502827520 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5736657639178240 |binary 6 files changed, 23 insertions(+), 81 deletions(-) New commits: commit c968869f212dbfcb86d42fb36049328521cbf00c Merge: 8c05b955 c48f53d3 Author: Behdad Esfahbod Date: Tue Dec 4 04:14:13 2018 -0500 Merge pull request #1441 from harfbuzz/cff-doublenum use double as CFF Number implementation commit c48f53d30901dfc20b7432c2947e66642010dc4e Author: Michiharu Ariza Date: Mon Dec 3 16:59:41 2018 -0800 more double changes diff --git a/src/hb-cff2-interp-cs.hh b/src/hb-cff2-interp-cs.hh index 935a1a1f..d258b814 100644 --- a/src/hb-cff2-interp-cs.hh +++ b/src/hb-cff2-interp-cs.hh @@ -49,7 +49,7 @@ struct BlendArg : Number inline void set_int (int v) { reset_blends (); Number::set_int (v); } inline void set_fixed (int32_t v) { reset_blends (); Number::set_fixed (v); } - inline void set_real (float v) { reset_blends (); Number::set_real (v); } + inline void set_real (double v) { reset_blends (); Number::set_real (v); } inline void set_blends (unsigned int numValues_, unsigned int valueIndex_, unsigned int numBlends, const BlendArg *blends_) @@ -172,7 +172,7 @@ struct CFF2CSInterpEnv : CSInterpEnv double v = arg.to_real (); for (unsigned int i = 0; i < scalars.len; i++) { - v += scalars[i] * arg.deltas[i].to_real (); + v += (double)scalars[i] * arg.deltas[i].to_real (); } arg.set_real (v); arg.deltas.resize (0); diff --git a/test/api/test-ot-extents-cff.c b/test/api/test-ot-extents-cff.c index bb70a626..49b87997 100644 --- a/test/api/test-ot-extents-cff.c +++ b/test/api/test-ot-extents-cff.c @@ -171,7 +171,7 @@ test_extents_cff2_vsindex (void) g_assert_cmpint (extents.x_bearing, ==, 11); g_assert_cmpint (extents.y_bearing, ==, 656); g_assert_cmpint (extents.width, ==, 653); - g_assert_cmpint (extents.height, ==, -657); + g_assert_cmpint (extents.height, ==, -656); result = hb_font_get_glyph_extents (font, 2, &extents); g_assert (result); commit 9424e8052686a6a93e0d30e38aecbe927db9d787 Author: Michiharu Ariza Date: Mon Dec 3 16:18:10 2018 -0800 added minimized test cases diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5647267827023872 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5647267827023872 new file mode 100644 index ..068e7e8f Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5647267827023872 differ diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5725855502827520 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5725855502827520 new file mode 100644 index ..5781bbad Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5725855502827520 differ diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5736657639178240 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5736657639178240 new file mode 100644 index ..343429cf Binary files /dev/null and b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5736657639178240 differ commit 5fff6ab0024547a8ac47723a0047f4b17416d6ce Author: Michiharu Ariza Date: Mon Dec 3 16:06:58 2018 -0800 additional precision made a difference in extents test diff --git a/src/hb-cff-interp-common.hh b/src/hb-cff-interp-common.hh index 396bc8c7..f2ccc2bd 100644 --- a/src/hb-cff-interp-common.hh +++ b/src/hb-cff-interp-common.hh @@ -229,7 +229,7 @@ struct Number { return (int32_t)(value * 65536.0); } - inline void set_real (double v) { value = (double)v; } + inline void set_real (double v) { value = v; } inline double to_real (void) const { return value; diff --git a/src/hb-cff2-interp-cs.hh b/src/hb-cff2-interp-cs.hh index 8d193d62..935a1a1f 100644 --- a/src/hb-cff2-interp-cs.hh +++ b/src/hb-cff2-interp-cs.hh @@ -169,7 +169,7 @@ struct CFF2CSInterpEnv : CSInterpEnv { if (likely (scalars.len == arg.deltas.len)) { - float v = arg.to_real (); + double v = arg.to_real (); for (unsigned int i = 0; i < scalars.len; i++) { v += scalars[i] * arg.deltas[i].to_real (); diff --git a/test/api/test-ot-extents-cff.c b/test/api/test-ot-extents-cff.c index 49b87997..bb70a626 100644 --- a/test/api/test-ot-extents-cf
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
docs/harfbuzz-sections.txt| 14 +-- src/gen-emoji-table.py| 13 +- src/hb-deprecated.h | 37 src/hb-ot-var-fvar-table.hh | 114 + src/hb-ot-var.cc | 41 ++--- src/hb-ot-var.h | 66 ++ src/hb-unicode-emoji-table.hh | 189 +++--- test/api/test-ot-face.c |2 8 files changed, 208 insertions(+), 268 deletions(-) New commits: commit f48bb9a3939067f24a81007e642caaac77cc7167 Author: Behdad Esfahbod Date: Tue Nov 20 20:40:55 2018 -0500 [var] Deprecated axis enumeration API and add new version New version has axis flags. New API: +hb_ot_var_axis_info_t +hb_ot_var_find_axis_info() +hb_ot_var_get_axis_infos() Deprecated API: -HB_OT_VAR_NO_AXIS_INDEX -hb_ot_var_axis_t -hb_ot_var_find_axis() -hb_ot_var_get_axes() diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 63d5f6ce..5f5dcef7 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -161,6 +161,10 @@ hb_ot_layout_table_choose_script hb_ot_layout_table_find_script hb_ot_tag_from_language hb_ot_tags_from_script +HB_OT_VAR_NO_AXIS_INDEX +hb_ot_var_axis_t +hb_ot_var_find_axis +hb_ot_var_get_axes hb_set_invert hb_unicode_eastasian_width_func_t hb_unicode_eastasian_width @@ -581,14 +585,12 @@ HB_OT_TAG_VAR_AXIS_OPTICAL_SIZE HB_OT_TAG_VAR_AXIS_SLANT HB_OT_TAG_VAR_AXIS_WEIGHT HB_OT_TAG_VAR_AXIS_WIDTH -HB_OT_VAR_NO_AXIS_INDEX -hb_ot_var_axis_t hb_ot_var_has_data -hb_ot_var_find_axis -hb_ot_var_get_axis_count -hb_ot_var_get_axes hb_ot_var_axis_flags_t -hb_ot_var_axis_get_flags +hb_ot_var_axis_info_t +hb_ot_var_find_axis_info +hb_ot_var_get_axis_count +hb_ot_var_get_axis_infos hb_ot_var_get_named_instance_count hb_ot_var_named_instance_get_subfamily_name_id hb_ot_var_named_instance_get_postscript_name_id diff --git a/src/hb-deprecated.h b/src/hb-deprecated.h index e39b79f7..a74431f0 100644 --- a/src/hb-deprecated.h +++ b/src/hb-deprecated.h @@ -241,6 +241,43 @@ HB_EXTERN HB_DEPRECATED_FOR (hb_ot_tags_from_script_and_language) hb_tag_t hb_ot_tag_from_language (hb_language_t language); +typedef unsigned int hb_ot_name_id_t; /* Since is in hb-ot.h */ + +/** + * HB_OT_VAR_NO_AXIS_INDEX: + * + * Since: 1.4.2 + * Deprecated: REPLACEME + */ +#define HB_OT_VAR_NO_AXIS_INDEX0xu + +/** + * hb_ot_var_axis_t: + * + * Since: 1.4.2 + * Deprecated: REPLACEME + */ +typedef struct hb_ot_var_axis_t +{ + hb_tag_t tag; + hb_ot_name_id_t name_id; + float min_value; + float default_value; + float max_value; +} hb_ot_var_axis_t; + +HB_EXTERN HB_DEPRECATED_FOR (hb_ot_var_get_axis_infos) unsigned int +hb_ot_var_get_axes (hb_face_t*face, + unsigned int start_offset, + unsigned int *axes_count /* IN/OUT */, + hb_ot_var_axis_t *axes_array /* OUT */); + +HB_EXTERN HB_DEPRECATED_FOR (hb_ot_var_find_axis_info) hb_bool_t +hb_ot_var_find_axis (hb_face_t*face, +hb_tag_t axis_tag, +unsigned int *axis_index, +hb_ot_var_axis_t *axis_info); + #endif HB_END_DECLS diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh index 0bf9d10d..5c8832e1 100644 --- a/src/hb-ot-var-fvar-table.hh +++ b/src/hb-ot-var-fvar-table.hh @@ -115,28 +115,62 @@ struct fvar inline unsigned int get_axis_count (void) const { return axisCount; } - inline bool get_axis (unsigned int index, hb_ot_var_axis_t *info) const + inline void get_axis_deprecated (unsigned int axis_index, + hb_ot_var_axis_t *info) const { -if (info) +const AxisRecord &axis = get_axes ()[axis_index]; +info->tag = axis.axisTag; +info->name_id = axis.axisNameID; +info->default_value = axis.defaultValue / 65536.; +/* Ensure order, to simplify client math. */ +info->min_value = MIN (info->default_value, axis.minValue / 65536.); +info->max_value = MAX (info->default_value, axis.maxValue / 65536.); + } + + inline void get_axis_info (unsigned int axis_index, +hb_ot_var_axis_info_t *info) const + { +const AxisRecord &axis = get_axes ()[axis_index]; +info->axis_index = axis_index; +info->tag = axis.axisTag; +info->name_id = axis.axisNameID; +info->flags = (hb_ot_var_axis_flags_t) (unsigned int) axis.flags; +info->default_value = axis.defaultValue / 65536.; +/* Ensure order, to simplify client math. */ +info->min_value = MIN (info->default_value, axis.minValue / 65536.); +info->max_value = MAX (info->default_value, axis.maxValue / 65536.); +info->reserved = 0; + } + + inline unsigned int get_axes_deprecated (unsigned int start_offset, + unsigned int *axes_count /* IN/OUT */, +
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
docs/harfbuzz-sections.txt |2 ++ src/hb-buffer.h |2 ++ src/hb-dsalgs.hh|6 ++ src/hb-ot-var-fvar-table.hh | 37 ++--- src/hb-ot-var.cc| 12 src/hb-ot-var.h | 15 ++- 6 files changed, 58 insertions(+), 16 deletions(-) New commits: commit 56c9238d3da8c034336cf80ba37e03e33c493718 Author: Behdad Esfahbod Date: Mon Nov 19 13:09:53 2018 -0500 [fvar] Rewrite sanitize diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh index b4fdd5fa..99d2fd5c 100644 --- a/src/hb-ot-var-fvar-table.hh +++ b/src/hb-ot-var-fvar-table.hh @@ -101,12 +101,10 @@ struct fvar return_trace (version.sanitize (c) && likely (version.major == 1) && c->check_struct (this) && + axisSize == 20 && /* Assumed in our code. */ instanceSize >= axisCount * 4 + 4 && - axisSize <= 1024 && /* Arbitrary, just to simplify overflow checks. */ - instanceSize <= 1024 && /* Arbitrary, just to simplify overflow checks. */ - c->check_range (this, firstAxis) && - c->check_range (&StructAtOffset (this, firstAxis), - axisCount * axisSize + instanceCount * instanceSize)); + get_axes ().sanitize (c) && + c->check_range (get_first_instance (), instanceCount, instanceSize)); } inline unsigned int get_axis_count (void) const commit 4a6a692e3ea4fab632a0162c6d513dc151054d8f Author: Behdad Esfahbod Date: Mon Nov 19 13:04:43 2018 -0500 [fvar] Use hb_array_t for axes diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index 7a207f5d..8e59fdee 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -573,6 +573,10 @@ struct hb_array_t inline unsigned int get_size (void) const { return len * sizeof (Type); } + template + inline bool sanitize (hb_sanitize_context_t *c) const + { return c->check_array (arrayZ, len); } + template inline operator T * (void) const { return arrayZ; } inline Type * operator & (void) const { return arrayZ; } @@ -598,6 +602,8 @@ struct hb_array_t Type *arrayZ; unsigned int len; }; +template +hb_array_t hb_array (T *array, unsigned int len) { return hb_array_t (array, len); } struct HbOpOr diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh index 66618a5a..b4fdd5fa 100644 --- a/src/hb-ot-var-fvar-table.hh +++ b/src/hb-ot-var-fvar-table.hh @@ -114,9 +114,6 @@ struct fvar inline bool get_axis (unsigned int index, hb_ot_var_axis_t *info) const { -if (unlikely (index >= axisCount)) - return false; - if (info) { const AxisRecord &axis = get_axes ()[index]; @@ -133,9 +130,6 @@ struct fvar inline hb_ot_var_axis_flags_t get_axis_flags (unsigned int index) const { -if (unlikely (index >= axisCount)) - return (hb_ot_var_axis_flags_t) 0; - const AxisRecord &axis = get_axes ()[index]; return (hb_ot_var_axis_flags_t) (unsigned int) axis.flags; } @@ -195,11 +189,11 @@ struct fvar } protected: - inline const AxisRecord * get_axes (void) const - { return &(this+firstAxis); } + inline hb_array_t get_axes (void) const + { return hb_array (&(this+firstAxis), axisCount); } - inline const InstanceRecord * get_instances (void) const - { return &StructAtOffset (get_axes () + axisCount, 0); } + inline const InstanceRecord * get_first_instance (void) const + { return &StructAfter (get_axes ()); } protected: FixedVersion<>version; /* Version of the fvar table commit e0097396010c40cf62641cd12ceb12dd5d79c9c7 Author: Behdad Esfahbod Date: Mon Nov 19 12:53:53 2018 -0500 [fvar] Minor diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh index 3c8a3da4..66618a5a 100644 --- a/src/hb-ot-var-fvar-table.hh +++ b/src/hb-ot-var-fvar-table.hh @@ -104,8 +104,8 @@ struct fvar instanceSize >= axisCount * 4 + 4 && axisSize <= 1024 && /* Arbitrary, just to simplify overflow checks. */ instanceSize <= 1024 && /* Arbitrary, just to simplify overflow checks. */ - c->check_range (this, things) && - c->check_range (&StructAtOffset (this, things), + c->check_range (this, firstAxis) && + c->check_range (&StructAtOffset (this, firstAxis), axisCount * axisSize + instanceCount * instanceSize)); } @@ -196,7 +196,7 @@ struct fvar protected: inline const AxisRecord * get_axes (void) const - { return &StructAtOffset (this, things); } + { return &(this+firstAxis); } inline const InstanceRecord * get_instances (void) const { return &StructAtOffset (get_axes () + axisCount, 0); } @@ -204,7 +204,8 @@ struct fvar protected: FixedVersion<>version; /* Version of the fvar table
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-aat-layout-kerx-table.hh | 12 +- src/hb-ot-kern-table.hh | 231 +++- test/api/Makefile.am|4 3 files changed, 118 insertions(+), 129 deletions(-) New commits: commit bfafe208da11817b5ebf3751f02af2dcdf57bd19 Author: Behdad Esfahbod Date: Tue Nov 6 12:11:45 2018 -0500 [kern] Switch to dispatch diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index d2242c54..ca2fdb49 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -637,12 +637,12 @@ struct KerxTable unsigned int subtable_type = get_type (); TRACE_DISPATCH (this, subtable_type); switch (subtable_type) { -case 0 : return_trace (c->dispatch (u.format0)); -case 1 : return_trace (c->dispatch (u.format1)); -case 2 : return_trace (c->dispatch (u.format2)); -case 4 : return_trace (c->dispatch (u.format4)); -case 6 : return_trace (c->dispatch (u.format6)); -default: return_trace (c->default_return_value ()); +case 0:return_trace (c->dispatch (u.format0)); +case 1:return_trace (c->dispatch (u.format1)); +case 2:return_trace (c->dispatch (u.format2)); +case 4:return_trace (c->dispatch (u.format4)); +case 6:return_trace (c->dispatch (u.format6)); +default: return_trace (c->default_return_value ()); } } diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index 1073530d..66e827d1 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh @@ -476,6 +476,7 @@ template struct KernSubTable { inline unsigned int get_size (void) const { return u.header.length; } + inline unsigned int get_type (void) const { return u.header.format; } inline bool is_simple (void) const { return !(u.header.coverage & (u.header.CrossStream | u.header.Variation)); } @@ -488,21 +489,24 @@ struct KernSubTable inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const { -switch (u.header.format) { +switch (get_type ()) { /* This method hooks up to hb_font_t's get_h_kerning. Only support Format0. */ case 0: return u.format0.get_kerning (left, right); default:return 0; } } - inline void apply (AAT::hb_aat_apply_context_t *c) const + template + inline typename context_t::return_t dispatch (context_t *c) const { -switch (u.header.format) { -case 0: u.format0.apply (c); return; -case 1: u.format1.apply (c); return; -case 2: u.format2.apply (c); return; -case 3: u.format3.apply (c); return; -default:return; +unsigned int subtable_type = get_type (); +TRACE_DISPATCH (this, subtable_type); +switch (subtable_type) { +case 0:return_trace (c->dispatch (u.format0)); +case 1:return_trace (c->dispatch (u.format1)); +case 2:return_trace (c->dispatch (u.format2)); +case 3:return_trace (c->dispatch (u.format3)); +default: return_trace (c->default_return_value ()); } } @@ -512,13 +516,8 @@ struct KernSubTable if (unlikely (!u.header.sanitize (c) || u.header.length < u.header.min_size || !c->check_range (this, u.header.length))) return_trace (false); -switch (u.header.format) { -case 0: return_trace (u.format0.sanitize (c)); -case 1: return_trace (u.format1.sanitize (c)); -case 2: return_trace (u.format2.sanitize (c)); -case 3: return_trace (u.format3.sanitize (c)); -default:return_trace (true); -} + +return_trace (dispatch (c)); } protected: @@ -591,7 +590,7 @@ struct KernTable c->sanitizer.set_object (*st); - st->apply (c); + st->dispatch (c); (void) c->buffer->message (c->font, "end kern subtable %d", c->lookup_index); commit 213fa3bf711dae5028e3d041e305cdd35223de77 Author: Behdad Esfahbod Date: Tue Nov 6 12:07:15 2018 -0500 [kern] Refactor to include header in each subtable type diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index e9d7e301..1073530d 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh @@ -155,6 +155,7 @@ struct KernPair DEFINE_SIZE_STATIC (6); }; +template struct KernSubTableFormat0 { inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const @@ -186,11 +187,13 @@ struct KernSubTableFormat0 } protected: - BinSearchArrayOf pairs;/* Array of kerning pairs. */ + KernSubTableHeader header; + BinSearchArrayOf pairs; /* Array of kerning pairs. */ public: - DEFINE_SIZE_ARRAY (8, pairs); + DEFINE_SIZE_ARRAY (KernSubTableHeader::static_size + 8, pairs); }; +template struct KernSubTableFormat1 { typedef void EntryData; @@ -309,10 +312,11 @@ struct KernSubTableFormat1 } protected: + KernSubTableHeader head
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
dev/null |binary src/hb-aat-layout-common.hh | 23 +- src/hb-static.cc |4 + test/fuzzing/fonts/clusterfuzz-testcase-hb-shape-fuzzer-5634395566768128 |binary test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-5718464350650368 |binary test/fuzzing/run-shape-fuzzer-tests.py | 38 -- util/options.cc |2 7 files changed, 59 insertions(+), 8 deletions(-) New commits: commit 9e8a9b846ec24e9124d61706272a0e5fa58d7a24 Author: Behdad Esfahbod Date: Wed Oct 17 21:41:25 2018 -0700 [aat] Another try at fixing Lookup null objects... Ugly as hell, and don't even understand why some bits are needed. But the logic is sound. diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 37f6d03c..741e5020 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -291,10 +291,27 @@ struct Lookup LookupFormat8 format8; } u; public: - DEFINE_SIZE_MIN (0); /* 0 min size, makes sure this cannot be used on null pool, - * because Format0 has unbounded size depending on num_glyphs. - * We cannot define custom null bytes for a template :(. */ + DEFINE_SIZE_UNION (2, format); }; +/* Lookup 0 has unbounded size (dependant on num_glyphs). So we need to defined + * special NULL objects for Lookup<> objects, but since it's template our macros + * don't work. So we have to hand-code them here. UGLY. */ +} /* Close namespace. */ +/* Ugly hand-coded null objects for template Lookup<> :(. */ +extern HB_INTERNAL const unsigned char _hb_Null_AAT_Lookup[2]; +template <> +/*static*/ inline const AAT::Lookup& Null > (void) { + return *reinterpret_cast *> (_hb_Null_AAT_Lookup); +} +template <> +/*static*/ inline const AAT::Lookup& Null > (void) { + return *reinterpret_cast *> (_hb_Null_AAT_Lookup); +} +template <> +/*static*/ inline const AAT::Lookup>& Null> > (void) { + return *reinterpret_cast> *> (_hb_Null_AAT_Lookup); +} +namespace AAT { /* diff --git a/src/hb-static.cc b/src/hb-static.cc index 5112d77b..0b92443e 100644 --- a/src/hb-static.cc +++ b/src/hb-static.cc @@ -41,6 +41,10 @@ hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_ DEFINE_NULL_NAMESPACE_BYTES (OT, Index) = {0xFF,0xFF}; DEFINE_NULL_NAMESPACE_BYTES (OT, LangSys) = {0x00,0x00, 0xFF,0xFF, 0x00,0x00}; DEFINE_NULL_NAMESPACE_BYTES (OT, RangeRecord) = {0x00,0x01, 0x00,0x00, 0x00, 0x00}; +/* Hand-coded because Lookup is a template. + * Not sure why I need the extern "C" :(. + * Sad. */ +extern "C" HB_INTERNAL const unsigned char _hb_Null_AAT_Lookup[2] = {0xFF, 0xFF}; void commit 191eef823fe95355425621f8e002dfe7fe632383 Author: Ebrahim Byagowi Date: Thu Oct 18 08:04:18 2018 +0330 [test] Remove not-fixed yet testcases (#1268) I added them but now that I think, it is a bad idea to have them as fuzzing bots will find good seeds to tweak in order to find easy new testcases which causes duplicated issues. diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4548492505645056 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4548492505645056 deleted file mode 100644 index 065080f3.. Binary files a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-4548492505645056 and /dev/null differ diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6210176798425088 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6210176798425088 deleted file mode 100644 index 1c62961e.. Binary files a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-fuzzer-6210176798425088 and /dev/null differ diff --git a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-573765636608 b/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-573765636608 deleted file mode 100644 index 28e72df7.. Binary files a/test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-shape-fuzzer-573765636608 and /dev/null differ commit 392e1f4ddd7eb649e1a71755b9bcf6431739f98f Author: Ebrahim Byagowi Date: Thu Oct 18 07:42:20 2018 +0330 [test/shape-fuzzer] fail on timeout and ubsan errors (#1267) diff --git a/test/fuzzing/run-shape-fuzzer-tests.py b/test/fuzzing/run-shape-fuzzer-tests.py index 074ecc8e..8fadd167 100755 --- a/test/fuzzing/run-shape-fuzzer-tests.py +++ b/test/fuzzing/run-shape-fuzzer-tests.py @@ -2,7 +2,36 @@ from __future__ import print_function, division, absolute_import -import sys, os, subprocess +import sys, os, subprocess, tempfile, threading + + +def cmd(command): + # https://stackoverflow.com/a/44084
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-aat-layout-kerx-table.hh | 128 +--- src/hb-aat-layout-morx-table.hh |4 - src/hb-ot-shape.cc | 50 --- 3 files changed, 136 insertions(+), 46 deletions(-) New commits: commit 9f450f07b0a1593962e3b45d00f2cf93916f3466 Author: Behdad Esfahbod Date: Wed Oct 10 21:46:58 2018 -0400 [kerx] Make Format1 work Tested using Kannada MN: $ HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0C95,0CCd,C95,CCD [kn_ka.virama=0+1299|kn_ka.vattu=0+115|_blank=0@-115,0+385] $ HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0C95,0CCd,C95,CCD --features=-kern [kn_ka.virama=0+1799|kn_ka.vattu=0+230|_blank=0+0] I don't see the GPOS table in the font do the same. ¯\_(ツ)_/¯ diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh index 552bb065..cc99868d 100644 --- a/src/hb-aat-layout-kerx-table.hh +++ b/src/hb-aat-layout-kerx-table.hh @@ -123,7 +123,7 @@ struct KerxSubTableFormat1 inline driver_context_t (const KerxSubTableFormat1 *table, hb_aat_apply_context_t *c_) : c (c_), - kernAction (table+table->kernAction), + kernAction (&table->machine + table->kernAction), depth (0) {} inline bool is_actionable (StateTableDriver *driver, @@ -159,16 +159,21 @@ struct KerxSubTableFormat1 return false; } -for (; depth; depth--) +for (unsigned int i = 0; i < depth; i++) { - unsigned int idx = stack[depth - 1]; + /* Apparently, when spec says "Each pops one glyph from the kerning stack + * and applies the kerning value to it.", it doesn't mean it in that order. + * The deepest item in the stack corresponds to the first item in the action + * list. Discovered by testing. */ + unsigned int idx = stack[i]; int v = *actions++; /* XXX Non-forward direction... */ if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction)) - buffer->pos[idx].x_advance += v; + buffer->pos[idx].x_advance += c->font->em_scale_x (v); else - buffer->pos[idx].y_advance += v; + buffer->pos[idx].y_advance += c->font->em_scale_y (v); } + depth = 0; } return true; commit 504cb68fc972c7f606bf9fc62015376382f78f45 Author: Behdad Esfahbod Date: Wed Oct 10 21:29:46 2018 -0400 Disable mark advance zeroing as well as mark fallback positioning if doing kerx diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 3b1c93db..e2405237 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -114,7 +114,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t &plan, } plan.has_gpos_mark = !!plan.map.get_1_mask (HB_TAG ('m','a','r','k')); - if (!plan.apply_gpos) + if (!plan.apply_gpos && !plan.apply_kerx) plan.fallback_mark_positioning = true; } @@ -820,34 +820,36 @@ hb_ot_position_complex (const hb_ot_shape_context_t *c) hb_ot_layout_position_start (c->font, c->buffer); - switch (c->plan->shaper->zero_width_marks) - { -case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY: - zero_mark_widths_by_gdef (c->buffer, adjust_offsets_when_zeroing); - break; - -default: -case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE: -case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE: - break; - } + if (!c->plan->apply_kerx) +switch (c->plan->shaper->zero_width_marks) +{ + case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY: + zero_mark_widths_by_gdef (c->buffer, adjust_offsets_when_zeroing); + break; + + default: + case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE: + case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE: + break; +} if (c->plan->apply_gpos) -c->plan->position (c->font, c->buffer); +;//c->plan->position (c->font, c->buffer); else if (c->plan->apply_kerx) hb_aat_layout_position (c->plan, c->font, c->buffer); - switch (c->plan->shaper->zero_width_marks) - { -case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE: - zero_mark_widths_by_gdef (c->buffer, adjust_offsets_when_zeroing); - break; - -default: -case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE: -case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY: - break; - } + if (!c->plan->apply_kerx) +switch (c->plan->shaper->zero_width_marks) +{ + case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE: + zero_mark_widths_by_gdef (c->buffer, adjust_offsets_when_zeroing); + break; + + default: + case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE: + case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY: + break; +} /* Finishing off GPOS has to follow a certain order. */ hb_ot_layout_position_finish_advances (c->font, c->buffer); commit 84967537966a76297c89460d95e7336f1bfc332d Author: Behdad Esfahbod Date: Wed Oct 10 21:18:37 2018 -0400 [kerx] Implement Format1 Untested. diff
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-aat-layout-kerx-table.hh | 169 ++ src/hb-aat-layout-morx-table.hh |4 src/hb-buffer.cc | 16 src/hb-ot-shape.cc | 16 test/shaping/data/text-rendering-tests/Makefile.sources |6 test/shaping/data/text-rendering-tests/fonts/TestMORXForty.ttf |binary test/shaping/data/text-rendering-tests/fonts/TestMORXThirtyeight.ttf |binary test/shaping/data/text-rendering-tests/fonts/TestMORXThirtynine.ttf |binary test/shaping/data/text-rendering-tests/fonts/TestMORXThirtyseven.ttf |binary test/shaping/data/text-rendering-tests/tests/MORX-35.tests |4 test/shaping/data/text-rendering-tests/tests/MORX-37.tests |4 test/shaping/data/text-rendering-tests/tests/MORX-38.tests |4 test/shaping/data/text-rendering-tests/tests/MORX-39.tests |4 test/shaping/data/text-rendering-tests/tests/MORX-40.tests |4 14 files changed, 154 insertions(+), 77 deletions(-) New commits: commit 2a5cb37fdb43230217e055f3d7c770a35cfd5c21 Author: Behdad Esfahbod Date: Sun Oct 7 20:36:46 2018 -0400 Revert "[morx] Fix MORX-35" This reverts commit f62f6e90ad1f1a83f1ad65ee1ffb79470a8a. diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index b9dddb2a..cf08d796 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -661,17 +661,13 @@ struct InsertionSubtable * current glyph, the next glyph processed would in fact be the first * one inserted." * -* So, if DontAdvance *is* set, we move to "end", such that newly -* inserted glyphs are visible. +* This suggests that if DontAdvance is NOT set, we should move to +* end+count. If it *was*, then move to end, such that newly inserted +* glyphs are now visible. * -* If DontAdvance is *not* set, if inserted before, move past them, -* such that original current glyph will be skipped over by the driver. -* Otherwise, again, just move to "end" such that current glyph will -* be skipped over by driver. -* -* https://github.com/harfbuzz/harfbuzz/issues/1224 +* https://github.com/harfbuzz/harfbuzz/issues/1224#issuecomment-427691417 */ - buffer->move_to ((flags & DontAdvance) || !before ? end : end + count); + buffer->move_to ((flags & DontAdvance) ? end : end + count); } if (flags & SetMark) diff --git a/test/shaping/data/text-rendering-tests/DISABLED b/test/shaping/data/text-rendering-tests/DISABLED index 8539c0ee..4e8b1cf2 100644 --- a/test/shaping/data/text-rendering-tests/DISABLED +++ b/test/shaping/data/text-rendering-tests/DISABLED @@ -1,3 +1,6 @@ +# https://github.com/harfbuzz/harfbuzz/issues/1224 +tests/MORX-35.tests + # Non-Unicode cmap tests/CMAP-3.tests diff --git a/test/shaping/data/text-rendering-tests/Makefile.sources b/test/shaping/data/text-rendering-tests/Makefile.sources index c7f48760..5a3d20a6 100644 --- a/test/shaping/data/text-rendering-tests/Makefile.sources +++ b/test/shaping/data/text-rendering-tests/Makefile.sources @@ -55,7 +55,6 @@ TESTS = \ tests/MORX-32.tests \ tests/MORX-33.tests \ tests/MORX-34.tests \ - tests/MORX-35.tests \ tests/MORX-36.tests \ tests/MORX-37.tests \ tests/MORX-38.tests \ @@ -74,6 +73,7 @@ TESTS = \ DISBALED_TESTS = \ tests/CMAP-3.tests \ + tests/MORX-35.tests \ tests/SHARAN-1.tests \ tests/SHBALI-1.tests \ tests/SHBALI-2.tests \ commit 14ebf8af0c04efcae6ca788ac85601bfe462f28d Author: Behdad Esfahbod Date: Sun Oct 7 20:35:06 2018 -0400 [buffer] Improve shift_forward() "Improve" is a strong word in this case though, I understand. diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 0b8593f8..2b7b8864 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -182,7 +182,11 @@ hb_buffer_t::shift_forward (unsigned int count) if (idx + count > len) { /* Under memory failure we might expose this area. At least - * clean it up. Oh well... */ + * clean it up. Oh well... + * + * Ideally, we should at least set Default_Ignorable bits on + * these, as well as consistent cluster values. But the former + * is layering violation... */ memset (info + len, 0, (idx + count - len) * sizeof (info[0])); } len += count; @@ -399,8 +403,14 @@ hb_buffer_t::move_to (unsigned int i) unsigned int count = out_len - i; /* This will blow in our face if memory allocation fails later - * in this same lookup... */ -if (unlikely (idx < count && !shift_forward (count + 32))) return false; + * in this same lookup... + * + * We used to shift with extra 32 ite
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-face.cc |2 src/hb-ot-shape-complex-indic.cc | 259 +- src/hb-ot-shape-complex-thai.cc |3 src/hb-ot-shape-complex.hh | 11 test/shaping/data/in-house/Makefile.sources |1 test/shaping/data/in-house/fonts/03e3f463c3a985bc42096620cc415342818454fb.ttf |binary test/shaping/data/in-house/fonts/1a5face3fcbd929d228235c2f72bbd6f8eb37424.ttf |binary test/shaping/data/in-house/fonts/2c25beb56d9c556622d56b0b5d02b4670c034f89.ttf |binary test/shaping/data/in-house/fonts/604026ae5aaca83c49cd8416909d71ba3e1c1194.ttf |binary test/shaping/data/in-house/fonts/738d9f3b8c2dfd03875bf35a61d28fd78faf17c8.ttf |binary test/shaping/data/in-house/fonts/7d18685e1529e4ceaad5b6095dfab2f9789e5bce.ttf |binary test/shaping/data/in-house/fonts/881642af1667ae30a54e58de8be904566d00508f.ttf |binary test/shaping/data/in-house/fonts/af85624080af5627fb050f570d148a62f04fda74.ttf |binary test/shaping/data/in-house/tests/indic-vowel-letter-spoofing.tests | 53 ++ 14 files changed, 317 insertions(+), 12 deletions(-) New commits: commit df32eaae42b505b00de4a8b5efce9ab948bed847 Author: Behdad Esfahbod Date: Wed Oct 3 14:44:25 2018 +0200 [indic] Disallow vowel mark combinations that spoof other vowel marks Fixes https://github.com/harfbuzz/harfbuzz/issues/1019 New numbers: BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%) DEVANAGARI: 707261 out of 707394 tests passed. 133 failed (0.0188014%) GUJARATI: 366353 out of 366457 tests passed. 104 failed (0.0283799%) GURMUKHI: 60729 out of 60747 tests passed. 18 failed (0.0296311%) KANNADA: 951300 out of 951913 tests passed. 613 failed (0.0643966%) MALAYALAM: 1048136 out of 1048334 tests passed. 198 failed (0.0188871%) ORIYA: 42327 out of 42329 tests passed. 2 failed (0.00472489%) SINHALA: 271596 out of 271847 tests passed. 251 failed (0.0923313%) TAMIL: 1091754 out of 1091754 tests passed. 0 failed (0%) TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%) Devanagari regressed because Uniscribe doesn't enforce the full set. Tests added with the *-vowel-letters.txt files in tree and Noto fonts. diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index c230be8b..d169b2b3 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -331,6 +331,260 @@ data_destroy_indic (void *data) free (data); } +static void +preprocess_text_indic (const hb_ot_shape_plan_t *plan, + hb_buffer_t *buffer, + hb_font_t*font) +{ + /* UGLY UGLY UGLY business of adding dotted-circle in the middle of + * vowel-sequences that look like another vowel. Data for each script + * collected from Unicode 11 book, tables named "Vowel Letters" with + * "Use" and "Do Not Use" columns. + * + * https://github.com/harfbuzz/harfbuzz/issues/1019 + */ + bool processed = false; + buffer->clear_output (); + unsigned int count = buffer->len; + switch ((unsigned) buffer->props.script) + { +case HB_SCRIPT_DEVANAGARI: + for (buffer->idx = 0; buffer->idx + 1 < count && buffer->successful;) + { + bool matched = false; + switch (buffer->cur().codepoint) + { + case 0x0905u: + switch (buffer->cur(1).codepoint) + { + case 0x093Au: case 0x093Bu: case 0x093Eu: case 0x0945u: + case 0x0946u: case 0x0949u: case 0x094Au: case 0x094Bu: + case 0x094Cu: case 0x094Fu: case 0x0956u: case 0x0957u: + matched = true; + break; + } + break; + case 0x0906u: + switch (buffer->cur(1).codepoint) + { + case 0x093Au: case 0x0945u: case 0x0946u: case 0x0947u: + case 0x0948u: + matched = true; + break; + } + break; + case 0x0909u: + switch (buffer->cur(1).codepoint) + { + case 0x0941u: + matched = true; + break; + } + break; + case 0x090Fu: + switch (buffer->cur(1).codepoint) + { + case 0x0945u: case 0x0946u: case 0x0947u: + matched = true; + break; + } + break; + case 0x0930u: + if (0x094Du == buffer->cur(1).codepoint && + buffer->idx + 2 < count && + 0x0907u == buffer->cur(2).codepoint) + { + buffer->next_glyph (); + buffer->next_glyph (); + buffer->output_glyph (0x25CCu); + } + break; +
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
.circleci/config.yml| 11 ++- src/hb-atomic.hh| 21 ++--- src/hb-ft.cc|8 test/api/Makefile.am|8 +--- test/api/test-multithread.c | 27 ++- 5 files changed, 51 insertions(+), 24 deletions(-) New commits: commit 7f30629cddcf0196d7b754df0cb2d4a8e5fed4b6 Author: Behdad Esfahbod Date: Wed Sep 26 16:40:23 2018 -0400 [ft] Make TSan happy diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 3aed7188..50182f1b 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -70,7 +70,7 @@ struct hb_ft_font_t bool symbol; /* Whether selected cmap is symbol cmap. */ bool unref; /* Whether to destroy ft_face when done. */ - mutable int cached_x_scale; + mutable hb_atomic_int_t cached_x_scale; mutable hb_advance_cache_t advance_cache; }; @@ -88,7 +88,7 @@ _hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref) ft_font->load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING; - ft_font->cached_x_scale = 0; + ft_font->cached_x_scale.set (0); ft_font->advance_cache.init (); return ft_font; @@ -250,10 +250,10 @@ hb_ft_get_glyph_h_advances (hb_font_t* font, void* font_data, int load_flags = ft_font->load_flags; int mult = font->x_scale < 0 ? -1 : +1; - if (font->x_scale != ft_font->cached_x_scale) + if (font->x_scale != ft_font->cached_x_scale.get ()) { ft_font->advance_cache.clear (); -ft_font->cached_x_scale = font->x_scale; +ft_font->cached_x_scale.set (font->x_scale); } for (unsigned int i = 0; i < count; i++) commit ec743fce2a72a1cb76ac9401747a442a03a051d9 Author: Behdad Esfahbod Date: Wed Sep 26 16:37:18 2018 -0400 Add more atomic intrinsics diff --git a/src/hb-atomic.hh b/src/hb-atomic.hh index 6e3672c1..8bc94039 100644 --- a/src/hb-atomic.hh +++ b/src/hb-atomic.hh @@ -49,17 +49,21 @@ /* Defined externally, i.e. in config.h. */ -#elif !defined(HB_NO_MT) && defined(__ATOMIC_CONSUME) +#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE) /* C++11-style GCC primitives. */ +#define _hb_memory_barrier() __sync_synchronize () + #define hb_atomic_int_impl_add(AI, V) __atomic_fetch_add ((AI), (V), __ATOMIC_ACQ_REL) #define hb_atomic_int_impl_set_relaxed(AI, V) __atomic_store_n ((AI), (V), __ATOMIC_RELAXED) +#define hb_atomic_int_impl_set(AI, V) __atomic_store_n ((AI), (V), __ATOMIC_RELEASE) #define hb_atomic_int_impl_get_relaxed(AI) __atomic_load_n ((AI), __ATOMIC_RELAXED) +#define hb_atomic_int_impl_get(AI) __atomic_load_n ((AI), __ATOMIC_ACQUIRE) #define hb_atomic_ptr_impl_set_relaxed(P, V) __atomic_store_n ((P), (V), __ATOMIC_RELAXED) #define hb_atomic_ptr_impl_get_relaxed(P) __atomic_load_n ((P), __ATOMIC_RELAXED) -#define hb_atomic_ptr_impl_get(P) __atomic_load_n ((P), __ATOMIC_CONSUME) +#define hb_atomic_ptr_impl_get(P) __atomic_load_n ((P), __ATOMIC_ACQUIRE) static inline bool _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) { @@ -74,13 +78,19 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) #include +#define _hb_memory_barrier() std::atomic_thread_fence(std::memory_order_ack_rel) +#define _hb_memory_r_barrier() std::atomic_thread_fence(std::memory_order_acquire) +#define _hb_memory_w_barrier() std::atomic_thread_fence(std::memory_order_release) + #define hb_atomic_int_impl_add(AI, V) (reinterpret_cast *> (AI)->fetch_add ((V), std::memory_order_acq_rel)) #define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast *> (AI)->store ((V), std::memory_order_relaxed)) +#define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast *> (AI)->store ((V), std::memory_order_release)) #define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast *> (AI)->load (std::memory_order_relaxed)) +#define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast *> (AI)->load (std::memory_order_acquire)) #define hb_atomic_ptr_impl_set_relaxed(P, V) (reinterpret_cast *> (P)->store ((V), std::memory_order_relaxed)) #define hb_atomic_ptr_impl_get_relaxed(P) (reinterpret_cast *> (P)->load (std::memory_order_relaxed)) -#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load (std::memory_order_consume)) +#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load (std::memory_order_acquire)) static inline bool _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) { @@ -243,6 +253,9 @@ static_assert ((sizeof (long) == sizeof (void *)), ""); #ifndef hb_atomic_ptr_impl_get_relaxed #define hb_atomic_ptr_impl_get_relaxed(P) (*(P)) #endif +#ifndef hb_atomic_int_impl_get +inline int hb_atomic_int_impl_get (int *AI){ int v = *AI; _hb_memory_r_barrier (); return v; } +#endif #ifndef hb_atomic_ptr_impl_get inline void *
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-face.cc |1 - src/hb-graphite2.cc |2 +- src/hb-machinery-private.hh |8 +++- src/hb-ot-layout-private.hh | 15 +++ src/hb-uniscribe.cc |8 5 files changed, 19 insertions(+), 15 deletions(-) New commits: commit d4d1bf8177b127caa57b146c932f553dca1ad933 Author: Behdad Esfahbod Date: Thu Aug 2 02:04:02 2018 -0700 Fix for recent rename diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index da7944b8..2ba905d6 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -106,7 +106,7 @@ _hb_graphite2_shaper_face_data_create (hb_face_t *face) } hb_blob_destroy (silf_blob); - hb_graphite2_face_data_t *data = (hb_graphite2_face_data_t *) calloc (1, sizeof (hb_graphite2_shaper_face_data_t)); + hb_graphite2_face_data_t *data = (hb_graphite2_face_data_t *) calloc (1, sizeof (hb_graphite2_face_data_t)); if (unlikely (!data)) return nullptr; diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index 6d579534..94e6bb55 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -442,7 +442,7 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name) hb_uniscribe_face_data_t * _hb_uniscribe_shaper_face_data_create (hb_face_t *face) { - hb_uniscribe_face_data_t *data = (hb_uniscribe_face_data_t *) calloc (1, sizeof (hb_uniscribe_shaper_face_data_t)); + hb_uniscribe_face_data_t *data = (hb_uniscribe_face_data_t *) calloc (1, sizeof (hb_uniscribe_face_data_t)); if (unlikely (!data)) return nullptr; @@ -520,7 +520,7 @@ _hb_uniscribe_shaper_font_data_create (hb_font_t *font) { if (unlikely (!hb_uniscribe_shaper_face_data_ensure (font->face))) return nullptr; - hb_uniscribe_font_data_t *data = (hb_uniscribe_font_data_t *) calloc (1, sizeof (hb_uniscribe_shaper_font_data_t)); + hb_uniscribe_font_data_t *data = (hb_uniscribe_font_data_t *) calloc (1, sizeof (hb_uniscribe_font_data_t)); if (unlikely (!data)) return nullptr; commit 91126aa11a5fa2bff72137df4768ad13fc9b7803 Author: Behdad Esfahbod Date: Thu Aug 2 02:03:13 2018 -0700 [uniscribe] Update for recent changes diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index 7f7f10d0..6d579534 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -383,7 +383,7 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name) memcpy(new_sfnt_data, orig_sfnt_data, length); - OT::name &name = OT::StructAtOffset (new_sfnt_data, name_table_offset); + OT::name &name = StructAtOffset (new_sfnt_data, name_table_offset); name.format.set (0); name.count.set (ARRAY_LENGTH (name_IDs)); name.stringOffset.set (name.get_size ()); @@ -399,7 +399,7 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name) } /* Copy string data from new_name, converting wchar_t to UTF16BE. */ - unsigned char *p = &OT::StructAfter (name); + unsigned char *p = &StructAfter (name); for (unsigned int i = 0; i < name_str_len; i++) { *p++ = new_name[i] >> 8; commit 66952ec47b5f09d88b83fb6a71b1cdb26c53668d Author: Behdad Esfahbod Date: Thu Aug 2 01:44:20 2018 -0700 Remove unused table reference diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index fc2e57e7..c8855723 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -179,11 +179,10 @@ struct hb_ot_layout_t /* TODO Move the following out of this struct. */ hb_face_t *face; /* MUST be before the lazy loaders. */ - hb_table_lazy_loader_t<1, struct OT::BASE> base; - hb_table_lazy_loader_t<2, struct OT::MATH> math; - hb_table_lazy_loader_t<3, struct OT::fvar> fvar; - hb_table_lazy_loader_t<4, struct OT::avar> avar; - hb_table_lazy_loader_t<5, struct AAT::morx> morx; + hb_table_lazy_loader_t<1, struct OT::MATH> math; + hb_table_lazy_loader_t<2, struct OT::fvar> fvar; + hb_table_lazy_loader_t<3, struct OT::avar> avar; + hb_table_lazy_loader_t<4, struct AAT::morx> morx; }; commit 443de26fa56dd1ef149d3ce4206f4495eceec2eb Author: Behdad Esfahbod Date: Thu Aug 2 01:41:19 2018 -0700 Minor diff --git a/src/hb-face.cc b/src/hb-face.cc index 75dc486e..9d17c4a5 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -33,7 +33,6 @@ #include "hb-open-file-private.hh" - /** * hb_face_count: Get number of faces on the blob * @blob: diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index 3a99937c..fc2e57e7 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -171,6 +171,12 @@ struct hb_ot_layout_t const struct OT::GSUB *gsub; const struct OT::GPOS *gpos; + unsigned int gsub_lookup_count; + unsigned int gpos_lookup_count; + + hb_ot_layout_lookup_accelerator_t *gsub_accels; + hb_ot_layout_lookup_accelerator_t *gpos_accels; + /* TODO Move the following out of this struct. */ hb_face_t *face; /* MUST be before the lazy loaders. */ hb_table_lazy_loader_t<1, struct OT::BASE> base; @@ -178,12 +184,6 @@ struct hb_ot_layout_t hb_table_la
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
docs/harfbuzz-sections.txt |1 src/hb-atomic-private.hh | 34 + src/hb-ot-cmap-table.hh |9 src/hb-ot-layout-common-private.hh |7 src/hb-ot-layout.cc | 186 -- src/hb-ot-layout.h |7 test/api/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5542653037903872 |binary test/api/fonts/clusterfuzz-testcase-minimized-hb-subset-get-codepoints-fuzzer-5973295416475648 |binary 8 files changed, 137 insertions(+), 107 deletions(-) New commits: commit 3dd1b88765f6ce91bd0558a16cdd8cf0c1e15d1b Author: Behdad Esfahbod Date: Tue Jul 31 19:33:37 2018 -0700 [atomic] Use CONSUME, not ACQUIRE, memory-order for get() Although, all implementations just elevate that to ACQUIRE. But requirement for us is just CONSUME. diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index 02cf6f38..e6a3a9a9 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -46,14 +46,14 @@ /* Defined externally, i.e. in config.h; must have typedef'ed hb_atomic_int_impl_t as well. */ -#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE) +#elif !defined(HB_NO_MT) && defined(__ATOMIC_CONSUME) /* C++11-style GCC primitives. */ typedef int hb_atomic_int_impl_t; #define hb_atomic_int_impl_add(AI, V) __atomic_fetch_add (&(AI), (V), __ATOMIC_ACQ_REL) -#define hb_atomic_ptr_impl_get(P) __atomic_load_n ((P), __ATOMIC_ACQUIRE) +#define hb_atomic_ptr_impl_get(P) __atomic_load_n ((P), __ATOMIC_CONSUME) static inline bool _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) { @@ -71,7 +71,7 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) typedef int hb_atomic_int_impl_t; #define hb_atomic_int_impl_add(AI, V) (reinterpret_cast *> (&AI)->fetch_add ((V), std::memory_order_acq_rel)) -#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load (std::memory_order_acquire)) +#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load (std::memory_order_consume)) static inline bool _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) { commit 06b91d935da1a40ef9de6697717eb0af1015989e Author: Behdad Esfahbod Date: Tue Jul 31 19:29:49 2018 -0700 Revert "[atomic] Make pointer get op relaxed instead of acquire" This reverts commit b1e5650c67266dc158f22355fed206cd1c413f70. After lots of head-scratching and finally finding the only truly readable source to be the good old: https://www.kernel.org/doc/Documentation/memory-barriers.txt I've convinced myself that we need consume memory-ordering on get(). The location of memory-barrier in a load should be after, not before the load. That needs fixing. I'll do that separately. diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index c860582d..02cf6f38 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -40,19 +40,20 @@ /* We need external help for these */ #if defined(hb_atomic_int_impl_add) \ + && defined(hb_atomic_ptr_impl_get) \ && defined(hb_atomic_ptr_impl_cmpexch) /* Defined externally, i.e. in config.h; must have typedef'ed hb_atomic_int_impl_t as well. */ -#elif !defined(HB_NO_MT) && defined(__ATOMIC_RELAXED) +#elif !defined(HB_NO_MT) && defined(__ATOMIC_ACQUIRE) /* C++11-style GCC primitives. */ typedef int hb_atomic_int_impl_t; #define hb_atomic_int_impl_add(AI, V) __atomic_fetch_add (&(AI), (V), __ATOMIC_ACQ_REL) -#define hb_atomic_ptr_impl_get(P) __atomic_load_n ((P), __ATOMIC_RELAXED) +#define hb_atomic_ptr_impl_get(P) __atomic_load_n ((P), __ATOMIC_ACQUIRE) static inline bool _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) { @@ -70,7 +71,7 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) typedef int hb_atomic_int_impl_t; #define hb_atomic_int_impl_add(AI, V) (reinterpret_cast *> (&AI)->fetch_add ((V), std::memory_order_acq_rel)) -#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load (std::memory_order_relaxed)) +#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load (std::memory_order_acquire)) static inline bool _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) { @@ -84,9 +85,22 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) #include +/* MinGW has a convoluted h
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
appveyor.yml |3 ++- src/hb-atomic-private.hh | 27 --- src/hb-open-type-private.hh |2 +- src/hb-ot-shape-complex-arabic.cc |2 +- 4 files changed, 28 insertions(+), 6 deletions(-) New commits: commit 804b59cf4901d471253016e0cbf82cc1bbbc1d15 Author: Behdad Esfahbod Date: Mon Jul 16 15:44:58 2018 +0200 Relax C++11 atomic ops memory order to acquire-release diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index f234fe04..14960026 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -53,14 +53,14 @@ #include typedef int hb_atomic_int_impl_t; -#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast *> (&AI)->fetch_add (V)) +#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast *> (&AI)->fetch_add (V, std::memory_order_acq_rel)) -#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load ()) +#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load (std::memory_order_acquire)) static inline bool _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) { const void *O = O_; // Need lvalue - return reinterpret_cast *> (P)->compare_exchange_weak ((O), (N)); + return reinterpret_cast *> (P)->compare_exchange_weak ((O), (N), std::memory_order_acq_rel); } #define hb_atomic_ptr_impl_cmpexch(P,O,N) (_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N))) commit bda242409fc0cbb79a0ff00eba9856c4b0a9c7a1 Author: Behdad Esfahbod Date: Mon Jul 16 15:41:09 2018 +0200 Implement C++11 operations Fixes https://github.com/harfbuzz/harfbuzz/issues/345 diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index 12caacaa..f234fe04 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -46,6 +46,25 @@ /* Defined externally, i.e. in config.h; must have typedef'ed hb_atomic_int_impl_t as well. */ +#elif !defined(HB_NO_MT) && __cplusplus >= 201103L + +/* Prefer C++11 atomics. */ + +#include + +typedef int hb_atomic_int_impl_t; +#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast *> (&AI)->fetch_add (V)) + +#define hb_atomic_ptr_impl_get(P) (reinterpret_cast *> (P)->load ()) +static inline bool +_hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N) +{ + const void *O = O_; // Need lvalue + return reinterpret_cast *> (P)->compare_exchange_weak ((O), (N)); +} +#define hb_atomic_ptr_impl_cmpexch(P,O,N) (_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N))) + + #elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__)) #include @@ -162,16 +181,18 @@ typedef int hb_atomic_int_impl_t; #endif +#ifndef HB_ATOMIC_INT_INIT #define HB_ATOMIC_INT_INIT(V) {V} +#endif struct hb_atomic_int_t { - hb_atomic_int_impl_t v; + mutable hb_atomic_int_impl_t v; inline void set_unsafe (int v_) { v = v_; } inline int get_unsafe (void) const { return v; } - inline int inc (void) { return hb_atomic_int_impl_add (const_cast (v), 1); } - inline int dec (void) { return hb_atomic_int_impl_add (const_cast (v), -1); } + inline int inc (void) { return hb_atomic_int_impl_add (v, 1); } + inline int dec (void) { return hb_atomic_int_impl_add (v, -1); } }; diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 207f6e0e..f6113c33 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -1247,7 +1247,7 @@ struct hb_lazy_loader_t private: hb_face_t *face; - T *instance; + mutable T *instance; }; /* Logic is shared between hb_lazy_loader_t and hb_table_lazy_loader_t */ diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index b1cba1c7..0c4948df 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -250,7 +250,7 @@ struct arabic_shape_plan_t * mask_array[NONE] == 0. */ hb_mask_t mask_array[ARABIC_NUM_FEATURES + 1]; - arabic_fallback_plan_t *fallback_plan; + mutable arabic_fallback_plan_t *fallback_plan; unsigned int do_fallback : 1; unsigned int has_stch : 1; commit 524411224054b23bab4adad7343314df45c9c183 Merge: 2aae617a 269eb456 Author: Cosimo Lupo Date: Mon Jul 16 14:42:43 2018 +0200 Merge pull request #1094 from anthrotype/fix-appveyor-msys2 appveyor.yml: try updating msys2 to fix failing mingw-w64-x86_64 build commit 269eb45650be66901627da7f1014339065a948a5 Author: Cosimo Lupo Date: Mon Jul 16 14:14:42 2018 +0200 appveyor.yml: try only updating msys2 core, not the rest of the packages maybe it'll get a bit faster diff --git a/appveyor.yml b/appveyor.yml index 9b00d84d..6250a91e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -30,7 +30,6 @@ environment: install: - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman -Syu --noconfirm"' - - 'if "%compiler%"=="msys2" C:\msys64
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
.circleci/config.yml|4 - src/dump-emoji.cc |1 src/dump-fon.cc |1 src/hb-coretext.cc |3 src/hb-open-type-private.hh | 11 ++ src/hb-ot-layout.cc |1 src/hb-ot-post-table.hh |3 src/hb-private.hh | 167 +--- src/hb-subset-plan.cc | 12 +-- src/hb-subset.cc|1 src/hb-uniscribe.cc |8 -- src/main.cc |1 12 files changed, 139 insertions(+), 74 deletions(-) New commits: commit 31c4236d9643063e518289b28c3e17cedd8401e0 Author: Behdad Esfahbod Date: Thu May 24 13:38:46 2018 -0700 Underflow protection in hb_vector_t diff --git a/src/hb-private.hh b/src/hb-private.hh index 45f69904..0d1cc0ef 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -685,8 +685,9 @@ struct hb_vector_t return true; } - inline bool resize (unsigned int size) + inline bool resize (int size_) { +unsigned int size = size_ < 0 ? 0u : (unsigned int) size_; if (!alloc (size)) return false; @@ -696,6 +697,7 @@ struct hb_vector_t inline void pop (void) { +if (!len) return; len--; } @@ -709,10 +711,11 @@ struct hb_vector_t len--; } - inline void shrink (unsigned int l) + inline void shrink (int size_) { - if (l < len) - len = l; +unsigned int size = size_ < 0 ? 0u : (unsigned int) size_; + if (size < len) + len = size; } template commit f83e992c8b27111ab802fd7e5678592a0c717518 Author: Behdad Esfahbod Date: Thu May 24 11:46:57 2018 -0700 Mark CrapPool thread_local Not sure if I like to keep it. For now, aim for correctness. diff --git a/src/dump-emoji.cc b/src/dump-emoji.cc index 50a929be..280c5c9b 100644 --- a/src/dump-emoji.cc +++ b/src/dump-emoji.cc @@ -48,7 +48,7 @@ #ifndef HB_NO_VISIBILITY const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; -void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; +thread_local void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; #endif void cbdt_callback (const uint8_t* data, unsigned int length, diff --git a/src/dump-fon.cc b/src/dump-fon.cc index 827de4a3..748de1ab 100644 --- a/src/dump-fon.cc +++ b/src/dump-fon.cc @@ -28,7 +28,7 @@ #ifndef HB_NO_VISIBILITY const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; -void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; +thread_local void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; #endif template struct LEInt; diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 67049545..7f9b6be8 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -48,7 +48,7 @@ #ifndef HB_NO_VISIBILITY const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; -void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; +thread_local void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; #endif diff --git a/src/hb-private.hh b/src/hb-private.hh index 4318eb97..45f69904 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -90,6 +90,14 @@ extern "C" void hb_free_impl(void *ptr); HB_UNUSED typedef int HB_PASTE(static_assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1] #endif // static_assert +#ifdef __GNUC__ +#if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)) +#define thread_local __thread +#endif +#else +#define thread_local +#endif + #endif // __cplusplus < 201103L #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__) @@ -570,12 +578,16 @@ static_assert (Namespace::Type::min_size + 1 <= sizeof (_Null##Type), "Null pool /* Global writable pool. Enlarge as necessary. */ +/* To be fully correct, CrapPool must be thread_local. However, we do not rely on CrapPool + * for correct operation. It only exist to catch and divert program logic bugs instead of + * causing bad memory access. So, races there are not actually introducing incorrectness + * in the code. So maybe disable? Has ~12kb binary size overhead to have it. */ #ifdef HB_NO_VISIBILITY static #else extern HB_INTERNAL #endif -void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] +thread_local void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] #ifdef HB_NO_VISIBILITY = {} #endif diff --git a/src/hb-subset.cc b/src/hb-subset.cc index ad273d04..e974d0f4 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -46,7 +46,7 @@ #if !defined(HB_NO_VISIBILITY) && !defined(HB_SUBSET_BUILTIN) const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; -void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; +thread_local void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; #endif diff --git a/src/main.cc b/src/main.cc index f32490e7..2fec52f9 100644 --- a/src/main.cc +++ b/src/main.cc @@ -39,7 +39,7 @@ using namespace OT; #ifndef HB_NO_VISIBILITY const void * co
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/dump-emoji.cc | 10 ++--- src/dump-fon.cc| 17 - src/hb-aat-layout.cc | 12 +++ src/hb-blob-private.hh | 11 ++ src/hb-face.cc |9 ++--- src/hb-object-private.hh | 36 - src/hb-open-type-private.hh| 63 + src/hb-ot-cmap-table.hh|6 +-- src/hb-ot-color-cbdt-table.hh |4 +- src/hb-ot-color-sbix-table.hh |2 - src/hb-ot-color-svg-table.hh |2 - src/hb-ot-color.cc |4 +- src/hb-ot-glyf-table.hh|6 +-- src/hb-ot-hmtx-table.hh|8 ++-- src/hb-ot-kern-table.hh|2 - src/hb-ot-layout-common-private.hh | 13 +-- src/hb-ot-layout.cc| 28 src/hb-ot-math.cc |4 +- src/hb-ot-post-table.hh| 18 +- src/hb-ot-var.cc |6 +-- src/hb-private.hh | 43 + src/hb-string-array.hh |6 +-- src/hb-subset.cc |6 +-- src/main.cc|4 +- 24 files changed, 172 insertions(+), 148 deletions(-) New commits: commit eba1c16a604d1be774f22541bf3e417f27a27c68 Author: Behdad Esfahbod Date: Tue May 8 02:47:42 2018 -0700 Always lock blob in sanitize. Remove blob->lock_as() in favor of blob->lock() diff --git a/src/dump-emoji.cc b/src/dump-emoji.cc index 47c6c98b..63af4a6a 100644 --- a/src/dump-emoji.cc +++ b/src/dump-emoji.cc @@ -240,11 +240,11 @@ int main (int argc, char **argv) OT::Sanitizer sanitizerCOLR; hb_blob_t* colr_blob = sanitizerCOLR.sanitize (face->reference_table (HB_OT_TAG_COLR)); - const OT::COLR *colr = colr_blob->lock_as (); + const OT::COLR *colr = colr_blob->as (); OT::Sanitizer sanitizerCPAL; hb_blob_t* cpal_blob = sanitizerCPAL.sanitize (face->reference_table (HB_OT_TAG_CPAL)); - const OT::CPAL *cpal = cpal_blob->lock_as (); + const OT::CPAL *cpal = cpal_blob->as (); cairo_font_face_t *cairo_face; { diff --git a/src/dump-fon.cc b/src/dump-fon.cc index dc45d9c4..81525f42 100644 --- a/src/dump-fon.cc +++ b/src/dump-fon.cc @@ -542,7 +542,7 @@ int main (int argc, char** argv) { OT::Sanitizer sanitizer; hb_blob_t *font_blob = sanitizer.sanitize (blob); - const LE_IMAGE_DOS_HEADER* dos_header = font_blob->lock_as (); + const LE_IMAGE_DOS_HEADER* dos_header = font_blob->as (); const NE_RESOURCE_TABLE &rtable = dos_header->get_os2_header ().get_resource_table (); int shift = rtable.get_shift_value (); diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index e6efaab4..7784fae3 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -118,11 +118,11 @@ _get_trak (hb_face_t *face, hb_blob_t **blob = nullptr) // OT::Sanitizer sanitizer; // sanitizer.set_num_glyphs (face->get_num_glyphs ()); // hb_blob_t *morx_blob = sanitizer.sanitize (face->reference_table (HB_AAT_TAG_morx)); -// morx_blob->lock_as (); +// morx_blob->as (); // if (0) // { -// morx_blob->lock_as > ()->get_value (1, face->get_num_glyphs ()); +// morx_blob->as > ()->get_value (1, face->get_num_glyphs ()); // } // } diff --git a/src/hb-blob-private.hh b/src/hb-blob-private.hh index f564351a..b72fa721 100644 --- a/src/hb-blob-private.hh +++ b/src/hb-blob-private.hh @@ -69,12 +69,6 @@ struct hb_blob_t { return unlikely (!data) ? &Null(Type) : reinterpret_cast (data); } - template - inline const Type* lock_as (void) - { -lock (); -return unlikely (!data) ? &Null(Type) : reinterpret_cast (data); - } public: hb_object_header_t header; diff --git a/src/hb-face.cc b/src/hb-face.cc index 9fc40d48..01271413 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -135,7 +135,7 @@ _hb_face_for_data_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void if (tag == HB_TAG_NONE) return hb_blob_reference (data->blob); - const OT::OpenTypeFontFile &ot_file = *data->blob->lock_as (); + const OT::OpenTypeFontFile &ot_file = *data->blob->as (); const OT::OpenTypeFontFace &ot_face = ot_file.get_face (data->index); const OT::OpenTypeTable &table = ot_face.get_table_by_tag (tag); @@ -426,7 +426,7 @@ void hb_face_t::load_upem (void) const { hb_blob_t *head_blob = OT::Sanitizer().sanitize (reference_table (HB_OT_TAG_head)); - const OT::head *head_table = head_blob->lock_as (); + const OT::head *head_table = head_blob->as (); upem = head_table->get_upem (); hb_blob_destroy (head_blob); } @@ -470,7 +470,7 @@ void hb_face_t::load_num_glyphs (void) const { hb_blob_t *maxp_blob = OT::Sanitizer().sanitize (reference_table (HB_OT_TAG_maxp)); - const OT::maxp *maxp_table = maxp_blob->lock_as (); + const OT::maxp *maxp_table = maxp_blob->as (); num_glyphs = maxp_table->get_num_glyphs (); hb_blob_destr
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
CMakeLists.txt | 16 - src/Makefile.sources |1 src/hb-aat-layout-common-private.hh |2 src/hb-aat-layout.cc |6 src/hb-blob.cc | 101 +++--- src/hb-buffer.cc |4 src/hb-common.cc |6 src/hb-ot-layout-private.hh |6 src/hb-ot-layout.cc | 29 -- src/hb-ot-map.cc |3 src/hb-ot-shape.cc |7 test/api/test-common.c |1 test/shaping/data/in-house/Makefile.sources |1 test/shaping/data/in-house/fonts/73e84dac2fc6a2d1bc9250d1414353661088937d.ttf |binary test/shaping/data/in-house/tests/none-directional.tests |3 15 files changed, 83 insertions(+), 103 deletions(-) New commits: commit f673cfbd64d0c9d97123500a7b851b9cfc09deb3 Author: Behdad Esfahbod Date: Mon May 7 13:58:32 2018 -0700 Support scripts that are written both LTR and RTL Right now only Old Italic is marked as such. Fixes https://github.com/harfbuzz/harfbuzz/issues/1000 diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index dc0639f4..f7a0495b 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -687,6 +687,8 @@ hb_buffer_t::guess_segment_properties (void) /* If direction is set to INVALID, guess from script */ if (props.direction == HB_DIRECTION_INVALID) { props.direction = hb_script_get_horizontal_direction (props.script); +if (props.direction == HB_DIRECTION_INVALID) + props.direction = HB_DIRECTION_LTR; } /* If language is not set, use default language from locale */ @@ -1489,6 +1491,8 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer) * Next, if buffer direction is not set (ie. is %HB_DIRECTION_INVALID), * it will be set to the natural horizontal direction of the * buffer script as returned by hb_script_get_horizontal_direction(). + * If hb_script_get_horizontal_direction() returns %HB_DIRECTION_INVALID, + * then %HB_DIRECTION_LTR is used. * * Finally, if buffer language is not set (ie. is %HB_LANGUAGE_INVALID), * it will be set to the process's default language as returned by diff --git a/src/hb-common.cc b/src/hb-common.cc index f38ebb04..956855c4 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -536,6 +536,12 @@ hb_script_get_horizontal_direction (hb_script_t script) case HB_SCRIPT_ADLAM: return HB_DIRECTION_RTL; + + +/* https://github.com/harfbuzz/harfbuzz/issues/1000 */ +case HB_SCRIPT_OLD_ITALIC: + + return HB_DIRECTION_INVALID; } return HB_DIRECTION_LTR; diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index dd10e346..5dc57842 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -306,13 +306,16 @@ static void hb_ensure_native_direction (hb_buffer_t *buffer) { hb_direction_t direction = buffer->props.direction; + hb_direction_t horiz_dir = hb_script_get_horizontal_direction (buffer->props.script); /* TODO vertical: * The only BTT vertical script is Ogham, but it's not clear to me whether OpenType * Ogham fonts are supposed to be implemented BTT or not. Need to research that * first. */ - if ((HB_DIRECTION_IS_HORIZONTAL (direction) && direction != hb_script_get_horizontal_direction (buffer->props.script)) || - (HB_DIRECTION_IS_VERTICAL (direction) && direction != HB_DIRECTION_TTB)) + if ((HB_DIRECTION_IS_HORIZONTAL (direction) && + direction != horiz_dir && horiz_dir != HB_DIRECTION_INVALID) || + (HB_DIRECTION_IS_VERTICAL (direction) && + direction != HB_DIRECTION_TTB)) { /* Same loop as hb_form_clusters(). * Since form_clusters() merged clusters already, we don't merge. */ diff --git a/test/api/test-common.c b/test/api/test-common.c index 74b50be9..f6f0d485 100644 --- a/test/api/test-common.c +++ b/test/api/test-common.c @@ -173,6 +173,7 @@ test_types_script (void) g_assert_cmpint (hb_script_get_horizontal_direction (HB_SCRIPT_LATIN), ==, HB_DIRECTION_LTR); g_assert_cmpint (hb_script_get_horizontal_direction (HB_SCRIPT_ARABIC), ==, HB_DIRECTION_RTL); + g_assert_cmpint (hb_script_get_horizontal_direction (HB_SCRIPT_OLD_ITALIC), ==, HB_DIRECTION_INVALID); g_assert_cmpint (hb_script_get_horizontal_direction (hb_script_from_iso15924_tag (wWyZ)), ==, HB_DIRECTION_LTR); } diff --git a/test/shaping/data/in-house/Makefile.sources b/
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-common.cc|8 src/hb-coretext.cc |8 src/hb-mutex-private.hh |2 +- src/hb-object-private.hh| 15 ++- src/hb-ot-cmap-table.hh |8 src/hb-ot-hmtx-table.hh |2 +- src/hb-ot-layout-private.hh |4 ++-- src/hb-ot-layout.cc |2 +- src/hb-ot-map-private.hh| 24 src/hb-ot-os2-table.hh |4 ++-- src/hb-ot-post-table.hh |4 ++-- src/hb-ot-shape-private.hh |4 ++-- src/hb-ot-shape.cc |2 +- src/hb-private.hh | 29 + src/hb-set-private.hh | 34 -- src/hb-set.cc |3 ++- src/hb-subset-glyf.cc | 18 +- src/hb-subset-plan.cc | 16 src/hb-subset-plan.hh |6 +++--- src/hb-subset.cc|4 ++-- src/hb-uniscribe.cc | 12 ++-- 21 files changed, 121 insertions(+), 88 deletions(-) New commits: commit 37b95612d4ae8a9d75a1a5a5165bc073c709cf30 Author: Behdad Esfahbod Date: Tue May 1 19:09:00 2018 -0400 Remove hb_auto_array_t Part of https://github.com/harfbuzz/harfbuzz/issues/1017 diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index bb9b5ca2..837b3fb7 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -641,8 +641,8 @@ _hb_coretext_shape (hb_shape_plan_t*shape_plan, buffer->merge_clusters (i - 1, i + 1); } - hb_auto_array_t feature_records; - hb_auto_array_t range_records; + hb_auto_t > feature_records; + hb_auto_t > range_records; /* * Set up features. @@ -651,7 +651,7 @@ _hb_coretext_shape (hb_shape_plan_t*shape_plan, if (num_features) { /* Sort features by start/end events. */ -hb_auto_array_t feature_events; +hb_auto_t > feature_events; for (unsigned int i = 0; i < num_features; i++) { const feature_mapping_t * mapping = (const feature_mapping_t *) bsearch (&features[i].tag, @@ -700,7 +700,7 @@ _hb_coretext_shape (hb_shape_plan_t*shape_plan, } /* Scan events and save features for each range. */ -hb_auto_array_t active_features; +hb_auto_t > active_features; unsigned int last_index = 0; for (unsigned int i = 0; i < feature_events.len; i++) { diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 0c313a7c..9155b7c0 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -623,7 +623,7 @@ struct cmap inline bool subset (hb_subset_plan_t *plan) const { -hb_auto_array_t groups; +hb_auto_t > groups; if (unlikely (!populate_groups (plan, &groups))) return false; diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 9e6f858c..42d29aa1 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1109,7 +1109,7 @@ struct hb_get_subtables_context_t : hb_apply_func_t apply_func; }; - typedef hb_auto_array_t array_t; + typedef hb_auto_t > array_t; /* Dispatch interface. */ inline const char *get_name (void) { return "GET_SUBTABLES"; } diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index c28e6085..0c11765c 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -130,7 +130,7 @@ _populate_gids_to_retain (hb_face_t *face, cmap.init (face); glyf.init (face); - hb_auto_array_t bad_indices; + hb_auto_t > bad_indices; old_gids.alloc (codepoints.len); for (unsigned int i = 0; i < codepoints.len; i++) diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index b4717a3d..bc6667c3 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -630,12 +630,12 @@ _hb_uniscribe_shape (hb_shape_plan_t*shape_plan, /* * Set up features. */ - hb_auto_array_t feature_records; - hb_auto_array_t range_records; + hb_auto_t > feature_records; + hb_auto_t > range_records; if (num_features) { /* Sort features by start/end events. */ -hb_auto_array_t feature_events; +hb_auto_t > feature_events; for (unsigned int i = 0; i < num_features; i++) { active_feature_t feature; @@ -676,7 +676,7 @@ _hb_uniscribe_shape (hb_shape_plan_t*shape_plan, } /* Scan events and save features for each range. */ -hb_auto_array_t active_features; +hb_auto_t > active_features; unsigned int last_index = 0; for (unsigned int i = 0; i < feature_events.len; i++) { @@ -858,8 +858,8 @@ retry: #undef MAX_ITEMS OPENTYPE_TAG language_tag = hb_uint32_swap (hb_ot_tag_from_language (buffer->props.language)); - hb_auto_array_t range_properties; - hb_auto_array_t range_char_counts; + hb_auto_t > range_properties; + hb_auto_t > range_char_counts; unsigned int glyphs_offset = 0; unsigned int glyphs_len; commit 5c3112aec8b77d0fe39164f0f700e2a1aa810022 Author: Behdad Esfahbod Date: Tue May 1 19:07:04 2018 -0400 s/hb_prealloced_array_t/hb_vector_t/g Part of
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
Makefile.am |3 README.python.md| 12 - README.wine.md | 40 +++ RELEASING.md| 25 +- src/Makefile.am |2 src/gen-arabic-table.py | 174 +++- src/gen-def.py |2 src/gen-indic-table.py | 135 ++-- src/gen-unicode-ranges.py |8 src/gen-use-table.py| 17 + src/hb-common.cc| 60 +++-- src/hb-ft.cc| 44 ++-- src/hb-glib.cc |7 src/hb-graphite2.cc | 10 src/hb-graphite2.h |4 src/hb-icu.cc |7 src/hb-ot-font.cc |7 src/hb-ot-shape-complex-indic-table.cc |2 src/hb-shape.cc |7 src/hb-shaper.cc|9 src/hb-ucdn.cc |7 src/hb-uniscribe.cc |8 src/sample.py |5 test/fuzzing/run-shape-fuzzer-tests.py |3 test/fuzzing/run-subset-fuzzer-tests.py |3 test/shaping/data/text-rendering-tests/extract-tests.py |3 test/shaping/hb_test_tools.py |7 test/shaping/run-tests.py |3 test/subset/run-tests.py|2 29 files changed, 366 insertions(+), 250 deletions(-) New commits: commit 70d36543aa929320ff82a9ce589786e58adb1836 Author: Ebrahim Byagowi Date: Fri Mar 30 05:00:28 2018 +0430 Make atexit callbacks threadsafe (#930) diff --git a/src/hb-common.cc b/src/hb-common.cc index ce3d01b8..b16c9324 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -60,12 +60,12 @@ _hb_options_init (void) /** * hb_tag_from_string: - * @str: (array length=len) (element-type uint8_t): - * @len: + * @str: (array length=len) (element-type uint8_t): + * @len: * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -90,10 +90,10 @@ hb_tag_from_string (const char *str, int len) /** * hb_tag_to_string: - * @tag: - * @buf: (out caller-allocates) (array fixed-size=4) (element-type uint8_t): + * @tag: + * @buf: (out caller-allocates) (array fixed-size=4) (element-type uint8_t): + * * - * * * Since: 0.9.5 **/ @@ -118,12 +118,12 @@ const char direction_strings[][4] = { /** * hb_direction_from_string: - * @str: (array length=len) (element-type uint8_t): - * @len: + * @str: (array length=len) (element-type uint8_t): + * @len: * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -146,11 +146,11 @@ hb_direction_from_string (const char *str, int len) /** * hb_direction_to_string: - * @direction: + * @direction: * - * * - * Return value: (transfer none): + * + * Return value: (transfer none): * * Since: 0.9.2 **/ @@ -361,7 +361,7 @@ hb_language_to_string (hb_language_t language) /** * hb_language_get_default: * - * + * * * Return value: (transfer none): * @@ -390,7 +390,7 @@ hb_language_get_default (void) * * Converts an ISO 15924 script tag to a corresponding #hb_script_t. * - * Return value: + * Return value: * An #hb_script_t corresponding to the ISO 15924 tag. * * Since: 0.9.2 @@ -439,7 +439,7 @@ hb_script_from_iso15924_tag (hb_tag_t tag) * corresponding #hb_script_t. Shorthand for hb_tag_from_string() then * hb_script_from_iso15924_tag(). * - * Return value: + * Return value: * An #hb_script_t corresponding to the ISO 15924 tag. * * Since: 0.9.2 @@ -469,11 +469,11 @@ hb_script_to_iso15924_tag (hb_script_t script) /** * hb_script_get_horizontal_direction: - * @script: + * @script: + * * - * * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -613,13 +613,13 @@ hb_version_string (void) /** * hb_version_atleast: - * @major: - * @minor: - * @micro: + * @major: + * @minor: + * @micro: * - * * - * Return value: + * + * Return value: * * Since: 0.9.30 **/ @@ -724,8 +724,14 @@ static HB_LOCALE_T C_locale; static void free_C_locale (void) { - if (C_locale) -HB_FREE_LOCALE (C_locale); +retry: + HB_LOCALE_T locale = (HB_LOCALE_T) hb_atomic_ptr_get (&C_locale); + + if (!hb_atomic_ptr_cmpexch (&C_locale, locale, nullptr)) +goto retry; + + if (locale) +HB_FREE_LOCALE (locale); } #endif diff --git a/src/hb-ft.cc b/src/hb-ft.cc index fc4b1122.
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
CMakeLists.txt |2 src/Makefile.am | 18 - src/dump-emoji.cc | 141 ++ src/gen-use-table.py | 105 +++ src/hb-ot-color-cbdt-table.hh | 71 + src/hb-ot-color-sbix-table.hh | 79 +++-- src/hb-ot-color-svg-table.hh | 56 ++- src/hb-ot-hdmx-table.hh |1 src/hb-subset-glyf.cc |6 src/hb-subset.cc |8 src/hb-uniscribe.cc |2 test/api/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5521982557782016 |binary test/api/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-5609911946838016 |binary test/api/fonts/clusterfuzz-testcase-minimized-hb-subset-fuzzer-6651660668502016 |binary test/api/test-subset-hdmx.c | 23 + test/api/test-subset.c | 23 + 16 files changed, 424 insertions(+), 111 deletions(-) New commits: commit b17e1a40885245df690a14c7528939b3881e1fe4 Author: Behdad Esfahbod Date: Wed Mar 28 10:44:52 2018 -0700 [uniscribe] Fix assertion fail in checksum calc Program: Z:\Users\ebrahim\Desktop\harfbuzz\winbuild\util\.libs\hb-shape.exe File: ../../src/hb-open-type-private.hh, Line 769 Expression: 0 == (Length & 3) abnormal program termination diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index cd25769d..f027222d 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -410,7 +410,7 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name) if (face.find_table_index (HB_OT_TAG_name, &index)) { OT::TableRecord &record = const_cast (face.get_table (index)); - record.checkSum.set_for_data (&name, name_table_length); + record.checkSum.set_for_data (&name, new_length); record.offset.set (name_table_offset); record.length.set (name_table_length); } commit a48dd6ef235d569d4b6f6f213ba93a54e142458d Author: Ebrahim Byagowi Date: Wed Mar 28 19:08:19 2018 +0430 Make gen-use-table.py py3 compatible (#932) diff --git a/src/gen-use-table.py b/src/gen-use-table.py index 06817255..ecbdfb95 100755 --- a/src/gen-use-table.py +++ b/src/gen-use-table.py @@ -1,9 +1,10 @@ -#!/usr/bin/python +#!/usr/bin/env python +from __future__ import print_function import sys if len (sys.argv) != 5: - print >>sys.stderr, "usage: ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt" + print ("usage: ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt", file=sys.stderr) sys.exit (1) BLACKLISTED_BLOCKS = ["Thai", "Lao", "Tibetan"] @@ -352,21 +353,21 @@ def map_to_use(data): defaults = ('O', 'No_Block') data = map_to_use(data) -print "/* == Start of generated table == */" -print "/*" -print " * The following table is generated by running:" -print " *" -print " * ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt" -print " *" -print " * on files with these headers:" -print " *" +print ("/* == Start of generated table == */") +print ("/*") +print (" * The following table is generated by running:") +print (" *") +print (" * ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt") +print (" *") +print (" * on files with these headers:") +print (" *") for h in headers: for l in h: - print " * %s" % (l.strip()) -print " */" -print -print '#include "hb-ot-shape-complex-use-private.hh"' -print + print (" * %s" % (l.strip())) +print (" */") +print () +print ('#include "hb-ot-shape-complex-use-private.hh"') +print () total = 0 used = 0 @@ -374,22 +375,22 @@ last_block = None def print_block (block, start, end, data): global total, used, last_block if block and block != last_block: - print - print - print " /* %s */" % block + print () + print () + print (" /* %s */" % block) if start % 16: - print ' ' * (20 + (start % 16 * 6)), + print (' ' * (20 + (start % 16 * 6)), end='') num = 0 assert start % 8 == 0 assert (end+1) % 8 == 0 for u in range (start, end+1): if u % 1
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
.ci/run-coveralls.sh |2 .travis.yml |4 configure.ac |1 m4/ax_code_coverage.m4| 264 ++ src/Makefile.am |6 src/Makefile.sources |4 src/hb-ot-color-colr-table.hh |6 src/hb-ot-color-cpal-table.hh |6 src/hb-ot-color.cc|4 src/hb-ot-layout.cc |4 10 files changed, 284 insertions(+), 17 deletions(-) New commits: commit 00dd321ace75ff0d1824cf75cd41490c5dd6ad76 Author: Ebrahim Byagowi Date: Sat Mar 3 23:26:11 2018 +0330 [ci] Don't run coveralls on freetype folder diff --git a/.travis.yml b/.travis.yml index e14e31a4..9ab686c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,7 @@ matrix: - ./configure $CONFIGURE_OPTS --enable-gtk-doc --enable-code-coverage - make - make check || .ci/fail.sh +- rm -rf freetype-2.9 after_success: - bash .ci/run-coveralls.sh # for coveralls.io code coverage tracking - bash .ci/deploy-docs.sh commit f50aedd371f1a6894d1bf7732f017b51cbdd59bd Author: Ebrahim Byagowi Date: Sat Mar 3 23:17:36 2018 +0330 [ci] Remove failing check on run-coveralls diff --git a/.ci/run-coveralls.sh b/.ci/run-coveralls.sh index 58b83114..59b4c56d 100755 --- a/.ci/run-coveralls.sh +++ b/.ci/run-coveralls.sh @@ -3,8 +3,6 @@ set -x set -o errexit -o nounset -if test "x$TRAVIS_SLUG" != x"harfbuzz/harfbuzz"; then exit; fi - pip install --user nose pip install --user cpp-coveralls export PATH=$HOME/.local/bin:$PATH commit a0031c120e3ac5c059b81a004b9386fab3d662fc Author: Ebrahim Byagowi Date: Sat Mar 3 23:09:25 2018 +0330 Add lcov tool for coverage tests diff --git a/.travis.yml b/.travis.yml index b7f04e5d..e14e31a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,6 +69,7 @@ addons: packages: - pkg-config # for autogen.sh - ragel + - lcov - gtk-doc-tools - libfreetype6-dev # for font function - libglib2.0-dev # for font functions / tests / utils commit ecef95b21264347f9505e3ed4fb25ec7e4ccca5d Author: Ebrahim Byagowi Date: Sat Mar 3 23:03:13 2018 +0330 [ci] Enable code coverage on Travis Linux builds diff --git a/.travis.yml b/.travis.yml index 9fbf6b22..b7f04e5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: - export LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" - ./autogen.sh -- ./configure $CONFIGURE_OPTS --enable-gtk-doc +- ./configure $CONFIGURE_OPTS --enable-gtk-doc --enable-code-coverage - make - make check || .ci/fail.sh after_success: commit f7399796a1ed36cfc4f1ef7631584569baa80981 Author: Ebrahim Byagowi Date: Sat Mar 3 22:55:09 2018 +0330 Enable coverage test on autotools (#857) diff --git a/configure.ac b/configure.ac index eee2568d..694e86bb 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,7 @@ AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([1.13.0 gnits tar-ustar dist-bzip2 no-dist-gzip -Wall no-define color-tests -Wno-portability]) AM_SILENT_RULES([yes]) +AX_CODE_COVERAGE # Initialize libtool m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) diff --git a/m4/ax_code_coverage.m4 b/m4/ax_code_coverage.m4 new file mode 100644 index ..6484f033 --- /dev/null +++ b/m4/ax_code_coverage.m4 @@ -0,0 +1,264 @@ +# === +# https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html +# === +# +# SYNOPSIS +# +# AX_CODE_COVERAGE() +# +# DESCRIPTION +# +# Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS, +# CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included +# in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every +# build target (program or library) which should be built with code +# coverage support. Also defines CODE_COVERAGE_RULES which should be +# substituted in your Makefile; and $enable_code_coverage which can be +# used in subsequent configure output. CODE_COVERAGE_ENABLED is defined +# and substituted, and corresponds to the value of the +# --enable-code-coverage option, which defaults to being disabled. +# +# Test also for gcov program and create GCOV variable that could be +# substituted. +# +# Note that all optimization flags in CFLAGS must be disabled when code +# coverage is enabled. +# +# Usage example: +# +# configure.ac: +# +# AX_CODE_COVERAGE +# +# Makefile.am: +# +# @CODE_COVERAGE_RULES@ +# my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ... +# my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ... +# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ... +# my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ... +# +# This results in a "check-code-coverage" rule being added to any +# Makefile.am which includes "
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/Makefile.am |2 - src/hb-open-file-private.hh | 50 - src/hb-open-type-private.hh | 33 ++- src/hb-ot-map-private.hh| 10 src/hb-private.hh | 20 ++-- src/hb-set-private.hh | 12 - src/hb-subset.cc| 53 ++-- test/api/test-subset.c |9 +-- 8 files changed, 154 insertions(+), 35 deletions(-) New commits: commit 931f8b7eb5e740ce81e5be6bfec60dbe3ac7ebc4 Author: Behdad Esfahbod Date: Wed Feb 7 21:42:03 2018 -0600 Fix another thinko diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index 63172399..c2e1f7de 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -145,7 +145,7 @@ typedef struct OffsetTable rec.checkSum.set_for_data (hb_blob_get_data (blob, nullptr), rec.length); rec.offset.serialize (c, this); void *p = c->allocate_size (rec.length); - if (unlikely (!p)) return false; + if (unlikely (!p)) {return false;} memcpy (p, hb_blob_get_data (blob, nullptr), rec.length); if (rec.length % 4) p = c->allocate_size (4 - rec.length % 4); diff --git a/src/hb-private.hh b/src/hb-private.hh index 118f2924..59d732af 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -383,7 +383,7 @@ _hb_unsigned_int_mul_overflows (unsigned int count, unsigned int size) static inline unsigned int _hb_ceil_to_4 (unsigned int v) { - return ((v - 1) & 3) + 1; + return ((v - 1) | 3) + 1; } commit 39b86695cf56736170c772424c9a8b75bca0254c Author: Behdad Esfahbod Date: Wed Feb 7 21:37:03 2018 -0600 [subset] Fix thinko diff --git a/src/hb-subset.cc b/src/hb-subset.cc index ed4394da..8c1e43f7 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -221,7 +221,7 @@ hb_subset_face_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob) hb_subset_face_data_t *data = (hb_subset_face_data_t *) face->user_data; - hb_subset_face_data_t::table_entry_t *entry = data->tables.lsearch (tag); + hb_subset_face_data_t::table_entry_t *entry = data->tables.push (); if (unlikely (!entry)) return false; commit eeffabc87572193a9e95f22647e80ae44e5a0089 Author: Behdad Esfahbod Date: Wed Feb 7 21:34:05 2018 -0600 Build diff --git a/src/Makefile.am b/src/Makefile.am index 59ca6482..e450ea73 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,7 +14,7 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-introspection #AM_CXXFLAGS = # Convenience targets: -lib: $(BUILT_SOURCES) libharfbuzz.la +lib: $(BUILT_SOURCES) libharfbuzz.la libharfbuzz-subset.la fuzzing: $(BUILT_SOURCES) libharfbuzz-fuzzing.la lib_LTLIBRARIES = libharfbuzz.la commit c479a59988b0cf3e557e22e97e1977962c803fa7 Author: Behdad Esfahbod Date: Wed Feb 7 21:13:10 2018 -0600 [subset] Assemble font diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index 762783f3..63172399 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -56,6 +56,13 @@ typedef struct TableRecord int cmp (Tag t) const { return t.cmp (tag); } + static int cmp (const void *pa, const void *pb) + { +const TableRecord *a = (const TableRecord *) pa; +const TableRecord *b = (const TableRecord *) pb; +return b->cmp (a->tag); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -64,7 +71,7 @@ typedef struct TableRecord Tag tag;/* 4-byte identifier. */ CheckSum checkSum; /* CheckSum for this table. */ - HBUINT32 offset; /* Offset from beginning of TrueType font + Offset32 offset; /* Offset from beginning of TrueType font * file. */ HBUINT32 length; /* Length of this table. */ public: @@ -118,6 +125,35 @@ typedef struct OffsetTable } public: + + inline bool serialize (hb_serialize_context_t *c, +hb_tag_t sfnt_tag, +Supplier &tags, +Supplier &blobs, +unsigned int table_count) + { +TRACE_SERIALIZE (this); +if (unlikely (!c->extend_min (*this))) return_trace (false); +sfnt_version.set (sfnt_tag); +if (unlikely (!tables.serialize (c, table_count))) return_trace (false); +for (unsigned int i = 0; i < table_count; i++) +{ + TableRecord &rec = tables.array[i]; + hb_blob_t *blob = blobs[i]; + rec.tag.set (tags[0]); + rec.length.set (hb_blob_get_length (blob)); + rec.checkSum.set_for_data (hb_blob_get_data (blob, nullptr), rec.length); + rec.offset.serialize (c, this); + void *p = c->allocate_size (rec.length); + if (unlikely (!p)) return false; + memcpy (p, hb_blob_get_data (blob, nullptr), rec.length); + if (rec.length % 4) + p = c->allocate_size (4 - rec.length % 4);
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
CMakeLists.txt | 18 +- configure.ac|2 +- src/hb-aat-layout-common-private.hh |2 +- src/hb-aat-layout-morx-table.hh | 22 -- src/hb-buffer-deserialize-json.rl |4 ++-- src/hb-buffer-deserialize-text.rl |4 ++-- src/hb-private.hh |6 ++ 7 files changed, 33 insertions(+), 25 deletions(-) New commits: commit aed32589af6d5fce3e68fe41865e258ea7eb2413 Author: Behdad Esfahbod Date: Fri Feb 2 16:08:50 2018 -0500 [aat] In ContextualSubtable, mark mark after substituting mark Fixes MORX-21. diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 7a45a24e..ffe4d03a 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -207,13 +207,7 @@ struct ContextualSubtable { hb_buffer_t *buffer = driver->buffer; - if (entry->flags & SetMark) - { - mark = buffer->idx; - last_zero_before_mark = driver->last_zero; - } - - if (entry->data.markIndex != 0x) + if (entry->data.markIndex != 0x && mark < buffer->len) { const Lookup &lookup = subs[entry->data.markIndex]; hb_glyph_info_t *info = buffer->info; @@ -225,7 +219,7 @@ struct ContextualSubtable ret = true; } } - if (entry->data.currentIndex != 0x) + if (entry->data.currentIndex != 0x && buffer->idx < buffer->len) { const Lookup &lookup = subs[entry->data.currentIndex]; hb_glyph_info_t *info = buffer->info; @@ -238,6 +232,12 @@ struct ContextualSubtable } } + if (entry->flags & SetMark) + { + mark = buffer->idx; + last_zero_before_mark = driver->last_zero; + } + return true; } commit fe5f9b1ae318939eaa23d0175a5eb7e1739177ac Author: Behdad Esfahbod Date: Fri Feb 2 15:53:25 2018 -0500 [aat] Fix ContextualSubtable sanitization Fixes MORX-18, MORX-19, and MORX-22. diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index c64dca06..7a45a24e 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -275,8 +275,10 @@ struct ContextualSubtable { const EntryData &data = entries[i].data; - num_lookups = MAX (num_lookups, 1 + data.markIndex); - num_lookups = MAX (num_lookups, 1 + data.currentIndex); + if (data.markIndex != 0x) + num_lookups = MAX (num_lookups, 1 + data.markIndex); + if (data.currentIndex != 0x) + num_lookups = MAX (num_lookups, 1 + data.currentIndex); } return_trace (substitutionTables.sanitize (c, this, num_lookups)); commit cf943f682bcdd73e3ad1f6108c1a1870b991d5e4 Author: Khaled Hosny Date: Sun Feb 4 12:05:12 2018 +0200 Correctly show documentation build status Correctly show if building documentation is enabled or not in configure summary. Fixes https://github.com/harfbuzz/harfbuzz/issues/741 diff --git a/configure.ac b/configure.ac index d799cab0..c2257eec 100644 --- a/configure.ac +++ b/configure.ac @@ -531,7 +531,7 @@ Platform shapers (not normally needed): DirectWrite:${have_directwrite} Other features: - Documentation: ${have_gtk_doc} + Documentation: ${enable_gtk_doc} GObject bindings: ${have_gobject} Introspection: ${have_introspection} ]) commit e8859fca3eafb5aab6d029563b31219ccca0d673 Author: Bruce Mitchener Date: Sun Feb 4 01:26:57 2018 +0700 Enable use of atexit() on macOS and related platforms. The atexit() man page indicates that this is expected to behave in the expected way on unloading of shared libraries. diff --git a/src/hb-private.hh b/src/hb-private.hh index 62c9fb27..eba797cf 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -221,6 +221,12 @@ static int errno = 0; /* Use something better? */ * https://developer.android.com/tools/sdk/ndk/index.html */ #define HB_USE_ATEXIT 1 +# elif defined(__APPLE__) +/* For macOS and related platforms, the atexit man page indicates + * that it will be invoked when the library is unloaded, not only + * at application exit. + */ +#define HB_USE_ATEXIT 1 # endif #endif commit a89573770b4c0f9c444ad6499bec5dc022087a97 Author: Bruce Mitchener Date: Sun Feb 4 01:31:53 2018 +0700 Use nullptr, not NULL. diff --git a/src/hb-aat-layout-common-private.hh b/src/hb-aat-layout-common-private.hh index b5395bba..1ea8318f 100644 --- a/src/hb-aat-layout-common-private.hh +++ b/src/hb-aat-layout-common-private.hh @@ -120,7 +120,7 @@ struct BinSearchArrayOf else return p; } -return NULL; +return nullptr; } private: diff --git a/src/hb-buffer-deserialize-json.rl b/src/hb-buffer-deserialize-json.rl index 91b350f5..0f7d48ee 100644 --- a/src/hb-buffer-deserialize-json.rl +++ b/src/h
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-aat-layout-common-private.hh |5 src/hb-aat-layout-morx-table.hh | 86 -- src/hb-aat-layout.cc | 20 +- src/hb-open-type-private.hh |6 src/hb-set-private.hh |1 test/shaping/data/text-rendering-tests/Makefile.sources |2 test/shaping/data/text-rendering-tests/fonts/TestMORXFourteen.ttf |binary test/shaping/data/text-rendering-tests/fonts/TestMORXThirteen.ttf |binary test/shaping/data/text-rendering-tests/tests/MORX-13.tests|1 test/shaping/data/text-rendering-tests/tests/MORX-14.tests|1 10 files changed, 97 insertions(+), 25 deletions(-) New commits: commit 12fffce10eb6ffebdedd655d0b1f10a99adf1808 Author: Behdad Esfahbod Date: Mon Jan 15 15:41:51 2018 -0500 [aat] Sanitize classTable in StateTable diff --git a/src/hb-aat-layout-common-private.hh b/src/hb-aat-layout-common-private.hh index a67ee528..f912ed02 100644 --- a/src/hb-aat-layout-common-private.hh +++ b/src/hb-aat-layout-common-private.hh @@ -550,7 +550,8 @@ struct StateTable unsigned int *num_entries_out = nullptr) const { TRACE_SANITIZE (this); -if (unlikely (!c->check_struct (this))) return_trace (false); +if (unlikely (!(c->check_struct (this) && + classTable.sanitize (c, this return_trace (false); const HBUINT16 *states = (this+stateArrayTable).arrayZ; const Entry *entries = (this+entryTable).arrayZ; commit e6263c7142ca22efd9a3c93353a513f475c1c48d Author: Behdad Esfahbod Date: Mon Jan 15 15:37:55 2018 -0500 [aat] Wire up table length to apply() diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index d2a66509..766292b3 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -448,13 +448,13 @@ struct ChainSubtable Insertion = 5 }; - inline void apply (hb_apply_context_t *c) const + inline void apply (hb_apply_context_t *c, const char *end) const { -dispatch (c); +dispatch (c, end); } template - inline typename context_t::return_t dispatch (context_t *c) const + inline typename context_t::return_t dispatch (context_t *c, const char *end) const { unsigned int subtable_type = get_type (); TRACE_DISPATCH (this, subtable_type); @@ -476,7 +476,7 @@ struct ChainSubtable !c->check_range (this, length)) return_trace (false); -return_trace (dispatch (c)); +return_trace (dispatch (c, c->end)); } protected: @@ -496,13 +496,13 @@ struct ChainSubtable struct Chain { - inline void apply (hb_apply_context_t *c) const + inline void apply (hb_apply_context_t *c, const char *end) const { const ChainSubtable *subtable = &StructAtOffset (featureZ, featureZ[0].static_size * featureCount); unsigned int count = subtableCount; for (unsigned int i = 0; i < count; i++) { - subtable->apply (c); + subtable->apply (c, end); subtable = &StructAfter (*subtable); } } @@ -555,13 +555,14 @@ struct morx { static const hb_tag_t tableTag = HB_AAT_TAG_MORX; - inline void apply (hb_apply_context_t *c) const + inline void apply (hb_apply_context_t *c, unsigned int length) const { +const char *end = (const char *) this + length; const Chain *chain = chains; unsigned int count = chainCount; for (unsigned int i = 0; i < count; i++) { - chain->apply (c); + chain->apply (c, end); chain = &StructAfter (*chain); } } diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index 79f0ae65..7455787f 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -37,11 +37,20 @@ */ static inline const AAT::morx& -_get_morx (hb_face_t *face) +_get_morx (hb_face_t *face, unsigned int *length = nullptr) { - if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(AAT::morx); + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) + { +if (length) + *length = 0; +return OT::Null(AAT::morx); + } hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - return *(layout->morx.get ()); /* XXX this doesn't call set_num_glyphs on sanitizer. */ + /* XXX this doesn't call set_num_glyphs on sanitizer. */ + const AAT::morx& morx = *(layout->morx.get ()); + if (length) +*length = hb_blob_get_length (layout->morx.blob); + return morx; } static inline void @@ -61,6 +70,7 @@ _hb_aat_layout_create (hb_face_t *face) void hb_aat_layout_substitute (OT::hb_apply_context_t *c) { - const AAT::morx& morx = _get_morx (c->face); - morx.apply (c); + unsigned int length; + const AAT::morx& morx = _get_morx (c->face, &length); + morx.apply (c, length); } diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 736497d9..04e4a4
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
.circleci/config.yml | 26 +++--- src/hb-buffer-private.hh |2 - src/hb-buffer.cc |4 +- src/hb-open-file-private.hh |2 - test/shaping/run-tests.sh | 21 +++--- test/shaping/tests/cluster.tests |4 +- test/shaping/tests/indic-consonant-with-stacker.tests |8 ++--- test/shaping/tests/indic-script-extensions.tests |2 - test/shaping/tests/vertical.tests |2 - 9 files changed, 51 insertions(+), 20 deletions(-) New commits: commit f1245013bf7e9d490b43d9b8bebd467b2c1d14cc Author: Khaled Hosny Date: Wed Nov 1 12:06:59 2017 +0200 [test] Run shaping tests with both ot and ft funcs diff --git a/test/shaping/run-tests.sh b/test/shaping/run-tests.sh index a7d331aa..bb1ba80e 100755 --- a/test/shaping/run-tests.sh +++ b/test/shaping/run-tests.sh @@ -27,18 +27,29 @@ for f in "$@"; do continue fi $reference || echo "hb-shape $fontfile $options --unicodes $unicodes" - glyphs=`$hb_shape "$srcdir/$fontfile" $options --unicodes "$unicodes"` + glyphs1=`$hb_shape --font-funcs=ft "$srcdir/$fontfile" $options --unicodes "$unicodes"` if test $? != 0; then - echo "hb-shape failed." >&2 + echo "hb-shape --font-funcs=ft failed." >&2 fails=$((fails+1)) #continue fi + glyphs2=`$hb_shape --font-funcs=ot "$srcdir/$fontfile" $options --unicodes "$unicodes"` + if test $? != 0; then + echo "hb-shape --font-funcs=ot failed." >&2 + fails=$((fails+1)) + #continue + fi + if ! test "x$glyphs1" = "x$glyphs2"; then + echo "FT funcs: $glyphs1" >&2 + echo "OT funcs: $glyphs2" >&2 + fails=$((fails+1)) + fi if $reference; then - echo "$fontfile:$options:$unicodes:$glyphs" + echo "$fontfile:$options:$unicodes:$glyphs1" continue fi - if ! test "x$glyphs" = "x$glyphs_expected"; then - echo "Actual: $glyphs" >&2 + if ! test "x$glyphs1" = "x$glyphs_expected"; then + echo "Actual: $glyphs1" >&2 echo "Expected: $glyphs_expected" >&2 fails=$((fails+1)) fi commit 70137e2b4b46918d9608f824a4b4b5cef2819158 Author: Khaled Hosny Date: Wed Nov 1 12:03:39 2017 +0200 [test] We donât care about glyph positions here Freetype and OT font functions give different positions for some glyphs in this font (OT seems to be correct), but that is not what we are interested in in this test. See https://github.com/behdad/harfbuzz/pull/590#issuecomment-341045223. diff --git a/test/shaping/tests/cluster.tests b/test/shaping/tests/cluster.tests index 24f04ddf..19da4cab 100644 --- a/test/shaping/tests/cluster.tests +++ b/test/shaping/tests/cluster.tests @@ -1,2 +1,2 @@ -fonts/sha1sum/6466d38c62e73a39202435a4f73bf5d6acbb73c0.ttf:--cluster-level=2:U+0078,U+030A,U+0058,U+030A:[gid2=0+1083|gid4=1@-555,-8+0|gid1=2+1200|gid4=3@-614,349+0] -fonts/sha1sum/43ef465752be9af900745f72fe29cb853a1401a5.ttf:--cluster-level=1:U+05D4,U+05B7,U+05E9,U+05BC,U+05C1,U+05B8,U+05DE,U+05B4,U+05DD:[uni05DD=8+1359|uni05B4=7@111,0+0|uni05DE=6+1391|uni05B8=5+0|uni05BC=3+0|uni05C1=3+0|uni05E9=2+1451|uni05B7=1@28,0+0|uni05D4=0+1338] +fonts/sha1sum/6466d38c62e73a39202435a4f73bf5d6acbb73c0.ttf:--cluster-level=2 --no-positions:U+0078,U+030A,U+0058,U+030A:[gid2=0|gid4=1|gid1=2|gid4=3] +fonts/sha1sum/43ef465752be9af900745f72fe29cb853a1401a5.ttf:--cluster-level=1 --no-positions:U+05D4,U+05B7,U+05E9,U+05BC,U+05C1,U+05B8,U+05DE,U+05B4,U+05DD:[uni05DD=8|uni05B4=7|uni05DE=6|uni05B8=5|uni05BC=3|uni05C1=3|uni05E9=2|uni05B7=1|uni05D4=0] commit 9234b364b178d44a11148d5c613169731667a2ae Author: Khaled Hosny Date: Wed Nov 1 10:34:36 2017 +0200 [test] Use ft functions for this test https://github.com/behdad/harfbuzz/pull/590#issuecomment-340967271 diff --git a/test/shaping/tests/vertical.tests b/test/shaping/tests/vertical.tests index 3586080f..e0b64d94 100644 --- a/test/shaping/tests/vertical.tests +++ b/test/shaping/tests/vertical.tests @@ -1,3 +1,3 @@ -fonts/sha1sum/191826b9643e3f124d865d617ae609db6a2ce203.ttf:--direction=t:U+300C:[uni300C.vert=0@-512,-578+0,-1024] +fonts/sha1sum/191826b9643e3f124d865d617ae609db6a2ce203.ttf:--direction=t --font-funcs=ft:U+300C:[uni300C.vert=0@-512,-578+0,-1024] fonts/sha1sum/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --fon
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
.circleci/config.yml |4 +++ src/hb-open-file-private.hh | 40 +-- src/hb-open-type-private.hh | 50 --- src/hb-ot-font.cc|2 - src/hb-ot-shape-complex-indic.cc |4 +-- 5 files changed, 66 insertions(+), 34 deletions(-) New commits: commit 65d4e5bcda543c17e09867418365ba44b441d5d6 Author: Behdad Esfahbod Date: Wed Nov 1 01:15:27 2017 -0600 [CircleCI] Ignore gh-pages branch https://github.com/behdad/harfbuzz/pull/592 diff --git a/.circleci/config.yml b/.circleci/config.yml index 7135b853..d4835e44 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,8 @@ version: 2 + +branches: + ignore: + - gh-pages jobs: base: commit 92bb5086424d7454d666732e39117a7d32490646 Author: Behdad Esfahbod Date: Tue Oct 31 22:58:03 2017 -0600 [indic] Use mutable for virama_glyph diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 0cb326aa..f17a974d 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -508,7 +508,7 @@ struct indic_shape_plan_t /* Our get_nominal_glyph() function needs a font, so we can't get the virama glyph * during shape planning... Instead, overwrite it here. It's safe. Don't worry! */ - (const_cast (this))->virama_glyph = glyph; + virama_glyph = glyph; } *pglyph = glyph; @@ -518,7 +518,7 @@ struct indic_shape_plan_t const indic_config_t *config; bool is_old_spec; - hb_codepoint_t virama_glyph; + mutable hb_codepoint_t virama_glyph; would_substitute_feature_t rphf; would_substitute_feature_t pref; commit 6c04dcb28dcafc7d97799c80c0bc714c76d51d1c Author: Behdad Esfahbod Date: Tue Oct 31 20:11:00 2017 -0600 Use bsearch() for large SFNT table directories diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index 77caddd2..a6d5a6b1 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -53,6 +53,9 @@ struct TTCHeader; typedef struct TableRecord { + int cmp (Tag t) const + { return t.cmp (tag); } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -100,18 +103,12 @@ typedef struct OffsetTable { Tag t; t.set (tag); -unsigned int count = tables.len; -/* TODO bsearch() */ -for (unsigned int i = 0; i < count; i++) -{ - if (t == tables.array[i].tag) - { -if (table_index) *table_index = i; -return true; - } -} -if (table_index) *table_index = Index::NOT_FOUND_INDEX; -return false; +/* Linear-search for small tables to work around fonts with unsorted + * table list. */ +int i = tables.len < 64 ? tables.lsearch (t) : tables.bsearch (t); +if (table_index) + *table_index = i == -1 ? Index::NOT_FOUND_INDEX : (unsigned int) i; +return i != -1; } inline const TableRecord& get_table_by_tag (hb_tag_t tag) const { commit b0e33da02d062200dd41e4503ecc21fb4bd636e6 Author: Behdad Esfahbod Date: Tue Oct 31 20:05:37 2017 -0600 Add BinSearchArrayOf<> diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index dcfdfd6c..77caddd2 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -73,10 +73,9 @@ typedef struct OffsetTable friend struct OpenTypeFontFile; inline unsigned int get_table_count (void) const - { return numTables; } + { return tables.len; } inline const TableRecord& get_table (unsigned int i) const { -if (unlikely (i >= numTables)) return Null(TableRecord); return tables[i]; } inline unsigned int get_table_tags (unsigned int start_offset, @@ -85,26 +84,27 @@ typedef struct OffsetTable { if (table_count) { - if (start_offset >= numTables) + if (start_offset >= tables.len) *table_count = 0; else -*table_count = MIN (*table_count, numTables - start_offset); +*table_count = MIN (*table_count, tables.len - start_offset); - const TableRecord *sub_tables = tables + start_offset; + const TableRecord *sub_tables = tables.array + start_offset; unsigned int count = *table_count; for (unsigned int i = 0; i < count; i++) table_tags[i] = sub_tables[i].tag; } -return numTables; +return tables.len; } inline bool find_table_index (hb_tag_t tag, unsigned int *table_index) const { Tag t; t.set (tag); -unsigned int count = numTables; +unsigned int count = tables.len; +/* TODO bsearch() */ for (unsigned int i = 0; i < count; i++) { - if (t == tables[i].tag) + if (t == tables.array[i].tag) { if (table_index) *table_index = i; return true; @@ -124,16 +124,13 @@ typedef struct OffsetTable inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); -return_trace
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-coretext.cc | 86 ++--- 1 file changed, 36 insertions(+), 50 deletions(-) New commits: commit 7b23c286a71883ac3e5777a2dee262af48c76854 Merge: 8d450dd1 a5ebe1d4 Author: Behdad Esfahbod Date: Wed Oct 11 13:35:32 2017 +0200 Merge branch 'coretext-optical-sizing' Should fix https://github.com/behdad/harfbuzz/issues/360 commit a5ebe1d4aec41bc5e289a7969e5e5f7bb57733b6 Author: Dominik Röttsches Date: Wed Oct 11 13:32:38 2017 +0200 [coretext] Recreate CTFont if pt size changed Attempt at fixing #360 diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 9b680abf..8219284d 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -71,8 +71,9 @@ hb_coretext_face_create (CGFontRef cg_font) HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face) -HB_SHAPER_DATA_ENSURE_DEFINE(coretext, font) - +HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font, +abs (CTFontGetSize((CTFontRef) data) - + (font->ptem < 0 ? HB_CORETEXT_FONT_SIZE : font->ptem)) < 1) /* * shaper face data commit db7a73ce0781d1fec0235e419ac448565dcfc8ca Author: Dominik Röttsches Date: Wed Oct 11 13:24:39 2017 +0200 [coretext] Fix build diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 26cc07c9..9b680abf 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -241,7 +241,8 @@ hb_coretext_face_get_cg_font (hb_face_t *face) hb_coretext_shaper_font_data_t * _hb_coretext_shaper_font_data_create (hb_font_t *font) { - if (unlikely (!hb_coretext_shaper_face_data_ensure (font->face))) return NULL; + hb_face_t *face = font->face; + if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL; CGFontRef cg_font = (CGFontRef) HB_SHAPER_DATA_GET (face); float ptem = font->ptem < 0 ? HB_CORETEXT_FONT_SIZE : font->ptem; @@ -289,7 +290,7 @@ CTFontRef hb_coretext_font_get_ct_font (hb_font_t *font) { if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return NULL; - return (CTFontRef)_SHAPER_DATA_GET (font); + return (CTFontRef)HB_SHAPER_DATA_GET (font); } commit f33413075655e6383cd16bc31f0bf804dcec1c64 Author: Behdad Esfahbod Date: Wed Oct 11 13:17:46 2017 +0200 [coretext] Another try diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 3f1c6711..26cc07c9 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -203,12 +203,10 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size) return ct_font; } -typedef CGFontRef hb_coretext_shaper_face_data_t; - hb_coretext_shaper_face_data_t * _hb_coretext_shaper_face_data_create (hb_face_t *face) { - hb_coretext_shaper_face_data_t *cg_font = create_cg_font (face); + CGFontRef cg_font = create_cg_font (face); if (unlikely (!cg_font)) { @@ -216,13 +214,13 @@ _hb_coretext_shaper_face_data_create (hb_face_t *face) return NULL; } - return cg_font; + return (hb_coretext_shaper_face_data_t *) cg_font; } void -_hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *cg_font) +_hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data) { - CFRelease (cg_font); + CFRelease ((CGFontRef) data); } /* @@ -232,8 +230,7 @@ CGFontRef hb_coretext_face_get_cg_font (hb_face_t *face) { if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL; - hb_coretext_shaper_face_data_t *cg_font = HB_SHAPER_DATA_GET (face); - return cg_font; + return (CGFontRef) HB_SHAPER_DATA_GET (face); } @@ -241,17 +238,15 @@ hb_coretext_face_get_cg_font (hb_face_t *face) * shaper font data */ -typedef CTFontRef hb_coretext_shaper_font_data_t; - hb_coretext_shaper_font_data_t * _hb_coretext_shaper_font_data_create (hb_font_t *font) { if (unlikely (!hb_coretext_shaper_face_data_ensure (font->face))) return NULL; - hb_coretext_shaper_face_data_t *cg_font = HB_SHAPER_DATA_GET (face); + CGFontRef cg_font = (CGFontRef) HB_SHAPER_DATA_GET (face); float ptem = font->ptem < 0 ? HB_CORETEXT_FONT_SIZE : font->ptem; - hb_coretext_shaper_font_data_t *ct_font = create_ct_font (cg_font, ptem); + CTFontRef ct_font = create_ct_font (cg_font, ptem); if (unlikely (!ct_font)) { @@ -259,13 +254,13 @@ _hb_coretext_shaper_font_data_create (hb_font_t *font) return NULL; } - return ct_font; + return (hb_coretext_shaper_font_data_t *) ct_font; } void -_hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *ct_font) +_hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *data) { - CFRelease (ct_font); + CFRelease ((CTFontRef) data); } @@ -294,8 +289,7 @@ CTFontRef hb_coretext_font_get_ct_font (hb_font_t *font) { if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return NULL; - hb_coretext_shaper_font_data_t *ct_font = HB_SHAPER_DATA_GET (font); - return ct_font; + return (CTFontRef)_SHAPER_DATA_GET (font); } @@ -5
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
CMakeLists.txt |4 src/hb-buffer.cc|4 src/hb-common.cc| 28 ++ src/hb-ot-font.cc |2 src/hb-ot-layout-gsubgpos-private.hh| 45 ++- src/hb-ot-layout.cc |3 src/hb-ot-map-private.hh| 10 src/hb-ot-map.cc|8 src/hb-ot-shape-complex-arabic-table.hh | 14 - src/hb-ot-shape-complex-arabic.cc |2 src/hb-ot-shape-complex-hangul.cc | 16 - src/hb-ot-shape-complex-indic-table.cc | 22 - src/hb-ot-shape-complex-indic.cc| 16 - src/hb-ot-shape-complex-myanmar.cc |2 src/hb-ot-shape-complex-thai.cc | 12 src/hb-ot-shape-complex-use-table.cc| 42 +-- src/hb-unicode-private.hh | 25 +- src/hb-utf-private.hh | 18 - test/shaping/Makefile.am|4 test/shaping/fonts/sha1sum/2de1ab4907ab688c0cfc236b0bf51151db38bf2e.ttf |binary test/shaping/fonts/sha1sum/82f4f3b57bb55344e72e70231380202a52af5805.ttf |binary test/shaping/fonts/sha1sum/a02a7f0ad42c2922cb37ad1358c9df4eb81f1bca.ttf |binary test/shaping/fonts/sha1sum/f443753e8ffe8e8aae606cfba158e00334b6efb1.ttf |binary test/shaping/tests/indic-joiners.tests |2 test/shaping/tests/tibetan-contractions-1.tests | 60 test/shaping/tests/tibetan-contractions-2.tests | 53 test/shaping/tests/tibetan-vowels.tests | 11 win32/README.txt| 20 + win32/build-rules-msvc.mak |5 win32/config-msvc.mak |7 win32/create-lists-msvc.mak |9 win32/generate-msvc.mak |6 win32/info-msvc.mak |8 win32/pc_base.py| 124 ++ win32/replace.py| 115 + win32/setup.py | 62 + 36 files changed, 639 insertions(+), 120 deletions(-) New commits: commit e359a4b8f57bbc778843f233c4f5d6fb07ff11d9 Author: Behdad Esfahbod Date: Fri Jul 14 14:14:35 2017 +0100 [indic] Disable automatic ZWNJ handling for Indic features Fixes https://github.com/behdad/harfbuzz/issues/294 Also fixes a bunch of other Indic issues. Test results after: BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%) DEVANAGARI: 707307 out of 707394 tests passed. 87 failed (0.0122987%) GUJARATI: 366355 out of 366457 tests passed. 102 failed (0.0278341%) GURMUKHI: 60732 out of 60747 tests passed. 15 failed (0.0246926%) KANNADA: 951201 out of 951913 tests passed. 712 failed (0.0747968%) KHMER: 299071 out of 299124 tests passed. 53 failed (0.0177184%) MALAYALAM: 1048136 out of 1048334 tests passed. 198 failed (0.0188871%) ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%) SINHALA: 271662 out of 271847 tests passed. 185 failed (0.068053%) TAMIL: 1091754 out of 1091754 tests passed. 0 failed (0%) TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%) Before: BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%) DEVANAGARI: 707307 out of 707394 tests passed. 87 failed (0.0122987%) GUJARATI: 366349 out of 366457 tests passed. 108 failed (0.0294714%) GURMUKHI: 60732 out of 60747 tests passed. 15 failed (0.0246926%) KANNADA: 951190 out of 951913 tests passed. 723 failed (0.0759523%) KHMER: 299070 out of 299124 tests passed. 54 failed (0.0180527%) MALAYALAM: 1048136 out of 1048334 tests passed. 198 failed (0.0188871%) ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%) SINHALA: 271662 out of 271847 tests passed. 185 failed (0.068053%) TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%) TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%) diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-o
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
CMakeLists.txt | 115 --- src/Makefile.am |4 - src/hb-common.cc |6 + src/hb-graphite2.cc | 32 - src/hb-ot-layout-gsubgpos-private.hh |2 src/hb-shape-plan.cc |7 +- test/shaping/README.md |2 7 files changed, 80 insertions(+), 88 deletions(-) New commits: commit 74b99ef2249107e7cd01bd1ee522a5d9ce61e05f Author: mhosken Date: Thu Apr 20 19:13:22 2017 +0100 Fix graphite2 rtl conversion (#475) diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index 5b804b82..c9799e9d 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -301,7 +301,7 @@ _hb_graphite2_shape (hb_shape_plan_t*shape_plan, hb_codepoint_t *pg = gids; clusters[0].cluster = buffer->info[0].cluster; - float curradv = HB_DIRECTION_IS_BACKWARD(buffer->props.direction) ? gr_slot_origin_X(gr_seg_first_slot(seg)) : 0.; + float curradv = 0.; if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) { curradv = gr_slot_origin_X(gr_seg_first_slot(seg)); @@ -330,13 +330,10 @@ _hb_graphite2_shape (hb_shape_plan_t*shape_plan, c->base_glyph = ic; c->num_glyphs = 0; if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) - { -ci++; -clusters[ci].advance = curradv - gr_slot_origin_X(is); - } else { +c->advance = curradv - gr_slot_origin_X(is); + else clusters[ci].advance = gr_slot_origin_X(is) - curradv; -ci++; - } + ci++; curradv = gr_slot_origin_X(is); } clusters[ci].num_glyphs++; @@ -345,7 +342,9 @@ _hb_graphite2_shape (hb_shape_plan_t*shape_plan, clusters[ci].num_chars = after + 1 - clusters[ci].base_char; } - if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) + if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) +clusters[ci].advance += curradv; + else clusters[ci].advance = gr_seg_advance_X(seg) - curradv; ci++; @@ -366,11 +365,11 @@ _hb_graphite2_shape (hb_shape_plan_t*shape_plan, float yscale = (float) font->y_scale / upem; yscale *= yscale / xscale; /* Positioning. */ + int currclus = -1; + const hb_glyph_info_t *info = buffer->info; + hb_glyph_position_t *pPos = hb_buffer_get_glyph_positions (buffer, NULL); if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) { -int currclus = -1; -const hb_glyph_info_t *info = buffer->info; -hb_glyph_position_t *pPos = hb_buffer_get_glyph_positions (buffer, NULL); curradvx = 0; for (is = gr_seg_first_slot (seg); is; pPos++, ++info, is = gr_slot_next_in_segment (is)) { @@ -389,23 +388,20 @@ _hb_graphite2_shape (hb_shape_plan_t*shape_plan, } else { -int currclus = -1; -const hb_glyph_info_t *info = buffer->info; -hb_glyph_position_t *pPos = hb_buffer_get_glyph_positions (buffer, NULL); -curradvx = gr_seg_advance_X(seg) * xscale; +curradvx = gr_seg_advance_X(seg); for (is = gr_seg_first_slot (seg); is; pPos++, info++, is = gr_slot_next_in_segment (is)) { if (info->cluster != currclus) { pPos->x_advance = info->var1.i32 * xscale; -if (currclus != -1) curradvx -= info[-1].var1.i32 * xscale; +curradvx -= pPos->x_advance; currclus = info->cluster; } else - pPos->x_advance = 0.; +pPos->x_advance = 0.; pPos->y_advance = gr_slot_advance_Y (is, grface, NULL) * yscale; curradvy -= pPos->y_advance; - pPos->x_offset = gr_slot_origin_X (is) * xscale - curradvx + pPos->x_advance; + pPos->x_offset = (gr_slot_origin_X (is) - info->var1.i32) * xscale - curradvx + pPos->x_advance; pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy; } hb_buffer_reverse_clusters (buffer); commit 696641314e7eb60a5a2e08c1c4fd1e5e41022148 Author: ebraminio Date: Wed Apr 19 22:59:46 2017 +0430 [cmake] Final touches (#473) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c03f2bb..91e7eca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,12 +19,16 @@ endif () ## HarfBuzz build configurations option(HB_HAVE_FREETYPE "Enable freetype interop helpers" OFF) option(HB_HAVE_GRAPHITE2 "Enable Graphite2 complementary shaper" OFF) -option(HB_HAVE_UNISCRIBE "Enable Uniscribe shaper backend on Windows" OFF) -option(HB_HAVE_DIRECWRITE "Enable DirectWrite shaper backend on Windows" OFF) -option(HB_HAVE_CORETEXT "Enable CoreText shaper backend on macOS" ON) option(HB_BUILTIN_UCDN "Use HarfBuzz provided UCDN" ON) option(HB_HAVE_GLIB "Enable glib unicode functions" OFF) option(HB_HAVE_ICU "Enable icu unicode functions" OFF) +if (APPLE) + option(HB_HAVE_CORETEXT "Enable CoreText shaper backend on macOS" ON) +endif () +if (WIN32) + option(HB_HAVE_UNISCRIBE "Enable Uniscribe shaper backend on Windows" OFF) + option(HB_HAVE_DIRECWRITE "Enable DirectWrite shaper backend on Windo
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
appveyor.yml|2 +- src/hb-common.cc|2 +- src/hb-ot-layout.cc |8 win32/Makefile.vc | 15 +++ win32/README.txt|6 +++--- win32/config-msvc.mak | 28 +++- win32/config.h.win32.in |2 +- win32/info-msvc.mak | 43 +-- 8 files changed, 69 insertions(+), 37 deletions(-) New commits: commit edcf6344bc62af9ea726a633468c9243e127fa13 Author: Behdad Esfahbod Date: Fri Mar 24 10:24:52 2017 -0700 Blacklist more versions of Padauk Patch from Phil Race. diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index e78e1524..f8a04a95 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -125,6 +125,14 @@ _hb_ot_layout_create (hb_face_t *face) /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */ /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */ || (188 == gdef_len && 3426 == gpos_len && 264 == gsub_len) + /* d125afa82a77a6475ac0e74e7c207914af84b37a padauk-2.80/Padauk.ttf RHEL 7.2 */ + || (1058 == gdef_len && 11818 == gpos_len && 47032 == gsub_len) + /* 0f7b80437227b90a577cc078c0216160ae61b031 padauk-2.80/Padauk-Bold.ttf RHEL 7.2*/ + || (1046 == gdef_len && 12600 == gpos_len && 47030 == gsub_len) + /* d3dde9aa0a6b7f8f6a89ef1002e9aaa11b882290 padauk-2.80/Padauk.ttf Ubuntu 16.04 */ + || (1058 == gdef_len && 16770 == gpos_len && 71796 == gsub_len) + /* 5f3c98ae8a953be2d122c1b3a77fd805093f padauk-2.80/Padauk-Bold.ttf Ubuntu 16.04 */ + || (1046 == gdef_len && 17862 == gpos_len && 71790 == gsub_len) /* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */ || (1046 == gdef_len && 17112 == gpos_len && 71788 == gsub_len) /* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */ commit e693ba77980d5ded65bf773d48b6b58274933fb7 Author: Khaled Hosny Date: Thu Mar 23 00:35:36 2017 +0200 [ci] Fix msys2 build on AppVeyor For whatever reason the env variables need to be the Windows way or they end up being empty. diff --git a/appveyor.yml b/appveyor.yml index 67f61149..a2867ca4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,7 +46,7 @@ build_script: - 'if "%compiler%"=="msvc" nmake /f Makefile.vc CFG=%CFG% UNISCRIBE=1 DIRECTWRITE=1 install' # FREETYPE=1 install' - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-$MSYS2_ARCH-{freetype,cairo,icu,gettext,gobject-introspection,gcc,gcc-libs,glib2,graphite2,pkg-config}"' - - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --build=$MINGW_CHOST --host=$MINGW_CHOST --prefix=$MINGW_PREFIX; make; make check"' + - 'if "%compiler%"=="msys2" C:\msys64\usr\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; PATH=$PATH:/mingw64/bin:/mingw32/bin; ./autogen.sh --with-uniscribe --with-freetype --with-glib --with-gobject --with-cairo --with-icu --with-graphite2 --build=%MINGW_CHOST% --host=%MINGW_CHOST% --prefix=%MINGW_PREFIX%; make; make check"' # disable automatic tests test: off commit 91570a1eeb1eca425372e203656369f39ede5c61 Author: Khaled Hosny Date: Wed Mar 22 23:07:15 2017 +0200 Just always use strtod here diff --git a/src/hb-common.cc b/src/hb-common.cc index 4c1a9a8d..16657303 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -667,11 +667,7 @@ parse_float (const char **pp, const char *end, float *pv) float v; errno = 0; -#if defined (_MSC_VER) && (_MSC_VER < 1800) v = strtod (p, &pend); -#else - v = strtof (p, &pend); -#endif if (errno || p == pend) return false; commit 539571c1a9cb5d443d029247874af37fed75432f Author: Chun-wei Fan Date: Fri Feb 24 17:58:25 2017 +0800 src/hb-common.cc: Fix build on older Visual Studio Visual Studio only supported strtof() from Visual Studio 2013 onwards, so use strtod() instead to do the operation, which should do the same thing, sans going to a double, not a float. diff --git a/src/hb-common.cc b/src/hb-common.cc index 64e77d43..4c1a9a8d 100644 --- a/src/hb-common.cc +++ b/src/hb-common.cc @@ -667,7 +667,11 @@ parse_float (const char **pp, const char *end, float *pv) float v; errno = 0; +#if defined (_MSC_VER) && (_MSC_VER < 1800) + v = strtod (p, &pend); +#else v = strtof (p, &pend); +#endif if (errno || p == pend) return false; commit b90fb83ea6067802e62af9e1ea0c61c7ac79e9a9 Author: Chun-wei Fan Date: Fri Feb 24 17:47:44 2017 +0800 Visual Studio builds: Fix Introspection when UCDN enabled The sources in src/hb-ucdn and not included correctly into the NMake Makefiles, as we need their explicit relative lo
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-coretext.cc|4 +- src/hb-directwrite.cc |4 +- src/hb-face-private.hh|9 + src/hb-face.cc| 19 +++- src/hb-fallback-shape.cc |4 ++ src/hb-font-private.hh| 12 +++ src/hb-font.cc| 59 ++ src/hb-font.h |4 ++ src/hb-graphite2.cc |4 +- src/hb-ot-layout-private.hh |1 src/hb-ot-layout.cc |2 - src/hb-ot-math.cc |3 - src/hb-ot-shape-complex-arabic.cc |2 - src/hb-ot-shape.cc|4 ++ src/hb-ot-var.cc |2 - src/hb-shape-plan.cc |7 src/hb-shaper-private.hh | 16 ++ src/hb-uniscribe.cc |4 +- 18 files changed, 130 insertions(+), 30 deletions(-) New commits: commit 73c6dcbb45269186f204b2212288b6384ce42c9d Author: Behdad Esfahbod Date: Tue Feb 7 16:53:21 2017 -0800 Silence Coverity warning Fixes https://github.com/behdad/harfbuzz/issues/408 diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 56ec5cd..57ffc1d 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -540,7 +540,7 @@ apply_stch (const hb_ot_shape_plan_t *plan, /* See if we can improve the fit by adding an extra repeat and squeezing them together a bit. */ hb_position_t extra_repeat_overlap = 0; hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_copies + 1); - if (shortfall > 0) + if (shortfall > 0 && n_repeating > 0) { ++n_copies; hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining; commit 466b3e58bdc64229dab08c6e0e0079c789540370 Author: Behdad Esfahbod Date: Fri Feb 3 16:43:25 2017 -0800 Shuffle things around a bit diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index e857dfa..86de0be 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -69,8 +69,8 @@ hb_coretext_face_create (CGFontRef cg_font) } -HB_SHAPER_DATA_ENSURE_DECLARE(coretext, face) -HB_SHAPER_DATA_ENSURE_DECLARE(coretext, font) +HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face) +HB_SHAPER_DATA_ENSURE_DEFINE(coretext, font) /* diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc index d63bc04..ab07d8a 100644 --- a/src/hb-directwrite.cc +++ b/src/hb-directwrite.cc @@ -34,8 +34,8 @@ #define HB_DEBUG_DIRECTWRITE (HB_DEBUG+0) #endif -HB_SHAPER_DATA_ENSURE_DECLARE(directwrite, face) -HB_SHAPER_DATA_ENSURE_DECLARE(directwrite, font) +HB_SHAPER_DATA_ENSURE_DEFINE(directwrite, face) +HB_SHAPER_DATA_ENSURE_DEFINE(directwrite, font) /* diff --git a/src/hb-fallback-shape.cc b/src/hb-fallback-shape.cc index e5a80ee..4b60c6c 100644 --- a/src/hb-fallback-shape.cc +++ b/src/hb-fallback-shape.cc @@ -28,6 +28,10 @@ #include "hb-shaper-impl-private.hh" +HB_SHAPER_DATA_ENSURE_DEFINE(fallback, face) +HB_SHAPER_DATA_ENSURE_DEFINE(fallback, font) + + /* * shaper face data */ diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index a2d90db..68f0817 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -35,8 +35,8 @@ #include -HB_SHAPER_DATA_ENSURE_DECLARE(graphite2, face) -HB_SHAPER_DATA_ENSURE_DECLARE(graphite2, font) +HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, face) +HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, font) /* diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index 8c348be..071a439 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -623,5 +623,4 @@ _hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer) #undef lig_props #undef glyph_props - #endif /* HB_OT_LAYOUT_PRIVATE_HH */ diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 580397b..a1682a5 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -39,8 +39,6 @@ #include "hb-ot-map-private.hh" -HB_SHAPER_DATA_ENSURE_DECLARE(ot, face) - hb_ot_layout_t * _hb_ot_layout_create (hb_face_t *face) { diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index 2d7e679..f82a073 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -26,10 +26,9 @@ #include "hb-open-type-private.hh" +#include "hb-ot-layout-private.hh" #include "hb-ot-math-table.hh" -HB_SHAPER_DATA_ENSURE_DECLARE(ot, face) - static inline const OT::MATH& _get_math (hb_face_t *face) { diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 6b38739..2eacb34 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -128,6 +128,8 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner, * shaper face data */ +HB_SHAPER_DATA_ENSURE_DEFINE(ot, face) + hb_ot_shaper_face_data_t * _hb_ot_shaper_face_data_create (hb_face_t *face) { @@ -145,6 +147,8 @@ _hb_ot_shaper_face_data_destroy (hb_ot_shaper_face_data_t *data) * shaper font data */ +HB_SHAPER_DATA_EN
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
docs/harfbuzz-sections.txt | 10 ++- src/Makefile.sources|1 src/hb-font.cc | 25 ++- src/hb-font.h |2 src/hb-ft.cc|2 src/hb-ot-math.cc |2 src/hb-ot-var-avar-table.hh | 143 src/hb-ot-var.cc| 64 --- src/hb-ot-var.h | 22 +- util/helper-cairo.cc| 14 ++-- util/options.cc | 53 11 files changed, 257 insertions(+), 81 deletions(-) New commits: commit 7a860f656e4aec45c45e0f5fb28c49a91dc5eef2 Author: Behdad Esfahbod Date: Sun Jan 22 19:52:09 2017 -0800 [var] Add macros for standard axes diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index fcf4e52..3011ee9 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -442,6 +442,11 @@ Xhb_ot_layout_lookup_substitute hb-ot-var HB_OT_TAG_avar HB_OT_TAG_fvar +HB_OT_TAG_VAR_AXIS_ITALIC +HB_OT_TAG_VAR_AXIS_OPTICAL_SIZE +HB_OT_TAG_VAR_AXIS_SLANT +HB_OT_TAG_VAR_AXIS_WEIGHT +HB_OT_TAG_VAR_AXIS_WIDTH HB_OT_VAR_NO_AXIS_INDEX hb_ot_var_axis_t hb_ot_var_has_data @@ -584,6 +589,8 @@ hb_unicode_script_func_t hb-uniscribe hb_uniscribe_font_get_hfont hb_uniscribe_font_get_logfontw + +hb_directwrite_shape_experimental_width diff --git a/src/hb-ot-var.h b/src/hb-ot-var.h index bce7c7a..ea69aa5 100644 --- a/src/hb-ot-var.h +++ b/src/hb-ot-var.h @@ -39,6 +39,12 @@ HB_BEGIN_DECLS #define HB_OT_TAG_fvar HB_TAG('f','v','a','r') #define HB_OT_TAG_avar HB_TAG('a','v','a','r') +#define HB_OT_TAG_VAR_AXIS_ITALIC HB_TAG('i','t','a','l') +#define HB_OT_TAG_VAR_AXIS_OPTICAL_SIZEHB_TAG('o','p','s','z') +#define HB_OT_TAG_VAR_AXIS_SLANT HB_TAG('s','l','n','t') +#define HB_OT_TAG_VAR_AXIS_WIDTH HB_TAG('w','d','t','h') +#define HB_OT_TAG_VAR_AXIS_WEIGHT HB_TAG('w','g','h','t') + /* * fvar / avar commit a484e237b11650d00092329855d33dd2f67980e4 Author: Behdad Esfahbod Date: Sun Jan 22 19:41:33 2017 -0800 [var] Implement 'avar' table mapping Untested! diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index eb08bad..2d7e679 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -34,9 +34,7 @@ static inline const OT::MATH& _get_math (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::MATH); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - return *(layout->math.get ()); } diff --git a/src/hb-ot-var-avar-table.hh b/src/hb-ot-var-avar-table.hh index a041934..743d587 100644 --- a/src/hb-ot-var-avar-table.hh +++ b/src/hb-ot-var-avar-table.hh @@ -50,7 +50,39 @@ struct AxisValueMap DEFINE_SIZE_STATIC (4); }; -typedef ArrayOf SegmentMaps; +struct SegmentMaps : ArrayOf +{ + inline int map (int value) const + { +/* The following special-cases are not part of OpenType, which requires + * that at least -1, 0, and +1 must be mapped. But we include these as + * part of a better error recovery scheme. */ + +if (!len) + return value; + +if (value <= array[0].fromCoord) + return value - array[0].fromCoord + array[0].toCoord; + +unsigned int i; +unsigned int count = len; +for (i = 1; i < count && value > array[i].fromCoord; i++) + ; + +if (value >= array[i].fromCoord) + return value - array[i].fromCoord + array[i].toCoord; + +if (unlikely (array[i-1].fromCoord == array[i].fromCoord)) + return array[i-1].toCoord; + +int denom = array[i].fromCoord - array[i-1].fromCoord; +return array[i-1].toCoord + + (array[i].toCoord - array[i-1].toCoord) * + (value - array[i-1].fromCoord + denom/2) / denom; + } + + DEFINE_SIZE_ARRAY (2, array); +}; /* * avar â Axis Variations Table @@ -80,6 +112,18 @@ struct avar return_trace (true); } + inline void map_coords (int *coords, unsigned int coords_length) const + { +unsigned int count = MIN (coords_length, axisCount); + +const SegmentMaps *map = &axisSegmentMapsZ; +for (unsigned int i = 0; i < count; i++) +{ + coords[i] = map->map (coords[i]); + map = &StructAfter (*map); +} + } + protected: FixedVersion<>version; /* Version of the avar table * initially set to 0x0001u */ diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc index 76016e6..d4d16df 100644 --- a/src/hb-ot-var.cc +++ b/src/hb-ot-var.cc @@ -33,19 +33,24 @@ HB_SHAPER_DATA_ENSURE_DECLARE(ot, face) +/* + * fvar/avar + */ + static inline const OT::fvar& _get_fvar (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::fvar); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - return *(layout->fvar.get ()); } - -/* - * fvar/avar - */ +static inline const OT::avar& +_get_avar (hb_face_t *face) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return O
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-ot-cbdt-table.hh | 81 +++--- src/hb-ot-font.cc | 56 +++--- test/shaping/Makefile.am|1 test/shaping/fonts/sha1sum/ee39587d13b2afa5499cc79e45780aa79293bbd4.ttf |binary test/shaping/tests/color-fonts.tests|1 5 files changed, 88 insertions(+), 51 deletions(-) New commits: commit 9f6144cdb9dd2bc8cd147306e678d76ae82663d8 Author: Behdad Esfahbod Date: Sun Dec 4 19:55:17 2016 -0800 [CBDT] Add test for fetching glyph extents diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am index c5efe62..57369fd 100644 --- a/test/shaping/Makefile.am +++ b/test/shaping/Makefile.am @@ -44,6 +44,7 @@ TESTS = \ tests/arabic-fallback-shaping.tests \ tests/arabic-feature-order.tests \ tests/cluster.tests \ + tests/color-fonts.tests \ tests/context-matching.tests \ tests/cursive-positioning.tests \ tests/default-ignorables.tests \ diff --git a/test/shaping/fonts/sha1sum/ee39587d13b2afa5499cc79e45780aa79293bbd4.ttf b/test/shaping/fonts/sha1sum/ee39587d13b2afa5499cc79e45780aa79293bbd4.ttf new file mode 100644 index 000..fa2d0e1 Binary files /dev/null and b/test/shaping/fonts/sha1sum/ee39587d13b2afa5499cc79e45780aa79293bbd4.ttf differ diff --git a/test/shaping/tests/color-fonts.tests b/test/shaping/tests/color-fonts.tests new file mode 100644 index 000..397796a --- /dev/null +++ b/test/shaping/tests/color-fonts.tests @@ -0,0 +1 @@ +fonts/sha1sum/ee39587d13b2afa5499cc79e45780aa79293bbd4.ttf:--font-funcs=ot --show-extents:U+1F42F:[gid1=0+2963<0,2178,2963,-2788>] commit e4bfccfb2a0f425ff69b0a50ca8a4731c4001069 Author: Behdad Esfahbod Date: Sun Dec 4 19:43:33 2016 -0800 [CBDT] Minor diff --git a/src/hb-ot-cbdt-table.hh b/src/hb-ot-cbdt-table.hh index 7269688..52897ab 100644 --- a/src/hb-ot-cbdt-table.hh +++ b/src/hb-ot-cbdt-table.hh @@ -56,6 +56,15 @@ struct SmallGlyphMetrics DEFINE_SIZE_STATIC(5); }; +struct BigGlyphMetrics : SmallGlyphMetrics +{ + CHAR vertBearingX; + CHAR vertBearingY; + BYTE vertAdvance; + + DEFINE_SIZE_STATIC(8); +}; + struct SBitLineMetrics { inline bool sanitize (hb_sanitize_context_t *c) const @@ -171,6 +180,7 @@ struct IndexSubtable IndexSubtableHeader header; IndexSubtableFormat1 format1; IndexSubtableFormat3 format3; + /* TODO: Format 2, 4, 5. */ } u; public: DEFINE_SIZE_UNION (8, header); @@ -321,7 +331,6 @@ struct CBLC { /* TODO: Make it possible to select strike. */ -const BitmapSizeTable *sizeTable = &Null(BitmapSizeTable); unsigned int count = sizeTables.len; for (uint32_t i = 0; i < count; ++i) { @@ -329,15 +338,13 @@ struct CBLC unsigned int endGlyphIndex = sizeTables.array[i].endGlyphIndex; if (startGlyphIndex <= glyph && glyph <= endGlyphIndex) { - sizeTable = &sizeTables[i]; - break; + *x_ppem = sizeTables[i].ppemX; + *y_ppem = sizeTables[i].ppemY; + return sizeTables[i].find_table (glyph, this); } } -*x_ppem = sizeTable->ppemX; -*y_ppem = sizeTable->ppemY; - -return sizeTable->find_table (glyph, this); +return NULL; } protected: diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 1b6cea4..df01bc9 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -246,14 +246,12 @@ struct hb_ot_face_cbdt_accelerator_t { unsigned int x_ppem = upem, y_ppem = upem; /* TODO Use font ppem if available. */ -if (cblc == NULL) { +if (cblc == NULL) return false; // Not a color bitmap font. -} const OT::IndexSubtableRecord *subtable_record = this->cblc->find_table(glyph, &x_ppem, &y_ppem); -if (subtable_record == NULL) { +if (subtable_record == NULL) return false; -} if (subtable_record->get_extents (extents)) return true; @@ -262,23 +260,27 @@ struct hb_ot_face_cbdt_accelerator_t if (!subtable_record->get_image_data (glyph, &image_offset, &image_length, &image_format)) return false; -if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length)) - return false; - -switch (image_format) { - case 17: { - if (unlikely (image_length < OT::GlyphBitmapDataFormat17::min_size)) - return false; + /* TODO Move the following into CBDT struct when adding more formats. */ - const OT::GlyphBitmapDataFormat17& glyphFormat17 = - OT::StructAtOffset (this->cbdt, image_offset); - glyphFormat17.glyphMetrics.get_extents (extents); - } - break; - default: - // TODO: Support other image formats. + if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length)) return false; + + switch (image_format) + { + case 17: { + if (unlikely (
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-font-private.hh | 96 +- src/hb-ot-font.cc | 16 + test/shaping/fonts/sha1sum/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf |binary test/shaping/tests/vertical.tests |2 4 files changed, 69 insertions(+), 45 deletions(-) New commits: commit d163cd956246449e3e48b54ce6eb5cdb14e3a0a6 Author: Behdad Esfahbod Date: Wed Oct 26 18:27:48 2016 +0200 [tests] Add tests for vertical origin with ft and ot font-funcs diff --git a/test/shaping/fonts/sha1sum/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf b/test/shaping/fonts/sha1sum/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf new file mode 100644 index 000..ed2fab9 Binary files /dev/null and b/test/shaping/fonts/sha1sum/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf differ diff --git a/test/shaping/tests/vertical.tests b/test/shaping/tests/vertical.tests index 8276890..3586080 100644 --- a/test/shaping/tests/vertical.tests +++ b/test/shaping/tests/vertical.tests @@ -1 +1,3 @@ fonts/sha1sum/191826b9643e3f124d865d617ae609db6a2ce203.ttf:--direction=t:U+300C:[uni300C.vert=0@-512,-578+0,-1024] +fonts/sha1sum/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ft:U+0041,U+0042:[gid1=0@-654,-2128+0,-2789|gid2=1@-665,-2125+0,-2789] +fonts/sha1sum/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ot:U+0041,U+0042:[gid1=0@-654,-2189+0,-2789|gid2=1@-665,-2189+0,-2789] commit 2b117720c03869c7714304fd7fbfb2b01199bb3a Author: Behdad Esfahbod Date: Wed Oct 26 18:12:50 2016 +0200 Use horizontal ascent as fallback vertical origin diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh index 324cadc..cda97a6 100644 --- a/src/hb-font-private.hh +++ b/src/hb-font-private.hh @@ -337,14 +337,15 @@ struct hb_font_t { } } - /* Internal only */ inline void guess_v_origin_minus_h_origin (hb_codepoint_t glyph, hb_position_t *x, hb_position_t *y) { *x = get_glyph_h_advance (glyph) / 2; -/* TODO use font_extents.ascender */ -*y = y_scale; +/* TODO cache this somehow?! */ +hb_font_extents_t extents; +get_h_extents_with_fallback (&extents); +*y = extents.ascender; } inline void get_glyph_h_origin_with_fallback (hb_codepoint_t glyph, commit a7b32f2057098012b3ab43121397766ae45b3559 Author: Behdad Esfahbod Date: Wed Oct 26 18:08:41 2016 +0200 Move code around diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh index 91d4a58..324cadc 100644 --- a/src/hb-font-private.hh +++ b/src/hb-font-private.hh @@ -296,24 +296,32 @@ struct hb_font_t { /* A bit higher-level, and with fallback */ + inline void get_h_extents_with_fallback (hb_font_extents_t *extents) + { +if (!get_font_h_extents (extents)) +{ + extents->ascender = y_scale * .8; + extents->descender = extents->ascender - y_scale; + extents->line_gap = 0; +} + } + inline void get_v_extents_with_fallback (hb_font_extents_t *extents) + { +if (!get_font_v_extents (extents)) +{ + extents->ascender = x_scale / 2; + extents->descender = extents->ascender - x_scale; + extents->line_gap = 0; +} + } + inline void get_extents_for_direction (hb_direction_t direction, hb_font_extents_t *extents) { -if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) { - if (!get_font_h_extents (extents)) - { - extents->ascender = y_scale * .8; - extents->descender = extents->ascender - y_scale; - extents->line_gap = 0; - } -} else { - if (!get_font_v_extents (extents)) - { - extents->ascender = x_scale / 2; - extents->descender = extents->ascender - x_scale; - extents->line_gap = 0; - } -} +if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) + get_h_extents_with_fallback (extents); +else + get_v_extents_with_fallback (extents); } inline void get_glyph_advance_for_direction (hb_codepoint_t glyph, commit 63635c763dd9393df236f49d491510cca18a1ccc Author: Behdad Esfahbod Date: Wed Oct 26 17:54:04 2016 +0200 [hb-ot-font] Use ascent+descent as fallback vertical advance diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 9fd8d05..20f2f89 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -55,9 +55,10 @@ struct hb_ot_face_metrics_accelerator_t inline void init (hb_face_t *face, hb_tag_t _hea_tag, hb_tag_t _mtx_tag, - hb_tag_t os2_tag) + hb_tag_t os2_tag, + unsigned int default_advance = 0) { -this->default_advance = face->get_upem (); +this->default_advance = default_advance ? default_advance : face->get_upem (); bool got_font_extents = false; if (os2_tag) @@ -391,7 +392,8 @@ _hb_ot_fo
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
BUILD.md|4 Makefile.am |2 configure.ac| 27 + src/Makefile.am | 172 -- src/Makefile.sources| 150 ++ src/hb-ucdn/Makefile.am |6 - src/hb-ucdn/Makefile.sources|4 util/Makefile.am| 34 +- util/Makefile.sources | 32 ++ win32/Makefile.am | 14 ++ win32/Makefile.vc | 52 ++ win32/README.txt| 79 +++ win32/build-rules-msvc.mak | 140 win32/config-msvc.mak | 198 win32/config.h.win32.in | 158 +++ win32/create-lists-msvc.mak | 151 ++ win32/create-lists.bat | 42 win32/detectenv-msvc.mak| 136 +++ win32/generate-msvc.mak | 26 + win32/hb-introspection-msvc.mak | 42 win32/info-msvc.mak | 137 +++ win32/install.mak | 29 + win32/introspection-msvc.mak| 73 ++ 23 files changed, 1541 insertions(+), 167 deletions(-) New commits: commit bdaa784bb610ec65626d63cc068a0958ff5005fc Merge: a168db4 f6ffba6 Author: Behdad Esfahbod Date: Wed Feb 10 11:11:36 2016 +0700 Merge pull request #164 from fanc999/msvc.build Enable Build of HarfBuzz under Visual Studio using NMake Makefiles commit f6ffba634bb33d6d4b051abce9c23fcae280c3fe Author: Chun-wei Fan Date: Wed Dec 9 14:57:15 2015 +0800 MSVC builds: Add support to build DirectWrite shaping backend Add into the NMake Makefiles to build the DirectWrite shaping backend, but as PR #134 mentions, this is considered to be in an experimental state, so don't include this in the build by default for now. This is most probably going to replace the Uniscribe backend eventually, since DirectWrite is meant to be Uniscribe's replacement, and is needed for Windows Store apps if a system shaping API is to be used. diff --git a/win32/README.txt b/win32/README.txt index 1cb965c..e2ead01 100644 --- a/win32/README.txt +++ b/win32/README.txt @@ -68,6 +68,10 @@ ICU: Enables the build HarfBuzz-ICU, which is now the recommended layout engine for ICU (International Components for Unicode), which deprecated ICU LE. Requires the ICU libraries. +DIRECTWRITE: Enable (experimental) DirectWrite platform shaper support, + requires a rather recent Windows SDK, and at least Windows Vista/ + Server 2008 with SP2 and platform update. + PYTHON: Full path to the Python interpretor to be used, if it is not in %PATH%. PERL: Full path to the PERL interpretor to be used, if it is not in %PATH%. diff --git a/win32/config-msvc.mak b/win32/config-msvc.mak index 70f4c1b..e0c6468 100644 --- a/win32/config-msvc.mak +++ b/win32/config-msvc.mak @@ -20,6 +20,9 @@ CAIRO_LIB = cairo.lib # Graphite2 is needed for building SIL Graphite2 support GRAPHITE2_LIB = graphite2.lib +# Directwrite is needed for DirectWrite shaping support +DIRECTWRITE_LIB = dwrite.lib + # Please do not change anything beneath this line unless maintaining the NMake Makefiles # Bare minimum features and sources built into HarfBuzz on Windows HB_DEFINES = @@ -185,4 +188,11 @@ HB_CFLAGS =\ HB_SOURCES = $(HB_SOURCES) $(LIBHB_UCDN_sources) $(HB_UCDN_sources) !endif +!if "$(DIRECTWRITE)" == "1" +HB_CFLAGS = $(HB_CFLAGS) /DHAVE_DIRECTWRITE +HB_SOURCES = $(HB_SOURCES) $(HB_DIRECTWRITE_sources) +HB_HEADERS = $(HB_HEADERS) $(HB_DIRECTWRITE_headers) +HB_DEP_LIBS = $(HB_DEP_LIBS) $(DIRECTWRITE_LIB) +!endif + HB_LIB_CFLAGS = $(HB_CFLAGS) /DHB_EXTERN="__declspec (dllexport) extern" diff --git a/win32/config.h.win32.in b/win32/config.h.win32.in index 4f42b83..73ad205 100644 --- a/win32/config.h.win32.in +++ b/win32/config.h.win32.in @@ -18,6 +18,9 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_DLFCN_H */ +/* Have DirectWrite Library */ +/* #undef HAVE_DIRECTWRITE */ + /* Have simple TrueType Layout backend */ #define HAVE_FALLBACK 1 diff --git a/win32/info-msvc.mak b/win32/info-msvc.mak index c009639..bc85dc9 100644 --- a/win32/info-msvc.mak +++ b/win32/info-msvc.mak @@ -23,6 +23,10 @@ INC_FEATURES = $(INC_FEATURES) FreeType INC_FEATURES = $(INC_FEATURES) Graphite2 !endif +!if "$(DIRECTWRITE)" == "1" +INC_FEATURES = $(INC_FEATURES) DirectWrite +!endif + !if "$(ICU)" == "1" BUILT_LIBRARIES = $(BUILT_LIBRARIES) HarfBuzz-ICU !endif @@ -76,6 +80,9 @@ help: @echo HarfBuzz DLL is built with OpenType, fallback and Uniscribe support @echo with a bundled Unicode implementation (UCDN). @echo == + @echo DIRECTWRITE: + @echo Enable DirectWrite support, requires a recent enough Windows SD
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
.ci/deploy-docs.sh| 25 + .travis.yml |3 docs/HarfBuzz.png |binary docs/Makefile.am | 16 - docs/harfbuzz-docs.xml| 54 +++- docs/usermanual-buffers-language-script-and-direction.xml | 77 + docs/usermanual-ch01.xml | 115 docs/usermanual-ch02.xml | 183 -- docs/usermanual-ch03.xml | 77 - docs/usermanual-ch04.xml | 18 - docs/usermanual-ch05.xml | 13 docs/usermanual-ch06.xml |8 docs/usermanual-fonts-and-faces.xml | 18 + docs/usermanual-glyph-information.xml |8 docs/usermanual-hello-harfbuzz.xml| 183 ++ docs/usermanual-install-harfbuzz.xml | 70 + docs/usermanual-opentype-features.xml | 13 docs/usermanual-what-is-harfbuzz.xml | 115 18 files changed, 564 insertions(+), 432 deletions(-) New commits: commit e5b90c08a4c1f475560209a5e47628f695606d89 Author: Behdad Esfahbod Date: Fri Dec 25 18:41:41 2015 +0100 [travis] Remove secure var I've set up a secure var for behdad/harfbuzz through Travis web interface, no need to set the var here. diff --git a/.ci/deploy-docs.sh b/.ci/deploy-docs.sh index 8c60a22..bbd64df 100755 --- a/.ci/deploy-docs.sh +++ b/.ci/deploy-docs.sh @@ -1,6 +1,6 @@ set -o errexit -o nounset -if [ "$TRAVIS_OS_NAME" == "linux" -a "$CC" == "gcc" -a "$TRAVIS_PULL_REQUEST" == "false" -a "$TRAVIS_BRANCH" == "master" ] +if [ "$TRAVIS_OS_NAME" == "linux" -a "$CC" == "gcc" -a "$TRAVIS_SECURE_ENV_VARS" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" -a "$TRAVIS_BRANCH" == "master" ] then DOCSDIR=build-docs REVISION=$(git rev-parse --short HEAD) diff --git a/.travis.yml b/.travis.yml index 798f5ee..89f4012 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,6 @@ env: - CFLAGS="-Werror --coverage" - CXXFLAGS="-Werror --coverage" - LDFLAGS="--coverage" -- secure: "EysLG1MB6WCvDVpls5jsJAYsXcbHTmSFYl11UlAQCNfU+MBv7qiuOR6im3tM4ISzt4TY+OQXxEktMFRT+8govLR4UWo8dwmZ4P/2GqMbsZNPVSLkbDEy6hVv7xe5X4mp+npHthY1Z1YOLKGAh/u1PymySZz6qAzsCZ6Fq/H5Ri8=" install: - if [ "$TRAVIS_OS_NAME" == "linux" ]; then pip install --user nose; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then pip install --user cpp-coveralls; fi # for coveralls.io code coverage tracking commit e75c1ffdf548185ce1f1df7937f0d028e5e40efe Merge: 6173c2a d25317f Author: Behdad Esfahbod Date: Fri Dec 25 18:21:08 2015 +0100 Merge pull request #199 from behdad/travis-docs Deploy docs to gh-pages branch from Travis builds commit d25317f67f3c5c77f9059961935b0f35cbaa9ac4 Author: Khaled Hosny Date: Wed Dec 23 01:29:48 2015 +0400 Move more docs from FreeDesktop page diff --git a/docs/Makefile.am b/docs/Makefile.am index 05a27db..5e6fd2b 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -75,6 +75,7 @@ content_files=\ usermanual-fonts-and-faces.xml \ usermanual-glyph-information.xml \ usermanual-hello-harfbuzz.xml \ + usermanual-install-harfbuzz.xml \ usermanual-opentype-features.xml \ usermanual-what-is-harfbuzz.xml \ version.xml diff --git a/docs/harfbuzz-docs.xml b/docs/harfbuzz-docs.xml index 49252f7..7d2232f 100644 --- a/docs/harfbuzz-docs.xml +++ b/docs/harfbuzz-docs.xml @@ -7,11 +7,6 @@ HarfBuzz Manual - - This document is for HarfBuzz &version;. - - HarfBuzz @@ -28,7 +23,7 @@ http://cgit.freedesktop.org/harfbuzz/";>here. Also available on https://github.com/behdad/harfbuzz";>github. -See below for release tarballs. +See for release tarballs. The old HarfBuzz codebase, these days known as harfbuzz-old, was @@ -46,6 +41,7 @@ User's manual + @@ -54,6 +50,13 @@ + + +This document is for HarfBuzz &version;. + + + Reference manual Harfbuzz API diff --git a/docs/usermanual-install-harfbuzz.xml b/docs/usermanual-install-harfbuzz.xml new file mode 100644 index 000..be8ac8d --- /dev/null +++ b/docs/usermanual-install-harfbuzz.xml @@ -0,0 +1,70 @@ + + Install Harfbuzz + +Download + + For tarball releases of HarfBuzz, look + http://www.freedesktop.org/software/harfbuzz/release/";>here. + At the same place you will + also find Win32 binary bundles that include libharfbuzz DLL, hb-view.exe, + hb-shape.exe, and all d
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/Makefile.am|1 src/hb-font-private.hh | 39 +- src/hb-font.cc | 102 +++ src/hb-font.h | 62 +++- src/hb-ft.cc | 21 + src/hb-ot-font.cc | 62 +++- src/hb-ot-os2-table.hh | 105 + util/helper-cairo.cc |4 + util/view-cairo.cc | 24 +-- 9 files changed, 399 insertions(+), 21 deletions(-) New commits: commit e1d4d0f1dbd8518b5672245c05d73f22a9ed03ea Merge: 70b33ed 808d3fc Author: Behdad Esfahbod Date: Thu Dec 10 16:56:07 2015 +0100 Merge branch 'font-extents' Fixes https://github.com/behdad/harfbuzz/pull/165 commit 808d3fc0eadd379909f2a0308fd3db474f1efde8 Author: Behdad Esfahbod Date: Thu Dec 10 16:55:16 2015 +0100 [util] Port hb-view to use font metrics from HarfBuzz instead of cairo diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc index 450e5cf..8f30eea 100644 --- a/util/helper-cairo.cc +++ b/util/helper-cairo.cc @@ -75,7 +75,9 @@ helper_cairo_create_scaled_font (const font_options_t *font_opts) hb_font_t *font = hb_font_reference (font_opts->get_font ()); cairo_font_face_t *cairo_face; - FT_Face ft_face = hb_ft_font_get_face (font); + /* We cannot use the FT_Face from hb_font_t, as doing so will confuse hb_font_t because + * cairo will reset the face size. As such, create new face... */ + FT_Face ft_face = NULL;//hb_ft_font_get_face (font); if (!ft_face) { if (!ft_library) diff --git a/util/view-cairo.cc b/util/view-cairo.cc index bdb97bf..f4f2bc5 100644 --- a/util/view-cairo.cc +++ b/util/view-cairo.cc @@ -39,16 +39,14 @@ view_cairo_t::render (const font_options_t *font_opts) int x_sign = font_opts->font_size_x < 0 ? -1 : +1; int y_sign = font_opts->font_size_y < 0 ? -1 : +1; - cairo_scaled_font_t *scaled_font = helper_cairo_create_scaled_font (font_opts); - cairo_font_extents_t font_extents; - cairo_scaled_font_extents (scaled_font, &font_extents); - /* Looks like cairo doesn't negate the sign of font extents even if - * y_scale is negative. This is probably a bug, but that's the way - * it is, and we code for it. Assert, just in case this accidentally - * changes in the future (or is different on non-FreeType cairo font - * backends. */ - assert (font_extents.height >= 0); - double leading = font_extents.height + view_options.line_space; + hb_font_t *font = font_opts->get_font(); + hb_font_extents_t extents; + hb_font_get_extents_for_direction (font, direction, &extents); + + double ascent = y_sign * scalbn ((double) extents.ascender, scale_bits); + double descent = y_sign * -scalbn ((double) extents.descender, scale_bits); + double font_height = y_sign * scalbn ((double) extents.ascender - extents.descender + extents.line_gap, scale_bits); + double leading = font_height + view_options.line_space; /* Calculate surface size. */ double w, h; @@ -64,6 +62,8 @@ view_cairo_t::render (const font_options_t *font_opts) w = MAX (w, x_sign * x_advance); } + cairo_scaled_font_t *scaled_font = helper_cairo_create_scaled_font (font_opts); + /* See if font needs color. */ cairo_content_t content = CAIRO_CONTENT_ALPHA; if (helper_cairo_scaled_font_has_color (scaled_font)) @@ -80,13 +80,13 @@ view_cairo_t::render (const font_options_t *font_opts) if (vertical) cairo_translate (cr, w /* We stack lines right to left */ --font_extents.height * .5 /* "ascent" for vertical */, +-font_height * .5 /* "ascent" for vertical */, y_sign < 0 ? h : 0); else { cairo_translate (cr, x_sign < 0 ? w : 0, -y_sign < 0 ? font_extents.descent : font_extents.ascent); +y_sign < 0 ? descent : ascent); } /* Draw. */ commit 31fa3892947138c7950303ea3719bb5ceb813625 Author: Behdad Esfahbod Date: Thu Dec 10 16:38:29 2015 +0100 [ft] Use ftface->size->metrics for font extent info diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 682acb7..eed1787 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -374,9 +374,9 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED, { const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data; FT_Face ft_face = ft_font->ft_face; - metrics->ascender = ft_face->ascender; - metrics->descender = ft_face->descender; - metrics->line_gap = ft_face->height - (ft_face->ascender - ft_face->descender); + metrics->ascender = ft_face->size->metrics.ascender; + metrics->descender = ft_face->size->metrics.descender; + metrics->line_gap = ft_face->size->metrics.height - (ft_face->size->metrics.ascender - ft_face->size->metrics.descender); if (font->y_scale < 0) { metrics->ascender = -metrics->ascender; commit 3ad16048fdd841f31f1cb98d7ff9ea1871841146 Author: Behdad Esfa
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-buffer-private.hh |6 +++--- src/hb-ot-layout-common-private.hh |2 +- src/hb-ot-layout-private.hh|4 ++-- src/hb-ot-map-private.hh |2 +- src/hb-ot-shape-complex-arabic.cc |3 ++- src/hb-private.hh | 13 - util/ansi-print.cc | 16 +--- util/helper-cairo.cc | 20 ++-- util/options.cc|2 +- util/options.hh| 17 + 10 files changed, 58 insertions(+), 27 deletions(-) New commits: commit e0082ae60dbd87d433f3b2b9d2bfa64b9a4c3663 Author: Behdad Esfahbod Date: Tue Nov 17 18:42:13 2015 -0800 Move things around diff --git a/src/hb-private.hh b/src/hb-private.hh index 32f8d5e..b735c0d 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -119,15 +119,6 @@ extern "C" void hb_free_impl(void *ptr); #define HB_FUNC __func__ #endif -/* Use templates for bitwise ops on enums or MSVC's DEFINE_ENUM_FLAG_OPERATORS */ -#ifdef _MSC_VER -# pragma warning(disable:4200) -# pragma warning(disable:4800) -# define HB_MARK_AS_FLAG_T(flags_t)DEFINE_ENUM_FLAG_OPERATORS (##flags_t##); -#else -# define HB_MARK_AS_FLAG_T(flags_t)template <> class hb_mark_as_flags_t {}; -#endif - /* * Borrowed from https://bugzilla.mozilla.org/show_bug.cgi?id=1215411 * HB_FALLTHROUGH is an annotation to suppress compiler warnings about switch @@ -903,8 +894,17 @@ hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3) /* Enable bitwise ops on enums marked as flags_t */ /* To my surprise, looks like the function resolver is happy to silently cast * one enum to another... So this doesn't provide the type-checking that I - * originally had in mind... :( */ -#ifndef _MSC_VER + * originally had in mind... :(. + * + * On MSVC use DEFINE_ENUM_FLAG_OPERATORS. See: + * https://github.com/behdad/harfbuzz/pull/163 + */ +#ifdef _MSC_VER +# pragma warning(disable:4200) +# pragma warning(disable:4800) +# define HB_MARK_AS_FLAG_T(flags_t)DEFINE_ENUM_FLAG_OPERATORS (##flags_t##); +#else +# define HB_MARK_AS_FLAG_T(flags_t)template <> class hb_mark_as_flags_t {}; template class hb_mark_as_flags_t; template static inline T operator | (T l, T r) { hb_mark_as_flags_t unused HB_UNUSED; return T ((unsigned int) l | (unsigned int) r); } commit dde8cc87bd880bd35baf764820f4c85bd0a58696 Merge: e97835a 167c327 Author: Behdad Esfahbod Date: Tue Nov 17 18:40:10 2015 -0800 Merge pull request #163 from fanc999/msvc.src Update the sources so they will compile under Visual Studio commit 167c3271778cd1a8c4433b9d2230901ce17c099e Author: Chun-wei Fan Date: Mon Nov 9 17:17:56 2015 +0800 Fix build on MSVC >= 2012 Use the DEFINE_ENUM_FLAG_OPERATORS macro in winnt.h on Visual Studio, which defines the bitwise operators for the enumerations that we want to mark as hb_mark_as_flags_t, which will take care of the situation on newer Visual Studio (>= 2012), where the build breaks with C2057 errors as the underlying types of the enumerations is not clear to the compiler when we do a bitwise op within the declaration of the enumerations themselves. Also disable the C4200 (nonstandard extension used : zero-sized array in struct/union) and C4800 ('type' : forcing value to bool 'true' or 'false' (performance warning)) warnings as the C4200 is the intended scenario and C4800 is harmless but is so far an unavoidable side effect of using DEFINE_ENUM_FLAG_OPERATORS. diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh index 67c431d..ceccecd 100644 --- a/src/hb-buffer-private.hh +++ b/src/hb-buffer-private.hh @@ -48,8 +48,8 @@ ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20); ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t)); -template <> class hb_mark_as_flags_t {}; -template <> class hb_mark_as_flags_t {}; +HB_MARK_AS_FLAG_T (hb_buffer_flags_t); +HB_MARK_AS_FLAG_T (hb_buffer_serialize_flags_t); enum hb_buffer_scratch_flags_t { HB_BUFFER_SCRATCH_FLAG_DEFAULT = 0xu, @@ -64,7 +64,7 @@ enum hb_buffer_scratch_flags_t { HB_BUFFER_SCRATCH_FLAG_COMPLEX2 = 0x0400u, HB_BUFFER_SCRATCH_FLAG_COMPLEX3 = 0x0800u, }; -template <> class hb_mark_as_flags_t {}; +HB_MARK_AS_FLAG_T (hb_buffer_scratch_flags_t); /* diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 04958a8..5b21f14 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -581,7 +581,7 @@ struct LookupFlag : USHORT } /* namespace OT */ /* This has to be outside the namespace. */ -template <> class hb_mark_as_flags_t {}; +HB_MARK_AS_FLAG_T (OT::LookupFlag::Flags); namespace OT { struct Lookup diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index 049b232..45897ed 100644 --- a/src/
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-ot-font.cc | 208 +- src/hb-ot-hhea-table.hh | 63 +++-- src/hb-ot-hmtx-table.hh | 35 --- util/helper-cairo-ansi.cc |4 4 files changed, 189 insertions(+), 121 deletions(-) New commits: commit 80f77282264afb1356351024b1f062b2824bba3b Author: Behdad Esfahbod Date: Thu Sep 25 17:59:46 2014 +0300 [util] Fix ansi output when surface is empty diff --git a/util/helper-cairo-ansi.cc b/util/helper-cairo-ansi.cc index 376bf2b..50f9eb4 100644 --- a/util/helper-cairo-ansi.cc +++ b/util/helper-cairo-ansi.cc @@ -63,10 +63,10 @@ helper_cairo_surface_write_to_ansi_stream (cairo_surface_t *surface, * Find the tight image top/bottom and only print in between. */ /* Use corner color as background color. */ - uint32_t bg_color = * (uint32_t *) data; + uint32_t bg_color = data ? * (uint32_t *) data : 0; /* Drop first row while empty */ - while (height) + while (height) { unsigned int i; for (i = 0; i < width; i++) commit 156852991e18e5ac256ee4d6b2916931cc274977 Author: Behdad Esfahbod Date: Thu Sep 25 17:45:49 2014 +0300 [ot-font] Add hb_ot_face_cmap_accelerator_t diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 91df5ca..2af2f54 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -91,14 +91,72 @@ struct hb_ot_face_metrics_accelerator_t } }; +struct hb_ot_face_cmap_accelerator_t +{ + const OT::CmapSubtable *table; + const OT::CmapSubtable *uvs_table; + hb_blob_t *blob; + + inline void init (hb_face_t *face) + { +this->blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_cmap)); +const OT::cmap *cmap = OT::Sanitizer::lock_instance (this->blob); +const OT::CmapSubtable *subtable = NULL; +const OT::CmapSubtable *subtable_uvs = NULL; + +/* 32-bit subtables. */ +if (!subtable) subtable = cmap->find_subtable (3, 10); +if (!subtable) subtable = cmap->find_subtable (0, 6); +if (!subtable) subtable = cmap->find_subtable (0, 4); +/* 16-bit subtables. */ +if (!subtable) subtable = cmap->find_subtable (3, 1); +if (!subtable) subtable = cmap->find_subtable (0, 3); +if (!subtable) subtable = cmap->find_subtable (0, 2); +if (!subtable) subtable = cmap->find_subtable (0, 1); +if (!subtable) subtable = cmap->find_subtable (0, 0); +/* Meh. */ +if (!subtable) subtable = &OT::Null(OT::CmapSubtable); + +/* UVS subtable. */ +if (!subtable_uvs) subtable_uvs = cmap->find_subtable (0, 5); +/* Meh. */ +if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtable); + +this->table = subtable; +this->uvs_table = subtable_uvs; + } + + inline void fini (void) + { +hb_blob_destroy (this->blob); + } + + inline bool get_glyph (hb_codepoint_t unicode, +hb_codepoint_t variation_selector, +hb_codepoint_t *glyph) const + { +if (unlikely (variation_selector)) +{ + switch (this->uvs_table->get_glyph_variant (unicode, + variation_selector, + glyph)) + { + case OT::GLYPH_VARIANT_NOT_FOUND: return false; + case OT::GLYPH_VARIANT_FOUND: return true; + case OT::GLYPH_VARIANT_USE_DEFAULT: break; + } +} + +return this->table->get_glyph (unicode, glyph); + } +}; + + struct hb_ot_font_t { + hb_ot_face_cmap_accelerator_t cmap; hb_ot_face_metrics_accelerator_t h_metrics; hb_ot_face_metrics_accelerator_t v_metrics; - - const OT::CmapSubtable *cmap; - const OT::CmapSubtable *cmap_uvs; - hb_blob_t *cmap_blob; }; @@ -113,35 +171,9 @@ _hb_ot_font_create (hb_font_t *font) unsigned int upem = face->get_upem (); + ot_font->cmap.init (face); ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, upem>>1); - /* TODO Can we do this lazily? */ - ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, upem); - - ot_font->cmap_blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_cmap)); - const OT::cmap *cmap = OT::Sanitizer::lock_instance (ot_font->cmap_blob); - const OT::CmapSubtable *subtable = NULL; - const OT::CmapSubtable *subtable_uvs = NULL; - - /* 32-bit subtables. */ - if (!subtable) subtable = cmap->find_subtable (3, 10); - if (!subtable) subtable = cmap->find_subtable (0, 6); - if (!subtable) subtable = cmap->find_subtable (0, 4); - /* 16-bit subtables. */ - if (!subtable) subtable = cmap->find_subtable (3, 1); - if (!subtable) subtable = cmap->find_subtable (0, 3); - if (!subtable) subtable = cmap->find_subtable (0, 2); - if (!subtable) subtable = cmap->find_subtable (0, 1); - if (!subtable) subtable = cmap->find_subtable (0, 0); - /* Meh. */ - if (!subtable) subtable = &OT::Null(OT::CmapSubtable); - - /* UVS subtable. */ - if (!subtable_uvs) subtable_uvs = cmap->find_subtable (0, 5); - /* Meh. */ - if (!subtable_uvs)
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-private.hh|9 src/hb-shape-plan.cc | 53 +++ 2 files changed, 50 insertions(+), 12 deletions(-) New commits: commit 30eed75de24ac0b6648a72d98d10bb24a563d7ef Author: Behdad Esfahbod Date: Tue Aug 12 17:15:09 2014 -0400 [shape-plan] Fix typo! The only effect is, if shaper_list was not NULL and no shaper was found, we now don't insert anything into cache and return earlier. diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index e5ccc16..2166173 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -435,7 +435,7 @@ hb_shape_plan_create_cached (hb_face_t *face, #include "hb-shaper-list.hh" #undef HB_SHAPER_IMPLEMENT -if (unlikely (!proposal.shaper_list)) +if (unlikely (!proposal.shaper_func)) return hb_shape_plan_get_empty (); } commit dc9aba6fc53898acd7281b118cec0355d61b1df2 Author: Behdad Esfahbod Date: Tue Aug 12 17:14:36 2014 -0400 [shape-plan] Better debug messages diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index 32658f3..e5ccc16 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -115,8 +115,9 @@ hb_shape_plan_create (hb_face_t *face, unsigned int num_user_features, const char * const*shaper_list) { - DEBUG_MSG_FUNC (SHAPE_PLAN, face, - "num_features=%d shaper_list=%p", + DEBUG_MSG_FUNC (SHAPE_PLAN, NULL, + "face=%p num_features=%d shaper_list=%p", + face, num_user_features, shaper_list); @@ -404,8 +405,9 @@ hb_shape_plan_create_cached (hb_face_t *face, unsigned int num_user_features, const char * const*shaper_list) { - DEBUG_MSG_FUNC (SHAPE_PLAN, face, - "num_user_features=%d shaper_list=%p", + DEBUG_MSG_FUNC (SHAPE_PLAN, NULL, + "face=%p num_features=%d shaper_list=%p", + face, num_user_features, shaper_list); @@ -442,7 +444,10 @@ retry: hb_face_t::plan_node_t *cached_plan_nodes = (hb_face_t::plan_node_t *) hb_atomic_ptr_get (&face->shape_plans); for (hb_face_t::plan_node_t *node = cached_plan_nodes; node; node = node->next) if (hb_shape_plan_matches (node->shape_plan, &proposal)) +{ + DEBUG_MSG_FUNC (SHAPE_PLAN, node->shape_plan, "fulfilled from cache"); return hb_shape_plan_reference (node->shape_plan); +} /* Not found. */ @@ -465,6 +470,7 @@ retry: free (node); goto retry; } + DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan, "inserted into cache"); return hb_shape_plan_reference (shape_plan); } commit e956c65bf724a8403471362288d2361361b6ac58 Author: Behdad Esfahbod Date: Tue Aug 12 17:03:27 2014 -0400 [shape-plan] Simplify macro diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index 23beda1..32658f3 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -418,27 +418,21 @@ hb_shape_plan_create_cached (hb_face_t *face, }; if (shaper_list) { -/* Choose shaper. Adapted from hb_shape_plan_plan(). */ -#define HB_SHAPER_PLAN(shaper) \ - { \ - if (hb_##shaper##_shaper_face_data_ensure (face)) \ - { \ - proposal.shaper_func = _hb_##shaper##_shape; \ - break; \ - } \ - } - +/* Choose shaper. Adapted from hb_shape_plan_plan(). + * Must choose shaper exactly the same way as that function. */ for (const char * const *shaper_item = shaper_list; *shaper_item; shaper_item++) if (0) ; #define HB_SHAPER_IMPLEMENT(shaper) \ - else if (0 == strcmp (*shaper_item, #shaper)) \ - HB_SHAPER_PLAN (shaper) + else if (0 == strcmp (*shaper_item, #shaper) && \ + hb_##shaper##_shaper_face_data_ensure (face)) \ + { \ + proposal.shaper_func = _hb_##shaper##_shape; \ + break; \ + } #include "hb-shaper-list.hh" #undef HB_SHAPER_IMPLEMENT -#undef HB_SHAPER_PLAN - if (unlikely (!proposal.shaper_list)) return hb_shape_plan_get_empty (); } commit 29e25550ce8fee3fecc42d20a45ce9c212dc59df Author: Behdad Esfahbod Date: Tue Aug 12 17:02:59 2014 -0400 Fix gcc warning diff --git a/src/hb-private.hh b/src/hb-private.hh index ab18274..80fd6c4 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -628,6 +628,15 @@ _hb_debug_msg_va (const char *what, unsigned int level, int level_dir, const char *message, + va_list ap) HB_PRINTF_FUNC(7, 0); +template static inline void +_hb_debug_msg_va (const char *what, + const void *obj, + const char *func, + bool indented, +
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-common.cc |4 ++- src/hb-open-type-private.hh| 26 src/hb-ot-cmap-table.hh| 40 ++--- src/hb-ot-layout-common-private.hh |4 +-- src/hb-private.hh |2 - src/hb-shape-plan.cc |4 +-- 6 files changed, 51 insertions(+), 29 deletions(-) New commits: commit f1a72fe7bf863535ec09b559cc0bd878fd0799f2 Author: Behdad Esfahbod Date: Wed Jun 4 19:00:29 2014 -0400 [ot-font] Fix cmap EncodingRecord cmp order diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index b7c89ce..e21baed 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -332,12 +332,12 @@ struct CmapSubtable struct EncodingRecord { - int cmp (const EncodingRecord &other) const + inline int cmp (const EncodingRecord &other) const { int ret; -ret = other.platformID.cmp (platformID); +ret = platformID.cmp (other.platformID); if (ret) return ret; -ret = other.encodingID.cmp (encodingID); +ret = encodingID.cmp (other.encodingID); if (ret) return ret; return 0; } @@ -381,8 +381,12 @@ struct cmap encodingRecord.sanitize (c, this)); } - USHORT version;/* Table version number (0). */ - ArrayOf encodingRecord; /* Encoding tables. */ + USHORT version;/* Table version number (0). */ + /* Note: We can use the Sorted array variant, but since it + * has no performance implications, we use non-sorted array and + * as such accept fonts with unsorted subtable list. */ + /*Sorted*/ArrayOf + encodingRecord; /* Encoding tables. */ public: DEFINE_SIZE_ARRAY (4, encodingRecord); }; commit ce34f0b07e5324ed52e6e2c43000c2b09ee010d4 Author: Behdad Esfahbod Date: Wed Jun 4 18:57:46 2014 -0400 [ot-font] Use binary search for format12 cmap subtable diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index fcdee02..c4446ce 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -985,6 +985,10 @@ struct GenericSortedArrayOf : GenericArrayOf template struct SortedArrayOf : GenericSortedArrayOf {}; +/* A sorted array with a ULONG number of elements. */ +template +struct LongSortedArrayOf : GenericSortedArrayOf {}; + } /* namespace OT */ diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 65434c4..b7c89ce 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -264,7 +264,7 @@ struct CmapSubtableLongSegmented USHORT reserved; /* Reserved; set to 0. */ ULONGlength; /* Byte length of this subtable. */ ULONGlanguage; /* Ignore. */ - LongArrayOf + LongSortedArrayOf groups; /* Groupings. */ public: DEFINE_SIZE_ARRAY (16, groups); commit 257d1adfa1b3422c511c55e641840a6e31ec6008 Author: Behdad Esfahbod Date: Wed Jun 4 18:47:55 2014 -0400 [ot-font] Work around broken cmap subtable format 4 length Roboto was hitting this. FreeType also has pretty much the same code for this, in ttcmap.c:tt_cmap4_validate(): /* in certain fonts, the `length' field is invalid and goes */ /* out of bound. We try to correct this here...*/ if ( table + length > valid->limit ) { if ( valid->level >= FT_VALIDATE_TIGHT ) FT_INVALID_TOO_SHORT; length = (FT_UInt)( valid->limit - table ); } diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index abaceaa..65434c4 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -131,11 +131,25 @@ struct CmapSubtableFormat4 return true; } - inline bool sanitize (hb_sanitize_context_t *c) { + inline bool sanitize (hb_sanitize_context_t *c) + { TRACE_SANITIZE (this); -return TRACE_RETURN (c->check_struct (this) && -c->check_range (this, length) && -16 + 4 * (unsigned int) segCountX2 < length); +if (unlikely (!c->check_struct (this))) + return TRACE_RETURN (false); + +if (unlikely (!c->check_range (this, length))) +{ + /* Some broken fonts have too long of a "length" value. + * If that is the case, just change the value to truncate + * the subtable at the end of the blob. */ + uint16_t new_length = (uint16_t) MIN ((uintptr_t) 65535, + (uintptr_t) (c->end - +(char *) this)); + if (!c->try_set (&length, new_length)) + return TRACE_RETURN (false); +} + +return TRACE_RETURN (16 + 4 * (unsigned int) segCountX2 <= length); } protected: commit 51f563579b94e1ee23ced9bbcc7dd3341535ce72 Author: Behdad Esfahbod Date: Wed Jun 4 18:42:32 2014 -0400 Move try_set to sanitize contex
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-ot-shape-complex-hangul.cc | 256 +- src/hb-unicode-private.hh | 15 +- 2 files changed, 230 insertions(+), 41 deletions(-) New commits: commit 0596343bfeb80ad6b19d459654edf7dfded6affe Merge: 62cb28d 83d7e79 Author: Behdad Esfahbod Date: Wed Jan 22 04:43:51 2014 -0800 Merge pull request #13 from jfkthame/hangul-shaper Tone-mark reordering and improved Old Hangul support commit 83d7e7915a5eaa8ff4c7014c319844e7dffd8225 Author: Jonathan Kew Date: Mon Jan 20 19:49:47 2014 + [hangul] Fix ordering of dotted circle with Hangul tone mark (reported by Dohyun Kim). diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc index 6df6c3f..47aa44f 100644 --- a/src/hb-ot-shape-complex-hangul.cc +++ b/src/hb-ot-shape-complex-hangul.cc @@ -214,7 +214,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan, if (font->has_glyph (0x25cc)) { hb_codepoint_t chars[2]; - if (is_zero_width_char (font, u)) { + if (!is_zero_width_char (font, u)) { chars[0] = u; chars[1] = 0x25cc; } else { commit deef1862657d55b7ae8d45f4eecbe45c80785c4e Author: Jonathan Kew Date: Mon Jan 20 10:38:27 2014 + [hangul] Don't force zero-width for marks - this is not wanted for the Jamo Filler glyphs. diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc index 710df32..6df6c3f 100644 --- a/src/hb-ot-shape-complex-hangul.cc +++ b/src/hb-ot-shape-complex-hangul.cc @@ -412,6 +412,6 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hangul = NULL, /* decompose */ NULL, /* compose */ setup_masks_hangul, /* setup_masks */ - HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT, + HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE, false, /* fallback_position */ }; commit 391934db0a171aeb2057ebcd4a38ed81621e7393 Author: Jonathan Kew Date: Mon Jan 20 10:37:32 2014 + [unicode] Exclude the Jamo Filler characters from Default_Ignorable, as some fonts want these to be visible/spacing glyphs. diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh index cd54cf7..ba193e8 100644 --- a/src/hb-unicode-private.hh +++ b/src/hb-unicode-private.hh @@ -134,10 +134,10 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE * 6.3 is also added manually. The new Unicode 6.3 bidi formatting * characters are encoded in a block that was Default_Ignorable already. * - * Note: While U+115F and U+1160 are Default_Ignorable, we do NOT want to - * hide them, as the way Uniscribe has implemented them is with regular - * spacing glyphs, and that's the way fonts are made to work. As such, - * we make exceptions for those two. + * Note: While U+115F, U+1160, U+3164 and U+FFA0 are Default_Ignorable, + * we do NOT want to hide them, as the way Uniscribe has implemented them + * is with regular spacing glyphs, and that's the way fonts are made to work. + * As such, we make exceptions for those four. * * Gathered from: * http://unicode.org/cldr/utility/list-unicodeset.jsp?a=[:DI:]&abb=on&ucd=on&esc=on @@ -159,10 +159,10 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE * 200B..200F ;RIGHT-TO-LEFT MARK * 202A..202E ;RIGHT-TO-LEFT OVERRIDE * 2060..206F ;NOMINAL DIGIT SHAPES - * 3164 ;HANGUL FILLER + * #3164 ;HANGUL FILLER * FE00..FE0F ;VARIATION SELECTOR-16 * FEFF ;ZERO WIDTH NO-BREAK SPACE - * FFA0 ;HALFWIDTH HANGUL FILLER + * #FFA0 ;HALFWIDTH HANGUL FILLER * FFF0..FFF8 ; * 1D173..1D17A ;MUSICAL SYMBOL END PHRASE * E..E0FFF ; @@ -184,9 +184,8 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE case 0x20: return hb_in_ranges (ch, 0x200B, 0x200F, 0x202A, 0x202E, 0x2060, 0x206F); - case 0x31: return unlikely (ch == 0x3164); case 0xFE: return hb_in_range (ch, 0xFE00, 0xFE0F) || ch == 0xFEFF; - case 0xFF: return hb_in_range (ch, 0xFFF0, 0xFFF8) || ch == 0xFFA0; + case 0xFF: return hb_in_range (ch, 0xFFF0, 0xFFF8); default: return false; } } commit 7244b3fc3bf9757dd094709d36bea68682264e20 Author: Jonathan Kew Date: Mon Jan 20 10:35:51 2014 + [hangul] Reorder Hangul tone mark to beginning of syllable, unless font implements it using a zero-width glyph. diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc index f37ed85..710df32 100644 --- a/src/hb-ot-shape-complex-hangul.cc +++ b/src/hb-ot-shape-complex-hangul.cc @@ -105,6 +105,8 @@ data_destroy_hangul (void *data) #define isV(u) (hb_in_ranges ((u), 0x1160, 0x11A7, 0xD7B0, 0xD7C6)) #define isT(u) (hb_in_ranges ((u), 0x11A8, 0x11FF, 0xD7CB, 0xD7FB)) +#define isHangulTone(u) (hb_in_range ((u), 0x302e, 0x302f)) + /* buffer var allocations */ #define hangul_shaping_feature() complex_var_u8_0() /* hangul jamo shaping featu
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-set-private.hh | 112 +++--- 1 file changed, 61 insertions(+), 51 deletions(-) New commits: commit f7466ee76f2bd3812209426e2c39fe517227406d Author: Behdad Esfahbod Date: Wed Apr 17 18:20:44 2013 -0400 Remove hb_set_digest_common_bits_t Was unused. diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh index 8128a69..c6099cc 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set-private.hh @@ -40,44 +40,6 @@ * queries. As a result, our filters have much higher. */ -struct hb_set_digest_common_bits_t -{ - ASSERT_POD (); - - typedef unsigned int mask_t; - - inline void init (void) { -mask = ~0; -value = (mask_t) -1; - } - - inline void add (hb_codepoint_t g) { -if (unlikely (value == (mask_t) -1)) { - value = g; - return; -} - -mask ^= (g & mask) ^ value; -value &= mask; - } - - inline void add_range (hb_codepoint_t a, hb_codepoint_t b) { -add (a); -/* The negation here stands for ~(x-1). */ -mask_t upper_bits = -(1 << _hb_bit_storage (a ^ b)); -mask &= upper_bits; -value &= upper_bits; - } - - inline bool may_have (hb_codepoint_t g) const { -return (g & mask) == value; - } - - private: - mask_t mask; - mask_t value; -}; - template struct hb_set_digest_lowest_bits_t { commit 0d5798a137b52d9be7ef88c79e59f9bf01d54f3b Author: Behdad Esfahbod Date: Wed Apr 17 18:19:21 2013 -0400 Improve hb_set_digest_t Make Amiri rendering faster a whopping 45% again! Speends up pretty much anything I tested. diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh index cc5d7e0..8128a69 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set-private.hh @@ -167,11 +167,29 @@ struct hb_set_digest_combiner_t tail_t tail; }; -typedef hb_set_digest_combiner_t< - hb_set_digest_common_bits_t, - hb_set_digest_lowest_bits_t - > - hb_set_digest_t; + +/* + * hb_set_digest_t + * + * This is a combination of digests that performs "best". + * There is not much science to this: it's a result of intuition + * and testing. + */ +typedef hb_set_digest_combiner_t +< + hb_set_digest_lowest_bits_t, + hb_set_digest_combiner_t + < +hb_set_digest_lowest_bits_t, +hb_set_digest_lowest_bits_t + > +> hb_set_digest_t; + + + +/* + * hb_set_t + */ /* TODO Make this faster and memmory efficient. */ commit c7851efcd3a1e5317ab4ea57535cb755bace0848 Author: Behdad Esfahbod Date: Wed Apr 17 17:45:39 2013 -0400 Templatize hb_set_digest_lowest_bits_t filter diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh index e50d7bc..cc5d7e0 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set-private.hh @@ -78,11 +78,21 @@ struct hb_set_digest_common_bits_t mask_t value; }; +template struct hb_set_digest_lowest_bits_t { ASSERT_POD (); - typedef unsigned long mask_t; + static const unsigned int num_bits = 0 ++ (sizeof (mask_t) >= 1 ? 3 : 0) ++ (sizeof (mask_t) >= 2 ? 1 : 0) ++ (sizeof (mask_t) >= 4 ? 1 : 0) ++ (sizeof (mask_t) >= 8 ? 1 : 0) ++ (sizeof (mask_t) >= 16? 1 : 0) ++ 0; + + ASSERT_STATIC (shift < sizeof (hb_codepoint_t) * 8); + ASSERT_STATIC (shift + num_bits <= sizeof (hb_codepoint_t) * 8); inline void init (void) { mask = 0; @@ -93,7 +103,7 @@ struct hb_set_digest_lowest_bits_t } inline void add_range (hb_codepoint_t a, hb_codepoint_t b) { -if (b - a >= sizeof (mask_t) * 8 - 1) +if ((b >> shift) - (a >> shift) >= sizeof (mask_t) * 8 - 1) mask = (mask_t) -1; else { mask_t ma = mask_for (a); @@ -108,7 +118,10 @@ struct hb_set_digest_lowest_bits_t private: - static inline mask_t mask_for (hb_codepoint_t g) { return ((mask_t) 1) << (g & (sizeof (mask_t) * 8 - 1)); } + static inline mask_t mask_for (hb_codepoint_t g) + { +return ((mask_t) 1) << ((g >> shift) & (sizeof (mask_t) * 8 - 1)); + } mask_t mask; }; @@ -156,7 +169,7 @@ struct hb_set_digest_combiner_t typedef hb_set_digest_combiner_t< hb_set_digest_common_bits_t, - hb_set_digest_lowest_bits_t + hb_set_digest_lowest_bits_t > hb_set_digest_t; commit 0edd0fd255790471118fae1fd7a1309a2b77cf62 Author: Behdad Esfahbod Date: Wed Apr 17 17:26:56 2013 -0400 Add comment diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh index fee09cf..e50d7bc 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set-private.hh @@ -32,6 +32,14 @@ #include "hb-object-private.hh" +/* + * The set digests here implement various "filters" that support + * "approximate member query". Conceptually these are like Bloom + * Filter and Quotient Filter, however, much smaller, faster, and + * designed to fit the requirements of our uses for glyph coverage + * queries.
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-atomic-private.hh | 14 --- src/hb-ft.cc |9 - src/hb-open-type-private.hh |2 src/hb-ot-layout-gpos-table.hh | 105 +++ src/hb-ot-layout-gsub-table.hh | 159 +-- src/hb-ot-layout-gsubgpos-private.hh | 36 +++ src/hb-private.hh|8 + 7 files changed, 162 insertions(+), 171 deletions(-) New commits: commit 190e19e6842875c7a487c66235300ee6b42fb5da Author: Behdad Esfahbod Date: Sat Mar 9 20:30:22 2013 -0500 [ft] Remove TODO items that I'm not going to fix diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 44b71d2..978230c 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -53,12 +53,7 @@ * * - We don't handle / allow for emboldening / obliqueing. * - * - Rounding, etc? - * - * - In the future, we should add constructors to create fonts in font space. - * - * - I believe transforms are not correctly implemented. FreeType does not - * provide any API to get to the transform/delta set on the face. :( + * - In the future, we should add constructors to create fonts in font space? * * - FT_Load_Glyph() is exteremely costly. Do something about it? */ commit 392ee97431b368ee74e1b521fd539b69d2efadfb Author: Behdad Esfahbod Date: Sat Mar 9 20:27:55 2013 -0500 [ft] Remove TODO item re FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH That flag is redundant, deprecated, and ignored since April 2011. From FreeType git log: commit 8c82ec5b17d0cfc9b0876a2d848acc207a62a25a Author: Behdad Esfahbod Date: Thu Apr 21 08:21:37 2011 +0200 Always ignore global advance. This makes FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH redundant, deprecated, and ignored. The new behavior is what every major user of FreeType has been requesting. Global advance is broken in many CJK fonts. Just ignoring it by default makes most sense. * src/truetype/ttdriver.c (tt_get_advances), src/truetype/ttgload.c (TT_Get_HMetrics, TT_Get_VMetrics, tt_get_metrics, compute_glyph_metrics, TT_Load_Glyph), src/truetype/ttgload.h: Implement it. * docs/CHANGES: Updated. diff --git a/src/hb-ft.cc b/src/hb-ft.cc index a25d5a4..44b71d2 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -60,8 +60,6 @@ * - I believe transforms are not correctly implemented. FreeType does not * provide any API to get to the transform/delta set on the face. :( * - * - Always use FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH? - * * - FT_Load_Glyph() is exteremely costly. Do something about it? */ commit c5d91f39802078fc6f6de71940739ec4d04eca07 Author: Behdad Esfahbod Date: Sat Mar 9 04:34:21 2013 -0500 Add hb_auto_array_t diff --git a/src/hb-private.hh b/src/hb-private.hh index 0f652ad..ff1e85d 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -376,6 +376,14 @@ struct hb_prealloced_array_t } }; +#define HB_AUTO_ARRAY_PREALLOCED 64 +template +struct hb_auto_array_t : hb_prealloced_array_t +{ + hb_auto_array_t (void) { hb_prealloced_array_t::init (); } + ~hb_auto_array_t (void) { hb_prealloced_array_t::finish (); } +}; + #define HB_LOCKABLE_SET_INIT {HB_PREALLOCED_ARRAY_INIT} template commit ee5464d17fa4c59f5adaaa13dde70dd5264dbc64 Author: Behdad Esfahbod Date: Sat Mar 9 01:59:30 2013 -0500 [OTLayout] Move code around diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 1fe3f6f..4413927 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1434,22 +1434,6 @@ struct PosLookup : Lookup inline const PosLookupSubTable& get_subtable (unsigned int i) const { return this+CastR > (subTable)[i]; } - template - inline typename context_t::return_t dispatch (context_t *c) const - { -TRACE_DISPATCH (this); -unsigned int lookup_type = get_type (); -unsigned int count = get_subtable_count (); -for (unsigned int i = 0; i < count; i++) { - typename context_t::return_t r = get_subtable (i).dispatch (c, lookup_type); - if (c->stop_sublookup_iteration (r)) -return TRACE_RETURN (r); -} -return TRACE_RETURN (c->default_return_value ()); - } - template - static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index); - inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); @@ -1507,6 +1491,23 @@ struct PosLookup : Lookup return ret; } + template + static inline typename context_t::return_t dispatch_recurse_func (context_t *c, unsigned int lookup_index); + + template + inline typename context_t::return_t dispatch (context_t *c) const + { +TRACE_DISPATCH (this); +unsigned int lookup_type = get_type (); +unsigned int count = get_subtable_count (); +for (unsigned int i =
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/Makefile.am | 14 src/hb-ot-layout-gpos-table.hh | 14 src/hb-ot-layout-gsubgpos-private.hh | 53 src/hb-ot-shape-complex-indic.cc |5 src/hb-ot-shape-complex-myanmar-machine.rl | 127 ++ src/hb-ot-shape-complex-myanmar.cc | 599 ++ src/hb-ot-shape-complex-private.hh |5 src/hb-unicode-private.hh |3 test/shaping/texts/in-tree/MANIFEST |1 test/shaping/texts/in-tree/shaper-indic/south-east-asian/MANIFEST |1 test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/MANIFEST |1 test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/MANIFEST |2 test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/misc.txt |1 test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/utn11.txt | 34 test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-thai/misc/MANIFEST |1 test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-thai/misc/misc.txt | 11 test/shaping/texts/in-tree/shaper-myanmar/script-myanmar/MANIFEST |1 test/shaping/texts/in-tree/shaper-myanmar/script-myanmar/misc/MANIFEST |2 test/shaping/texts/in-tree/shaper-myanmar/script-myanmar/misc/misc.txt |1 test/shaping/texts/in-tree/shaper-myanmar/script-myanmar/misc/utn11.txt | 34 test/shaping/texts/in-tree/shaper-thai/script-thai/misc/MANIFEST |1 test/shaping/texts/in-tree/shaper-thai/script-thai/misc/misc.txt | 11 22 files changed, 825 insertions(+), 97 deletions(-) New commits: commit 1c8654ead41ca746d577549c92d2a41c594ab639 Author: Behdad Esfahbod Date: Mon Feb 11 14:27:02 2013 -0500 [Myanmar] Prevent reordering between Asat and Dot below Implemented as a hack for now. Myanmar failures down from 23 to 15. MYANMAR: 1123868 out of 1123883 tests passed. 15 failed (0.00133466%) The remaining 15 cases are all where the syllable is wrong according to the OpenType spec. We insert dottedcircle. Uniscribe fails to do that, but it also fails to reorder the prebase-reordering medial-Ra. So it gets it wrong. diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh index 7be4b04..724c6f9 100644 --- a/src/hb-unicode-private.hh +++ b/src/hb-unicode-private.hh @@ -107,6 +107,9 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE unsigned int modified_combining_class (hb_codepoint_t unicode) { +/* XXX This hack belongs to the Myanmar shaper. */ +if (unicode == 0x1037) unicode = 0x103A; + return _hb_modified_combining_class[combining_class (unicode)]; } commit bed687f886b8def06642ad986648e9149a935add Author: Behdad Esfahbod Date: Mon Feb 11 14:24:03 2013 -0500 Shuffle test data around diff --git a/test/shaping/texts/in-tree/MANIFEST b/test/shaping/texts/in-tree/MANIFEST index 41aa748..a668081 100644 --- a/test/shaping/texts/in-tree/MANIFEST +++ b/test/shaping/texts/in-tree/MANIFEST @@ -2,4 +2,5 @@ shaper-arabic shaper-default shaper-hangul shaper-indic +shaper-myanmar shaper-thai diff --git a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/MANIFEST b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/MANIFEST index 86c5b79..5abc7e9 100644 --- a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/MANIFEST +++ b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/MANIFEST @@ -1,3 +1,2 @@ script-khmer -script-myanmar script-thai diff --git a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/MANIFEST b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/MANIFEST deleted file mode 100644 index b8752e7..000 --- a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/MANIFEST +++ /dev/null @@ -1 +0,0 @@ -misc diff --git a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/MANIFEST b/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/MANIFEST deleted file mode 100644 index 7f461ee..000 --- a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/MANIFEST +++ /dev/null @@ -1,2 +0,0 @@ -misc.txt -utn11.txt diff --git a/test/shaping/texts/in-tree/shaper-indic/south-east-asian/script-myanmar/misc/misc.txt b/test/shaping/texts/in-tree/shaper-indic/south-east-a
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
TODO |2 -- src/hb-buffer.cc |4 ++-- src/hb-shape.h |2 +- util/hb-shape.cc |6 +++--- util/helper-cairo.cc | 30 +- util/helper-cairo.hh |1 + util/options.cc |9 - util/options.hh |5 - util/view-cairo.hh |2 +- 9 files changed, 49 insertions(+), 12 deletions(-) New commits: commit 3cdce6497b2b9aeb2841bf077daa9dd9b196429d Author: Behdad Esfahbod Date: Fri Dec 21 16:54:22 2012 -0500 Remove TODO that I don't intend to fix diff --git a/TODO b/TODO index e3abcd1..27ff868 100644 --- a/TODO +++ b/TODO @@ -72,7 +72,6 @@ hb-view / hb-shape enhancements: === - Add --width, --height, --auto-size, --align, etc? -- --features="init=medi=isol=fina=0" Tests to write: commit 6f69fa283e0a488da811df78bc83c41ed248b688 Author: Behdad Esfahbod Date: Fri Dec 21 16:51:15 2012 -0500 Minor diff --git a/src/hb-shape.h b/src/hb-shape.h index 90a188d..10a35cb 100644 --- a/src/hb-shape.h +++ b/src/hb-shape.h @@ -52,7 +52,7 @@ hb_bool_t hb_feature_from_string (const char *str, int len, hb_feature_t *feature); -/* something like 128 bytes is more than enough. +/* Something like 128 bytes is more than enough. * nul-terminates. */ void hb_feature_to_string (hb_feature_t *feature, commit f4abcbfc628718bb276363746440df06e7658f6e Author: Behdad Esfahbod Date: Fri Dec 21 16:48:51 2012 -0500 Minor diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 0a5600b..4b644e4 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -1071,8 +1071,8 @@ hb_buffer_normalize_glyphs (hb_buffer_t *buffer) */ static const char *serialize_formats[] = { - "TEXT", - "JSON", + "text", + "json", NULL }; commit 4a765f092d71bb4adeb468c004987a9121d39db5 Author: Behdad Esfahbod Date: Fri Dec 21 16:48:47 2012 -0500 Minor diff --git a/util/hb-shape.cc b/util/hb-shape.cc index df8524f..852f9cf 100644 --- a/util/hb-shape.cc +++ b/util/hb-shape.cc @@ -32,7 +32,7 @@ struct output_buffer_t { output_buffer_t (option_parser_t *parser) : options (parser, -g_strjoinv (" / ", (gchar**) hb_buffer_serialize_list_formats ())), +g_strjoinv ("/", (gchar**) hb_buffer_serialize_list_formats ())), format (parser) {} void init (const font_options_t *font_opts) commit 9815a88111072aa51e78e258c5f660993b47d4df Author: Behdad Esfahbod Date: Fri Dec 21 16:46:53 2012 -0500 [util] List supported output formats in --help output diff --git a/util/hb-shape.cc b/util/hb-shape.cc index adbb034..df8524f 100644 --- a/util/hb-shape.cc +++ b/util/hb-shape.cc @@ -31,7 +31,8 @@ struct output_buffer_t { output_buffer_t (option_parser_t *parser) - : options (parser), + : options (parser, +g_strjoinv (" / ", (gchar**) hb_buffer_serialize_list_formats ())), format (parser) {} void init (const font_options_t *font_opts) @@ -49,8 +50,7 @@ struct output_buffer_t { if (options.explicit_output_format) fail (false, "Unknown output format `%s'; supported formats are: %s", - options.output_format, - g_strjoinv (" / ", (gchar**) hb_buffer_serialize_list_formats ())); + options.output_format, options.supported_formats); else /* Just default to TEXT if not explicitly requested and the * file extension is not recognized. */ diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc index ee64b00..bc44e8e 100644 --- a/util/helper-cairo.cc +++ b/util/helper-cairo.cc @@ -246,7 +246,7 @@ stdio_write_func (void*closure, return CAIRO_STATUS_SUCCESS; } -static const char helper_cairo_supported_formats[] = +const char helper_cairo_supported_formats[] = "ansi" #ifdef CAIRO_HAS_PNG_FUNCTIONS "/png" diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh index 2f2c9d4..b2ac9e4 100644 --- a/util/helper-cairo.hh +++ b/util/helper-cairo.hh @@ -36,6 +36,7 @@ cairo_scaled_font_t * helper_cairo_create_scaled_font (const font_options_t *font_opts, double font_size); +extern const char helper_cairo_supported_formats[]; cairo_t * helper_cairo_create_context (double w, double h, diff --git a/util/options.cc b/util/options.cc index 6246654..17ad8e6 100644 --- a/util/options.cc +++ b/util/options.cc @@ -367,10 +367,17 @@ text_options_t::add_options (option_parser_t *parser) void output_options_t::add_options (option_parser_t *parser) { + const char *text; + + if (NULL == supported_formats) +text = "Set output format"; + else +text = g_strdup_printf ("Set output format\n\nSupported formats are: %s", supported_formats); + GOptionEntry entries[] = { {"output-file",0, 0, G_OPTION_ARG_STRING, &this->output_file, "
Re: [HarfBuzz] harfbuzz: Branch 'master' - 6 commits
On Mon, Dec 17, 2012 at 11:27:06PM -0500, Behdad Esfahbod wrote: > On 12-12-12 09:00 PM, Khaled Hosny wrote: > > On Wed, Dec 12, 2012 at 08:39:26AM -0800, Behdad Esfahbod wrote: > >> We still don't look for the old incorrect place of the featureParams. > >> I'll wait till someone actually complains about it... > > > > Actually the first font I tested was an old-AFDKO broken one, so I’m > > already complaining :) > > Should be all fixed in master now. All fine now, so XeTeX port to HarfBuzz is now feature complete, time to fix the bugs :) Regards, Khaled ___ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Re: [HarfBuzz] harfbuzz: Branch 'master' - 6 commits
On 12-12-12 09:00 PM, Khaled Hosny wrote: > On Wed, Dec 12, 2012 at 08:39:26AM -0800, Behdad Esfahbod wrote: >> We still don't look for the old incorrect place of the featureParams. >> I'll wait till someone actually complains about it... > > Actually the first font I tested was an old-AFDKO broken one, so I’m > already complaining :) Should be all fixed in master now. behdad ___ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Re: [HarfBuzz] harfbuzz: Branch 'master' - 6 commits
On 12-12-12 09:00 PM, Khaled Hosny wrote: > On Wed, Dec 12, 2012 at 08:39:26AM -0800, Behdad Esfahbod wrote: >> We still don't look for the old incorrect place of the featureParams. >> I'll wait till someone actually complains about it... > > Actually the first font I tested was an old-AFDKO broken one, so I’m > already complaining :) I see. Send font my way please. b ___ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/harfbuzz
Re: [HarfBuzz] harfbuzz: Branch 'master' - 6 commits
On Wed, Dec 12, 2012 at 08:39:26AM -0800, Behdad Esfahbod wrote: > We still don't look for the old incorrect place of the featureParams. > I'll wait till someone actually complains about it... Actually the first font I tested was an old-AFDKO broken one, so I’m already complaining :) Regards, Khaled ___ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/harfbuzz
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-open-type-private.hh| 33 ++--- src/hb-ot-layout-common-private.hh | 133 +++-- src/hb-ot-layout.cc| 107 ++--- src/hb-ot-layout.h |8 +- src/hb-private.hh |4 + src/test-size-params.cc| 13 +-- 6 files changed, 259 insertions(+), 39 deletions(-) New commits: commit 85bc44b90a19c6a669ed567a9cd8513448600afe Author: Behdad Esfahbod Date: Wed Dec 12 11:38:49 2012 -0500 [OTLayout] More 'size' feature sanity checking We still don't look for the old incorrect place of the featureParams. I'll wait till someone actually complains about it... diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 61ba31a..f7a54bb 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -658,33 +658,92 @@ hb_ot_layout_get_size_params (hb_face_t*face, const OT::Feature &f = gpos.get_feature (i); const OT::FeatureParamsSize ¶ms = f.get_feature_params ().u.size; -#define PARAM(a, A) if (a) *a = params.A + /* This subtable has some "history", if you will. Some earlier versions of + * Adobe tools calculated the offset of the FeatureParams sutable from the + * beginning of the FeatureList table! Now, we don't check for that possibility, + * but we want to at least detect junk data and reject it. + * + * Read Roberts wrote on 9/15/06 on opentype-l...@indx.co.uk : + * + * Yes, it is correct that a new version of the AFDKO (version 2.0) will be + * coming out soon, and that the makeotf program will build a font with a + * 'size' feature that is correct by the specification. + * + * The specification for this feature tag is in the "OpenType Layout Tag + * Registry". You can see a copy of this at: + * http://partners.adobe.com/public/developer/opentype/index_tag8.html#size + * + * Here is one set of rules to determine if the 'size' feature is built + * correctly, or as by the older versions of MakeOTF. You may be able to do + * better. + * + * Assume that the offset to the size feature is according to specification, + * and make the following value checks. If it fails, assume the the size + * feature is calculated as versions of MakeOTF before the AFDKO 2.0 built it. + * If this fails, reject the 'size' feature. The older makeOTF's calculated the + * offset from the beginning of the FeatureList table, rather than from the + * beginning of the 'size' Feature table. + * + * If "design size" == 0: + * fails check + * + * Else if ("subfamily identifier" == 0 and + * "range start" == 0 and + * "range end" == 0 and + * "range start" == 0 and + * "menu name ID" == 0) + * passes check: this is the format used when there is a design size + * specified, but there is no recommended size range. + * + * Else if ("design size" < "range start" or + * "design size" > "range end" or + * "range end" <= "range start" or + * "menu name ID" < 256 or + * "menu name ID" > 32767 or + * menu name ID is not a name ID which is actually in the name table) + * fails test + * Else + * passes test. + */ + if (!params.designSize) -goto zero_all; - PARAM (design_size, designSize); - if (!params.subfamilyID) - { +ret = false; + else if (params.subfamilyID == 0 && + params.subfamilyNameID == 0 && + params.rangeStart == 0 && + params.rangeEnd == 0) +ret = true; + else if (params.designSize < params.rangeStart || + params.designSize > params.rangeEnd || + params.subfamilyNameID < 256 || + params.subfamilyNameID > 32767) +ret = false; + else ret = true; - goto zero_most; - }; - PARAM (subfamily_id, subfamilyID); - PARAM (subfamily_name_id, subfamilyNameID); - PARAM (range_start, rangeStart); - PARAM (range_end, rangeEnd); -#undef PARAM - return true; +#define PARAM(a, A) if (a) *a = params.A + if (ret) + { + PARAM (design_size, designSize); + PARAM (subfamily_id, subfamilyID); + PARAM (subfamily_name_id, subfamilyNameID); + PARAM (range_start, rangeStart); + PARAM (range_end, rangeEnd); + break; + } +#undef PARAM } } #define PARAM(a, A) if (a) *a = 0 -zero_all: - PARAM (design_size, designSize); -zero_most: - PARAM (subfamily_id, subfamilyID); - PARAM (subfamily_name_id, subfamilyNameID); - PARAM (range_start, rangeStart); - PARAM (range_end, rangeEnd); + if (!ret) + { +PARAM (design_size, designSize); +PARAM (subfamily_id, subfamilyID); +PARAM (subfamily_name_id, su
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-coretext.cc | 32 ++--- src/hb-icu-le.cc |2 src/hb-old.cc| 10 - src/hb-open-file-private.hh |2 src/hb-open-type-private.hh |2 src/hb-ot-head-table.hh |2 src/hb-ot-hhea-table.hh |2 src/hb-ot-hmtx-table.hh |2 src/hb-ot-layout-common-private.hh | 26 src/hb-ot-layout-gdef-table.hh | 14 +- src/hb-ot-layout-gpos-table.hh | 10 - src/hb-ot-layout-gsub-table.hh | 189 ++- src/hb-ot-layout-gsubgpos-private.hh | 69 +++- src/hb-ot-layout-private.hh | 10 + src/hb-ot-layout.cc | 43 +++ src/hb-ot-layout.h | 23 +--- src/hb-ot-maxp-table.hh |2 src/hb-ot-name-table.hh |2 src/hb-ot-shape-complex-default.cc | 109 ++-- src/hb-ot-shape.cc |5 src/hb-shape-plan-private.hh |1 src/hb-shape-plan.cc |7 + src/hb-shape-plan.h |4 src/hb-tt-font.cc|2 24 files changed, 443 insertions(+), 127 deletions(-) New commits: commit e8cfdd7fa8d0fb66e0a261f3547e5824897e5131 Author: Behdad Esfahbod Date: Fri Nov 16 19:07:06 2012 -0800 Start implementing collect_glyphs() operation Not functional yet. diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 6e185ba..4acd67b 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -52,6 +52,16 @@ struct SingleSubstFormat1 } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { +Coverage::Iter iter; +for (iter.init (this+coverage); iter.more (); iter.next ()) { + hb_codepoint_t glyph_id = iter.get_glyph (); + c->input.add (glyph_id); + c->output.add ((glyph_id + deltaGlyphID) & 0x); +} + } + inline const Coverage &get_coverage (void) const { return this+coverage; @@ -116,6 +126,15 @@ struct SingleSubstFormat2 } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { +Coverage::Iter iter; +for (iter.init (this+coverage); iter.more (); iter.next ()) { + c->input.add (iter.get_glyph ()); + c->output.add (substitute[iter.get_coverage ()]); +} + } + inline const Coverage &get_coverage (void) const { return this+coverage; @@ -182,6 +201,16 @@ struct SingleSubst } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { +TRACE_CLOSURE (); +switch (u.format) { +case 1: u.format1.collect_glyphs (c); break; +case 2: u.format2.collect_glyphs (c); break; +default: break; +} + } + inline const Coverage &get_coverage (void) const { switch (u.format) { @@ -261,6 +290,13 @@ struct Sequence c->glyphs->add (substitute[i]); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { +unsigned int count = substitute.len; +for (unsigned int i = 0; i < count; i++) + c->output.add (substitute[i]); + } + inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); @@ -316,6 +352,14 @@ struct MultipleSubstFormat1 } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { +(this+coverage).add_coverage (&c->input); +unsigned int count = sequence.len; +for (unsigned int i = 0; i < count; i++) + (this+sequence[i]).collect_glyphs (c); + } + inline const Coverage &get_coverage (void) const { return this+coverage; @@ -382,6 +426,14 @@ struct MultipleSubst } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { +switch (u.format) { +case 1: u.format1.collect_glyphs (c); break; +default: break; +} + } + inline const Coverage &get_coverage (void) const { switch (u.format) { @@ -455,6 +507,18 @@ struct AlternateSubstFormat1 } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { +Coverage::Iter iter; +for (iter.init (this+coverage); iter.more (); iter.next ()) { + c->input.add (iter.get_glyph ()); + const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()]; + unsigned int count = alt_set.len; + for (unsigned int i = 0; i < count; i++) + c->output.add (alt_set[i]); +} + } + inline const Coverage &get_coverage (void) const { return this+coverage; @@ -539,6 +603,14 @@ struct AlternateSubst } } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { +switch (u.format) { +case 1: u.format1.collect_glyphs (c); break; +default: break; +} + } + inline const Coverage &get_coverage (void) const { switch (u.forma
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-ot-shape-complex-arabic.cc|1 + src/hb-ot-shape-complex-indic-private.hh |6 +++--- src/hb-ot-shape-complex-indic.cc |8 +--- src/hb-ot-shape-complex-misc.cc |2 ++ src/hb-ot-shape-complex-private.hh | 24 +++- src/hb-ot-shape-fallback.cc |4 ++-- src/hb-ot-shape.cc | 20 +--- 7 files changed, 37 insertions(+), 28 deletions(-) New commits: commit d469fadce8290c7dda559c5927dd19df65f91c1a Author: Behdad Esfahbod Date: Wed Nov 14 15:07:36 2012 -0800 [Indic] Exchange abort() for assert() diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 130a632..a7f9b60 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -486,6 +486,10 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, switch (indic_plan->config->base_pos) { + default: +assert (false); + /* fallthrough */ + case BASE_POS_LAST: { /* -> starting from the end of the syllable, move backwards */ @@ -559,9 +563,6 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, info[i].indic_position() = POS_BELOW_C; } break; - - default: - abort (); } /* -> If the syllable starts with Ra + Halant (in a script that has Reph) commit 0f80a89de99293ddbf0b8b815fe360677d057e38 Author: Behdad Esfahbod Date: Wed Nov 14 15:05:19 2012 -0800 Don't route Kharoshthi through the Indic shaper It's a simple, right-to-left, script. diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh index d916f63..043e8e3 100644 --- a/src/hb-ot-shape-complex-private.hh +++ b/src/hb-ot-shape-complex-private.hh @@ -226,6 +226,7 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner) case HB_SCRIPT_TAI_LE: /* Unicode-4.1 additions */ +case HB_SCRIPT_KHAROSHTHI: case HB_SCRIPT_SYLOTI_NAGRI: /* Unicode-5.1 additions */ @@ -253,7 +254,6 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner) /* Unicode-4.1 additions */ case HB_SCRIPT_BUGINESE: -case HB_SCRIPT_KHAROSHTHI: case HB_SCRIPT_NEW_TAI_LUE: /* Unicode-5.0 additions */ commit e67072bb179a5c17db04075de74215597fb43c82 Author: Behdad Esfahbod Date: Wed Nov 14 15:00:53 2012 -0800 [Indic] Handle overstruck matra position diff --git a/src/hb-ot-shape-complex-indic-private.hh b/src/hb-ot-shape-complex-indic-private.hh index de7264a..e36090e 100644 --- a/src/hb-ot-shape-complex-indic-private.hh +++ b/src/hb-ot-shape-complex-indic-private.hh @@ -139,8 +139,8 @@ enum indic_matra_category_t { INDIC_MATRA_CATEGORY_TOP_AND_RIGHT = INDIC_MATRA_CATEGORY_RIGHT, INDIC_MATRA_CATEGORY_INVISIBLE = INDIC_MATRA_CATEGORY_NOT_APPLICABLE, - INDIC_MATRA_CATEGORY_OVERSTRUCK = INDIC_MATRA_CATEGORY_NOT_APPLICABLE, - INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT = INDIC_MATRA_CATEGORY_NOT_APPLICABLE + INDIC_MATRA_CATEGORY_OVERSTRUCK = POS_AFTER_MAIN, + INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT = POS_PRE_M }; /* Note: We use ASSERT_STATIC_EXPR_ZERO() instead of ASSERT_STATIC_EXPR() and the comma operation @@ -222,7 +222,7 @@ matra_position (hb_codepoint_t u, indic_position_t side) case POS_ABOVE_C: return MATRA_POS_TOP (u); case POS_BELOW_C: return MATRA_POS_BOTTOM (u); }; - abort (); + return side; } commit 7e99e4f0740e47efda5882604954cb7d12700a4b Author: Behdad Esfahbod Date: Wed Nov 14 14:09:46 2012 -0800 Reposition Lao marks Lao marks are center-aligned, unlike Thai ones. diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index 5dc554c..f4463e4 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -138,10 +138,10 @@ recategorize_combining_class (hb_codepoint_t u, /* Lao */ case HB_MODIFIED_COMBINING_CLASS_CCC118: /* sign u / sign uu */ - return HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT; + return HB_UNICODE_COMBINING_CLASS_BELOW; case HB_MODIFIED_COMBINING_CLASS_CCC122: /* mai */ - return HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT; + return HB_UNICODE_COMBINING_CLASS_ABOVE; /* Tibetan */ commit 865745b5b87236651f5663cae3461db9cb505eed Author: Behdad Esfahbod Date: Wed Nov 14 13:48:26 2012 -0800 Don't do fallback positioning for Indic and Thai shapers diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 591c743..ea2a68f 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -354,4 +354,5 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic = NULL, /* compose */ setup_masks_arabic, true, /* zero_width_attached_marks */ + true, /* fallback_position */ }; diff --git a/src/hb-ot-shape-comp
[HarfBuzz] harfbuzz: Branch 'master' - 6 commits
src/hb-buffer-private.hh | 1 src/hb-buffer.cc | 8 +- src/hb-buffer.h| 27 +- src/hb-ot-shape-complex-indic.cc | 8 ++ test/api/test-buffer.c | 2 test/shaping/hb_test_tools.py | 2 test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/misc.txt | 1 7 files changed, 26 insertions(+), 23 deletions(-) New commits: commit 6b19fa48621dbf36d471d5005f6ae20df350954f Author: Behdad Esfahbod Date: Wed Nov 14 11:38:50 2012 -0800 Adjust diff rule for the new hb-shape output format diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py index 6139ec1..ccb0e1c 100644 --- a/test/shaping/hb_test_tools.py +++ b/test/shaping/hb_test_tools.py @@ -295,7 +295,7 @@ class DiffHelpers: def test_passed (lines): lines = list (lines) # XXX This is a hack, but does the job for now. - if any (l.find("space|space") >= 0 for l in lines if l[0] == '+'): return True + if any (l.find("space+0|space+0") >= 0 for l in lines if l[0] == '+'): return True if any (l.find("uni25CC") >= 0 for l in lines if l[0] == '+'): return True if any (l.find("dottedcircle") >= 0 for l in lines if l[0] == '+'): return True if any (l.find("glyph0") >= 0 for l in lines if l[0] == '+'): return True commit dde5506fd963e3cec27c3389bb1fc092f86d1e06 Author: Behdad Esfahbod Date: Wed Nov 14 11:37:04 2012 -0800 [Indic] Don't move virama with left matra This is important for the Sinhala U+0DDA split matra since it decomposes to U+0DD9,U+0DCA where U+0DD9 is a left matra and U+0DCA is the virama. We don't want to move the virama with the left matra. TEST: U+0D9A,U+0DDA Note that we were already doing this in the Uniscribe bug compatibility mode. We now do it all the time. diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index a948d52..1c7de0d 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -662,13 +662,17 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, if ((FLAG (info[i].indic_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | HALANT_OR_COENG_FLAGS))) { info[i].indic_position() = last_pos; - if (unlikely (indic_options ().uniscribe_bug_compatible && - info[i].indic_category() == OT_H && + if (unlikely (info[i].indic_category() == OT_H && info[i].indic_position() == POS_PRE_M)) { /* * Uniscribe doesn't move the Halant with Left Matra. * TEST: U+092B,U+093F,U+094DE + * We follow. This is important for the Sinhala + * U+0DDA split matra since it decomposes to U+0DD9,U+0DCA + * where U+0DD9 is a left matra and U+0DCA is the virama. + * We don't want to move the virama with the left matra. + * TEST: U+0D9A,U+0DDA */ for (unsigned int j = i; j > start; j--) if (info[j - 1].indic_position() != POS_PRE_M) { commit 82c4d9880a2cd321f6426888511c5f0318f96ad5 Author: Behdad Esfahbod Date: Wed Nov 14 10:56:02 2012 -0800 Add Sinhala test case for split matra U+0DDA diff --git a/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/misc.txt b/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/misc.txt index 8715f72..363fcb6 100644 --- a/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/misc.txt +++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-sinhala/misc/misc.txt @@ -37,3 +37,4 @@ නâà·à¶à· රà·â à¶à·âර෠+à¶à· commit d04b12853167d756a8cccaf4154f0fd894bce6de Author: Behdad Esfahbod Date: Wed Nov 14 10:53:10 2012 -0800 Fix test diff --git a/test/api/test-buffer.c b/test/api/test-buffer.c index 51b2277..f826f2e 100644 --- a/test/api/test-buffer.c +++ b/test/api/test-buffer.c @@ -71,7 +71,7 @@ fixture_init (fixture_t *fixture, gconstpointer user_data) case BUFFER_ONE_BY_ONE: for (i = 1; i < G_N_ELEMENTS (utf32) - 1; i++) - hb_buffer_add (b, utf32[i], 1, i); + hb_buffer_add (b, utf32[i], i); break; case BUFFER_UTF32: commit 92f9bfed42f720c1fd78e795845542661aaf4f8a Author: Behdad Esfahbod Date: Tue Nov 13 16:50:45 2012 -0800 Minor diff --git a/src/hb-buffer.h b/src/hb-buffer.h index 0b16391..8e1690d 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -62,18 +62,6 @@ typedef struct hb_glyph_position_t { hb_var_int_t var; } hb_glyph_position_t; -typedef enum { - HB_BUFFER_CONTENT_TYPE_INVALID = 0, -