diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2019-08-24 13:13:59 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2019-08-24 13:13:59 +0000 |
commit | 2fad25e7999ea7b2858792822a1e4d6aeb86784b (patch) | |
tree | 9a9b54367c443d07d6bc19e85584a6102d8baf54 /Build/source/libs/harfbuzz/harfbuzz-src/src | |
parent | 7f9fbe43db01d092e022855fd5a16d073600ecee (diff) |
harfbuzz 2.6.1
git-svn-id: svn://tug.org/texlive/trunk@51949 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src')
18 files changed, 437 insertions, 378 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh index 2e45fd28b82..7063b386c2e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-lcar-table.hh @@ -38,56 +38,121 @@ namespace AAT { typedef ArrayOf<HBINT16> LigCaretClassEntry; -struct lcar +struct lcarFormat0 { - static constexpr hb_tag_t tableTag = HB_AAT_TAG_lcar; + unsigned int get_lig_carets (hb_font_t *font, + hb_direction_t direction, + hb_codepoint_t glyph, + unsigned int start_offset, + unsigned int *caret_count /* IN/OUT */, + hb_position_t *caret_array /* OUT */, + const void *base) const + { + const OffsetTo<LigCaretClassEntry>* entry_offset = lookupTable.get_value (glyph, + font->face->get_num_glyphs ()); + const LigCaretClassEntry& array = entry_offset ? base+*entry_offset : Null (LigCaretClassEntry); + if (caret_count) + { + hb_array_t<const HBINT16> arr = array.sub_array (start_offset, caret_count); + for (unsigned int i = 0; i < arr.length; ++i) + caret_array[i] = font->em_scale_dir (arr[i], direction); + } + return array.len; + } + bool sanitize (hb_sanitize_context_t *c, const void *base) const + { + TRACE_SANITIZE (this); + return_trace (likely (c->check_struct (this) && lookupTable.sanitize (c, base))); + } + + protected: + Lookup<OffsetTo<LigCaretClassEntry>> + lookupTable; /* data Lookup table associating glyphs */ + public: + DEFINE_SIZE_MIN (2); +}; + +struct lcarFormat1 +{ unsigned int get_lig_carets (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph, unsigned int start_offset, unsigned int *caret_count /* IN/OUT */, - hb_position_t *caret_array /* OUT */) const + hb_position_t *caret_array /* OUT */, + const void *base) const { - const OffsetTo<LigCaretClassEntry>* entry_offset = lookup.get_value (glyph, - font->face->get_num_glyphs ()); - const LigCaretClassEntry& array = entry_offset ? this+*entry_offset : Null (LigCaretClassEntry); + const OffsetTo<LigCaretClassEntry>* entry_offset = lookupTable.get_value (glyph, + font->face->get_num_glyphs ()); + const LigCaretClassEntry& array = entry_offset ? base+*entry_offset : Null (LigCaretClassEntry); if (caret_count) { hb_array_t<const HBINT16> arr = array.sub_array (start_offset, caret_count); - switch (format) + for (unsigned int i = 0; i < arr.length; ++i) { - case 0: - for (unsigned int i = 0; i < arr.length; ++i) - caret_array[i] = font->em_scale_dir (arr[i], direction); - break; - case 1: - for (unsigned int i = 0; i < arr.length; ++i) - { - hb_position_t x, y; - font->get_glyph_contour_point_for_origin (glyph, arr[i], direction, &x, &y); - caret_array[i] = HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y; - } - break; + hb_position_t x = 0, y = 0; + font->get_glyph_contour_point_for_origin (glyph, arr[i], direction, &x, &y); + caret_array[i] = HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y; } } return array.len; } + bool sanitize (hb_sanitize_context_t *c, const void *base) const + { + TRACE_SANITIZE (this); + return_trace (likely (c->check_struct (this) && lookupTable.sanitize (c, base))); + } + + protected: + Lookup<OffsetTo<LigCaretClassEntry>> + lookupTable; /* data Lookup table associating glyphs */ + public: + DEFINE_SIZE_MIN (2); +}; + +struct lcar +{ + static constexpr hb_tag_t tableTag = HB_AAT_TAG_lcar; + + unsigned int get_lig_carets (hb_font_t *font, + hb_direction_t direction, + hb_codepoint_t glyph, + unsigned int start_offset, + unsigned int *caret_count /* IN/OUT */, + hb_position_t *caret_array /* OUT */) const + { + switch (format) + { + case 0: return u.format0.get_lig_carets (font, direction, glyph, start_offset, + caret_count, caret_array, this); + case 1: return u.format1.get_lig_carets (font, direction, glyph, start_offset, + caret_count, caret_array, this); + default:if (caret_count) *caret_count = 0; return 0; + } + } + bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - return_trace (likely (c->check_struct (this) && - version.major == 1 && - lookup.sanitize (c, this))); + if (unlikely (!c->check_struct (this) || version.major != 1)) + return_trace (false); + + switch (format) { + case 0: return_trace (u.format0.sanitize (c, this)); + case 1: return_trace (u.format1.sanitize (c, this)); + default:return_trace (true); + } } protected: FixedVersion<>version; /* Version number of the ligature caret table */ HBUINT16 format; /* Format of the ligature caret table. */ - Lookup<OffsetTo<LigCaretClassEntry>> - lookup; /* data Lookup table associating glyphs */ - + union { + lcarFormat0 format0; + lcarFormat0 format1; + } u; public: DEFINE_SIZE_MIN (8); }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-opbd-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-opbd-table.hh index 5b9c3912507..4e0234074fe 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-opbd-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-opbd-table.hh @@ -45,50 +45,112 @@ struct OpticalBounds return_trace (likely (c->check_struct (this))); } - HBINT16 leftSide; - HBINT16 topSide; - HBINT16 rightSide; - HBINT16 bottomSide; + FWORD leftSide; + FWORD topSide; + FWORD rightSide; + FWORD bottomSide; public: DEFINE_SIZE_STATIC (8); }; -struct opbd +struct opbdFormat0 { - static constexpr hb_tag_t tableTag = HB_AAT_TAG_opbd; + bool get_bounds (hb_font_t *font, hb_codepoint_t glyph_id, + hb_glyph_extents_t *extents, const void *base) const + { + const OffsetTo<OpticalBounds> *bounds_offset = lookupTable.get_value (glyph_id, font->face->get_num_glyphs ()); + if (!bounds_offset) return false; + const OpticalBounds &bounds = base+*bounds_offset; + + if (extents) + *extents = { + font->em_scale_x (bounds.leftSide), + font->em_scale_y (bounds.topSide), + font->em_scale_x (bounds.rightSide), + font->em_scale_y (bounds.bottomSide) + }; + return true; + } + + bool sanitize (hb_sanitize_context_t *c, const void *base) const + { + TRACE_SANITIZE (this); + return_trace (likely (c->check_struct (this) && lookupTable.sanitize (c, base))); + } + + protected: + Lookup<OffsetTo<OpticalBounds>> + lookupTable; /* Lookup table associating glyphs with the four + * int16 values for the left-side, top-side, + * right-side, and bottom-side optical bounds. */ + public: + DEFINE_SIZE_MIN (2); +}; - bool get_optical_bounds (hb_font_t *font, hb_codepoint_t glyph_id, - hb_position_t *left, hb_position_t *top, - hb_position_t *right, hb_position_t *bottom) const +struct opbdFormat1 +{ + bool get_bounds (hb_font_t *font, hb_codepoint_t glyph_id, + hb_glyph_extents_t *extents, const void *base) const { const OffsetTo<OpticalBounds> *bounds_offset = lookupTable.get_value (glyph_id, font->face->get_num_glyphs ()); if (!bounds_offset) return false; - const OpticalBounds &bounds = this+*bounds_offset; - switch (format) + const OpticalBounds &bounds = base+*bounds_offset; + + hb_position_t left = 0, top = 0, right = 0, bottom = 0, ignore; + if (font->get_glyph_contour_point (glyph_id, bounds.leftSide, &left, &ignore) || + font->get_glyph_contour_point (glyph_id, bounds.topSide, &ignore, &top) || + font->get_glyph_contour_point (glyph_id, bounds.rightSide, &right, &ignore) || + font->get_glyph_contour_point (glyph_id, bounds.bottomSide, &ignore, &bottom)) { - case 0: - *left = font->em_scale_x (bounds.leftSide); - *top = font->em_scale_y (bounds.topSide); - *right = font->em_scale_x (bounds.rightSide); - *bottom = font->em_scale_y (bounds.bottomSide); + if (extents) + *extents = {left, top, right, bottom}; return true; - case 1: - hb_position_t ignore; - return font->get_glyph_contour_point (glyph_id, bounds.leftSide, left, &ignore) && - font->get_glyph_contour_point (glyph_id, bounds.topSide, &ignore, top) && - font->get_glyph_contour_point (glyph_id, bounds.rightSide, right, &ignore) && - font->get_glyph_contour_point (glyph_id, bounds.bottomSide, &ignore, bottom); - default: - return false; + } + return false; + } + + bool sanitize (hb_sanitize_context_t *c, const void *base) const + { + TRACE_SANITIZE (this); + return_trace (likely (c->check_struct (this) && lookupTable.sanitize (c, base))); + } + + protected: + Lookup<OffsetTo<OpticalBounds>> + lookupTable; /* Lookup table associating glyphs with the four + * int16 values for the left-side, top-side, + * right-side, and bottom-side optical bounds. */ + public: + DEFINE_SIZE_MIN (2); +}; + +struct opbd +{ + static constexpr hb_tag_t tableTag = HB_AAT_TAG_opbd; + + bool get_bounds (hb_font_t *font, hb_codepoint_t glyph_id, + hb_glyph_extents_t *extents) const + { + switch (format) + { + case 0: return u.format0.get_bounds (font, glyph_id, extents, this); + case 1: return u.format1.get_bounds (font, glyph_id, extents, this); + default:return false; } } bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - return_trace (likely (c->check_struct (this) && - version.major == 1 && - lookupTable.sanitize (c, this))); + if (unlikely (!c->check_struct (this) || version.major != 1)) + return_trace (false); + + switch (format) + { + case 0: return_trace (u.format0.sanitize (c, this)); + case 1: return_trace (u.format1.sanitize (c, this)); + default:return_trace (true); + } } protected: @@ -97,10 +159,10 @@ struct opbd HBUINT16 format; /* Format of the optical bounds table. * Format 0 indicates distance and Format 1 indicates * control point. */ - Lookup<OffsetTo<OpticalBounds>> - lookupTable; /* Lookup table associating glyphs with the four - * int16 values for the left-side, top-side, - * right-side, and bottom-side optical bounds. */ + union { + opbdFormat0 format0; + opbdFormat1 format1; + } u; public: DEFINE_SIZE_MIN (8); }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh index 2eace2aa044..e6b6d55e043 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh @@ -93,13 +93,6 @@ struct TrackData int get_tracking (const void *base, float ptem) const { - /* CoreText points are CSS pixels (96 per inch), - * NOT typographic points (72 per inch). - * - * https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html - */ - float csspx = ptem * 96.f / 72.f; - /* * Choose track. */ @@ -130,10 +123,10 @@ struct TrackData hb_array_t<const Fixed> size_table ((base+sizeTable).arrayZ, sizes); unsigned int size_index; for (size_index = 0; size_index < sizes - 1; size_index++) - if (size_table[size_index].to_float () >= csspx) + if (size_table[size_index].to_float () >= ptem) break; - return roundf (interpolate_at (size_index ? size_index - 1 : 0, csspx, + return roundf (interpolate_at (size_index ? size_index - 1 : 0, ptem, *trackTableEntry, base)); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc index e8a4fd51e56..31aa00a1110 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc @@ -49,24 +49,6 @@ /* https://developer.apple.com/documentation/coretext/1508745-ctfontcreatewithgraphicsfont */ #define HB_CORETEXT_DEFAULT_FONT_SIZE 12.f -static CGFloat -coretext_font_size_from_ptem (float ptem) -{ - /* CoreText points are CSS pixels (96 per inch), - * NOT typographic points (72 per inch). - * - * https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html - */ - ptem *= 96.f / 72.f; - return (CGFloat) (ptem <= 0.f ? HB_CORETEXT_DEFAULT_FONT_SIZE : ptem); -} -static float -coretext_font_size_to_ptem (CGFloat size) -{ - size *= 72. / 96.; - return size <= 0 ? 0 : size; -} - static void release_table_data (void *user_data) { @@ -320,7 +302,8 @@ _hb_coretext_shaper_font_data_create (hb_font_t *font) if (unlikely (!face_data)) return nullptr; CGFontRef cg_font = (CGFontRef) (const void *) face->data.coretext; - CTFontRef ct_font = create_ct_font (cg_font, coretext_font_size_from_ptem (font->ptem)); + CGFloat font_size = font->ptem <= 0.f ? HB_CORETEXT_DEFAULT_FONT_SIZE : font->ptem; + CTFontRef ct_font = create_ct_font (cg_font, font_size); if (unlikely (!ct_font)) { @@ -344,7 +327,7 @@ retry: const hb_coretext_font_data_t *data = font->data.coretext; if (unlikely (!data)) return nullptr; - if (fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem (font->ptem)) > .5) + if (fabs (CTFontGetSize ((CTFontRef) data) - font->ptem) > .5) { /* XXX-MT-bug * Note that evaluating condition above can be dangerous if another thread @@ -384,7 +367,7 @@ hb_coretext_font_create (CTFontRef ct_font) if (unlikely (hb_object_is_immutable (font))) return font; - hb_font_set_ptem (font, coretext_font_size_to_ptem (CTFontGetSize(ct_font))); + hb_font_set_ptem (font, CTFontGetSize (ct_font)); /* Let there be dragons here... */ font->data.coretext.cmpexch (nullptr, (hb_coretext_font_data_t *) CFRetain (ct_font)); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc index c14e9d2be4b..a079563af48 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc @@ -879,29 +879,12 @@ _hb_directwrite_shape (hb_shape_plan_t *shape_plan, features, num_features, 0); } -/** - * hb_directwrite_shape_experimental_width: - * Experimental API to test DirectWrite's justification algorithm. - * - * It inserts Kashida at wrong order so don't use the API ever. - * - * It doesn't work with cygwin/msys due to header bugs so one - * should use MSVC toolchain in order to use it for now. - * - * @font: - * @buffer: - * @features: - * @num_features: - * @width: - * - * Since: 1.4.2 - **/ -hb_bool_t -hb_directwrite_shape_experimental_width (hb_font_t *font, - hb_buffer_t *buffer, - const hb_feature_t *features, - unsigned int num_features, - float width) +HB_UNUSED static bool +_hb_directwrite_shape_experimental_width (hb_font_t *font, + hb_buffer_t *buffer, + const hb_feature_t *features, + unsigned int num_features, + float width) { static const char *shapers = "directwrite"; hb_shape_plan_t *shape_plan; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.h index de813d069f2..f837627a286 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.h @@ -29,11 +29,6 @@ HB_BEGIN_DECLS -HB_EXTERN hb_bool_t -hb_directwrite_shape_experimental_width (hb_font_t *font, hb_buffer_t *buffer, - const hb_feature_t *features, - unsigned int num_features, float width); - HB_EXTERN hb_face_t * hb_directwrite_face_create (IDWriteFontFace *font_face); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc index e6339cdcee8..445878bfe40 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc @@ -518,9 +518,9 @@ static const hb_font_funcs_t _hb_font_funcs_default = { /** * hb_font_funcs_create: (Xconstructor) * - * * - * Return value: (transfer full): + * + * Return value: (transfer full): * * Since: 0.9.2 **/ @@ -540,9 +540,9 @@ hb_font_funcs_create () /** * hb_font_funcs_get_empty: * - * * - * Return value: (transfer full): + * + * Return value: (transfer full): * * Since: 0.9.2 **/ @@ -556,9 +556,9 @@ hb_font_funcs_get_empty () * hb_font_funcs_reference: (skip) * @ffuncs: font functions. * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -572,7 +572,7 @@ hb_font_funcs_reference (hb_font_funcs_t *ffuncs) * hb_font_funcs_destroy: (skip) * @ffuncs: font functions. * - * + * * * Since: 0.9.2 **/ @@ -592,14 +592,14 @@ hb_font_funcs_destroy (hb_font_funcs_t *ffuncs) /** * hb_font_funcs_set_user_data: (skip) * @ffuncs: font functions. - * @key: - * @data: - * @destroy: - * @replace: + * @key: + * @data: + * @destroy: + * @replace: * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -616,11 +616,11 @@ hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs, /** * hb_font_funcs_get_user_data: (skip) * @ffuncs: font functions. - * @key: + * @key: + * * - * * - * Return value: (transfer none): + * Return value: (transfer none): * * Since: 0.9.2 **/ @@ -636,7 +636,7 @@ hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs, * hb_font_funcs_make_immutable: * @ffuncs: font functions. * - * + * * * Since: 0.9.2 **/ @@ -653,9 +653,9 @@ hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs) * hb_font_funcs_is_immutable: * @ffuncs: font functions. * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -751,13 +751,13 @@ hb_font_get_v_extents (hb_font_t *font, /** * hb_font_get_glyph: * @font: a font. - * @unicode: - * @variation_selector: - * @glyph: (out): + * @unicode: + * @variation_selector: + * @glyph: (out): * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -774,12 +774,12 @@ hb_font_get_glyph (hb_font_t *font, /** * hb_font_get_nominal_glyph: * @font: a font. - * @unicode: - * @glyph: (out): + * @unicode: + * @glyph: (out): + * * - * * - * Return value: + * Return value: * * Since: 1.2.3 **/ @@ -794,13 +794,13 @@ hb_font_get_nominal_glyph (hb_font_t *font, /** * hb_font_get_variation_glyph: * @font: a font. - * @unicode: - * @variation_selector: - * @glyph: (out): + * @unicode: + * @variation_selector: + * @glyph: (out): + * * - * * - * Return value: + * Return value: * * Since: 1.2.3 **/ @@ -815,11 +815,11 @@ hb_font_get_variation_glyph (hb_font_t *font, /** * hb_font_get_glyph_h_advance: * @font: a font. - * @glyph: + * @glyph: * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -833,11 +833,11 @@ hb_font_get_glyph_h_advance (hb_font_t *font, /** * hb_font_get_glyph_v_advance: * @font: a font. - * @glyph: + * @glyph: * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -852,7 +852,7 @@ hb_font_get_glyph_v_advance (hb_font_t *font, * hb_font_get_glyph_h_advances: * @font: a font. * - * + * * * Since: 1.8.6 **/ @@ -870,7 +870,7 @@ hb_font_get_glyph_h_advances (hb_font_t* font, * hb_font_get_glyph_v_advances: * @font: a font. * - * + * * * Since: 1.8.6 **/ @@ -888,13 +888,13 @@ hb_font_get_glyph_v_advances (hb_font_t* font, /** * hb_font_get_glyph_h_origin: * @font: a font. - * @glyph: - * @x: (out): - * @y: (out): + * @glyph: + * @x: (out): + * @y: (out): + * * - * * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -909,13 +909,13 @@ hb_font_get_glyph_h_origin (hb_font_t *font, /** * hb_font_get_glyph_v_origin: * @font: a font. - * @glyph: - * @x: (out): - * @y: (out): + * @glyph: + * @x: (out): + * @y: (out): * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -930,12 +930,12 @@ hb_font_get_glyph_v_origin (hb_font_t *font, /** * hb_font_get_glyph_h_kerning: * @font: a font. - * @left_glyph: - * @right_glyph: + * @left_glyph: + * @right_glyph: * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -950,12 +950,12 @@ hb_font_get_glyph_h_kerning (hb_font_t *font, /** * hb_font_get_glyph_v_kerning: * @font: a font. - * @top_glyph: - * @bottom_glyph: + * @top_glyph: + * @bottom_glyph: + * * - * * - * Return value: + * Return value: * * Since: 0.9.2 * Deprecated: 2.0.0 @@ -971,12 +971,12 @@ hb_font_get_glyph_v_kerning (hb_font_t *font, /** * hb_font_get_glyph_extents: * @font: a font. - * @glyph: - * @extents: (out): + * @glyph: + * @extents: (out): + * * - * * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -991,14 +991,14 @@ hb_font_get_glyph_extents (hb_font_t *font, /** * hb_font_get_glyph_contour_point: * @font: a font. - * @glyph: - * @point_index: - * @x: (out): - * @y: (out): + * @glyph: + * @point_index: + * @x: (out): + * @y: (out): + * * - * * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -1013,13 +1013,13 @@ hb_font_get_glyph_contour_point (hb_font_t *font, /** * hb_font_get_glyph_name: * @font: a font. - * @glyph: - * @name: (array length=size): - * @size: + * @glyph: + * @name: (array length=size): + * @size: * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -1034,13 +1034,13 @@ hb_font_get_glyph_name (hb_font_t *font, /** * hb_font_get_glyph_from_name: * @font: a font. - * @name: (array length=len): - * @len: - * @glyph: (out): + * @name: (array length=len): + * @len: + * @glyph: (out): * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -1075,12 +1075,12 @@ hb_font_get_extents_for_direction (hb_font_t *font, /** * hb_font_get_glyph_advance_for_direction: * @font: a font. - * @glyph: - * @direction: - * @x: (out): - * @y: (out): + * @glyph: + * @direction: + * @x: (out): + * @y: (out): + * * - * * * Since: 0.9.2 **/ @@ -1095,9 +1095,9 @@ hb_font_get_glyph_advance_for_direction (hb_font_t *font, /** * hb_font_get_glyph_advances_for_direction: * @font: a font. - * @direction: + * @direction: + * * - * * * Since: 1.8.6 **/ @@ -1116,12 +1116,12 @@ hb_font_get_glyph_advances_for_direction (hb_font_t* font, /** * hb_font_get_glyph_origin_for_direction: * @font: a font. - * @glyph: - * @direction: - * @x: (out): - * @y: (out): + * @glyph: + * @direction: + * @x: (out): + * @y: (out): + * * - * * * Since: 0.9.2 **/ @@ -1137,12 +1137,12 @@ hb_font_get_glyph_origin_for_direction (hb_font_t *font, /** * hb_font_add_glyph_origin_for_direction: * @font: a font. - * @glyph: - * @direction: - * @x: (out): - * @y: (out): + * @glyph: + * @direction: + * @x: (out): + * @y: (out): + * * - * * * Since: 0.9.2 **/ @@ -1158,12 +1158,12 @@ hb_font_add_glyph_origin_for_direction (hb_font_t *font, /** * hb_font_subtract_glyph_origin_for_direction: * @font: a font. - * @glyph: - * @direction: - * @x: (out): - * @y: (out): + * @glyph: + * @direction: + * @x: (out): + * @y: (out): + * * - * * * Since: 0.9.2 **/ @@ -1179,13 +1179,13 @@ hb_font_subtract_glyph_origin_for_direction (hb_font_t *font, /** * hb_font_get_glyph_kerning_for_direction: * @font: a font. - * @first_glyph: - * @second_glyph: - * @direction: - * @x: (out): - * @y: (out): + * @first_glyph: + * @second_glyph: + * @direction: + * @x: (out): + * @y: (out): + * * - * * * Since: 0.9.2 **/ @@ -1201,13 +1201,13 @@ hb_font_get_glyph_kerning_for_direction (hb_font_t *font, /** * hb_font_get_glyph_extents_for_origin: * @font: a font. - * @glyph: - * @direction: - * @extents: (out): + * @glyph: + * @direction: + * @extents: (out): + * * - * * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -1223,15 +1223,15 @@ hb_font_get_glyph_extents_for_origin (hb_font_t *font, /** * hb_font_get_glyph_contour_point_for_origin: * @font: a font. - * @glyph: - * @point_index: - * @direction: - * @x: (out): - * @y: (out): + * @glyph: + * @point_index: + * @direction: + * @x: (out): + * @y: (out): + * * - * * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -1248,11 +1248,11 @@ hb_font_get_glyph_contour_point_for_origin (hb_font_t *font, /** * hb_font_glyph_to_string: * @font: a font. - * @glyph: - * @s: (array length=size): - * @size: + * @glyph: + * @s: (array length=size): + * @size: + * * - * * * Since: 0.9.2 **/ @@ -1268,13 +1268,13 @@ hb_font_glyph_to_string (hb_font_t *font, /** * hb_font_glyph_from_string: * @font: a font. - * @s: (array length=len) (element-type uint8_t): - * @len: - * @glyph: (out): + * @s: (array length=len) (element-type uint8_t): + * @len: + * @glyph: (out): * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -1341,9 +1341,9 @@ _hb_font_create (hb_face_t *face) * hb_font_create: (Xconstructor) * @face: a face. * - * * - * Return value: (transfer full): + * + * Return value: (transfer full): * * Since: 0.9.2 **/ @@ -1364,9 +1364,9 @@ hb_font_create (hb_face_t *face) * hb_font_create_sub_font: * @parent: parent font. * - * * - * Return value: (transfer full): + * + * Return value: (transfer full): * * Since: 0.9.2 **/ @@ -1385,14 +1385,13 @@ hb_font_create_sub_font (hb_font_t *parent) font->x_scale = parent->x_scale; font->y_scale = parent->y_scale; + font->mults_changed (); font->x_ppem = parent->x_ppem; font->y_ppem = parent->y_ppem; font->ptem = parent->ptem; font->num_coords = parent->num_coords; - if (!font->num_coords) - font->coords = nullptr; - else + if (font->num_coords) { unsigned int size = parent->num_coords * sizeof (parent->coords[0]); font->coords = (int *) malloc (size); @@ -1408,7 +1407,7 @@ hb_font_create_sub_font (hb_font_t *parent) /** * hb_font_get_empty: * - * + * * * Return value: (transfer full) * @@ -1424,9 +1423,9 @@ hb_font_get_empty () * hb_font_reference: (skip) * @font: a font. * - * * - * Return value: (transfer full): + * + * Return value: (transfer full): * * Since: 0.9.2 **/ @@ -1440,7 +1439,7 @@ hb_font_reference (hb_font_t *font) * hb_font_destroy: (skip) * @font: a font. * - * + * * * Since: 0.9.2 **/ @@ -1466,14 +1465,14 @@ hb_font_destroy (hb_font_t *font) /** * hb_font_set_user_data: (skip) * @font: a font. - * @key: - * @data: - * @destroy: - * @replace: + * @key: + * @data: + * @destroy: + * @replace: + * * - * * - * Return value: + * Return value: * * Since: 0.9.2 **/ @@ -1490,11 +1489,11 @@ hb_font_set_user_data (hb_font_t *font, /** * hb_font_get_user_data: (skip) * @font: a font. - * @key: + * @key: + * * - * * - * Return value: (transfer none): + * Return value: (transfer none): * * Since: 0.9.2 **/ @@ -1509,7 +1508,7 @@ hb_font_get_user_data (hb_font_t *font, * hb_font_make_immutable: * @font: a font. * - * + * * * Since: 0.9.2 **/ @@ -1529,9 +1528,9 @@ hb_font_make_immutable (hb_font_t *font) * hb_font_is_immutable: * @font: a font. * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -1571,9 +1570,9 @@ hb_font_set_parent (hb_font_t *font, * hb_font_get_parent: * @font: a font. * - * * - * Return value: (transfer none): + * + * Return value: (transfer none): * * Since: 0.9.2 **/ @@ -1615,9 +1614,9 @@ hb_font_set_face (hb_font_t *font, * hb_font_get_face: * @font: a font. * - * * - * Return value: (transfer none): + * + * Return value: (transfer none): * * Since: 0.9.2 **/ @@ -1632,10 +1631,10 @@ hb_font_get_face (hb_font_t *font) * hb_font_set_funcs: * @font: a font. * @klass: (closure font_data) (destroy destroy) (scope notified): - * @font_data: - * @destroy: + * @font_data: + * @destroy: + * * - * * * Since: 0.9.2 **/ @@ -1669,9 +1668,9 @@ hb_font_set_funcs (hb_font_t *font, * hb_font_set_funcs_data: * @font: a font. * @font_data: (destroy destroy) (scope notified): - * @destroy: + * @destroy: + * * - * * * Since: 0.9.2 **/ @@ -1699,10 +1698,10 @@ hb_font_set_funcs_data (hb_font_t *font, /** * hb_font_set_scale: * @font: a font. - * @x_scale: - * @y_scale: + * @x_scale: + * @y_scale: + * * - * * * Since: 0.9.2 **/ @@ -1722,10 +1721,10 @@ hb_font_set_scale (hb_font_t *font, /** * hb_font_get_scale: * @font: a font. - * @x_scale: (out): - * @y_scale: (out): + * @x_scale: (out): + * @y_scale: (out): + * * - * * * Since: 0.9.2 **/ @@ -1741,10 +1740,10 @@ hb_font_get_scale (hb_font_t *font, /** * hb_font_set_ppem: * @font: a font. - * @x_ppem: - * @y_ppem: + * @x_ppem: + * @y_ppem: + * * - * * * Since: 0.9.2 **/ @@ -1763,10 +1762,10 @@ hb_font_set_ppem (hb_font_t *font, /** * hb_font_get_ppem: * @font: a font. - * @x_ppem: (out): - * @y_ppem: (out): + * @x_ppem: (out): + * @y_ppem: (out): + * * - * * * Since: 0.9.2 **/ @@ -1815,6 +1814,7 @@ hb_font_get_ptem (hb_font_t *font) return font->ptem; } +#ifndef HB_NO_VAR /* * Variations */ @@ -1830,7 +1830,6 @@ _hb_font_adopt_var_coords_normalized (hb_font_t *font, font->num_coords = coords_length; } -#ifndef HB_NO_VAR /** * hb_font_set_variations: * @@ -1909,7 +1908,6 @@ hb_font_set_var_named_instance (hb_font_t *font, hb_font_set_var_coords_design (font, coords, coords_length); free (coords); } -#endif /** * hb_font_set_var_coords_normalized: @@ -1951,7 +1949,7 @@ hb_font_get_var_coords_normalized (hb_font_t *font, return font->coords; } - +#endif #ifndef HB_DISABLE_DEPRECATED /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.h index e68fd1813b6..9b6518791e1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.h @@ -224,7 +224,7 @@ hb_font_funcs_set_font_v_extents_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 1.2.3 **/ @@ -256,7 +256,7 @@ hb_font_funcs_set_nominal_glyphs_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 1.2.3 **/ @@ -272,7 +272,7 @@ hb_font_funcs_set_variation_glyph_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 0.9.2 **/ @@ -288,7 +288,7 @@ hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 0.9.2 **/ @@ -304,7 +304,7 @@ hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 1.8.6 **/ @@ -320,7 +320,7 @@ hb_font_funcs_set_glyph_h_advances_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 1.8.6 **/ @@ -336,7 +336,7 @@ hb_font_funcs_set_glyph_v_advances_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 0.9.2 **/ @@ -352,7 +352,7 @@ hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 0.9.2 **/ @@ -368,7 +368,7 @@ hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 0.9.2 **/ @@ -384,7 +384,7 @@ hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 0.9.2 **/ @@ -400,7 +400,7 @@ hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 0.9.2 **/ @@ -416,7 +416,7 @@ hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 0.9.2 **/ @@ -432,7 +432,7 @@ hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs, * @user_data: * @destroy: * - * + * * * Since: 0.9.2 **/ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc index 33b51fea43b..0251efac8b5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cff2-table.cc @@ -110,12 +110,10 @@ bool OT::cff2::accelerator_t::get_extents (hb_font_t *font, if (unlikely (!is_valid () || (glyph >= num_glyphs))) return false; - unsigned int num_coords; - const int *coords = hb_font_get_var_coords_normalized (font, &num_coords); unsigned int fd = fdSelect->get_fd (glyph); cff2_cs_interpreter_t<cff2_cs_opset_extents_t, cff2_extents_param_t> interp; const byte_str_t str = (*charStrings)[glyph]; - interp.env.init (str, *this, fd, coords, num_coords); + interp.env.init (str, *this, fd, font->coords, font->num_coords); cff2_extents_param_t param; param.init (); if (unlikely (!interp.interpret (param))) return false; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh index 746e87f48fd..23ea4659d20 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh @@ -993,6 +993,15 @@ struct cmap const CmapSubtable *subtable; + /* Symbol subtable. + * Prefer symbol if available. + * https://github.com/harfbuzz/harfbuzz/issues/1918 */ + if ((subtable = this->find_subtable (3, 0))) + { + if (symbol) *symbol = true; + return subtable; + } + /* 32-bit subtables. */ if ((subtable = this->find_subtable (3, 10))) return subtable; if ((subtable = this->find_subtable (0, 6))) return subtable; @@ -1005,13 +1014,6 @@ struct cmap if ((subtable = this->find_subtable (0, 1))) return subtable; if ((subtable = this->find_subtable (0, 0))) return subtable; - /* Symbol subtable. */ - if ((subtable = this->find_subtable (3, 0))) - { - if (symbol) *symbol = true; - return subtable; - } - /* Meh. */ return &Null (CmapSubtable); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc index d95e5a0b15c..72d65c95041 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc @@ -375,10 +375,14 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font, { if (caret_count) *caret_count = result_caret_count; } -#ifndef HB_NO_AAT else + { +#ifndef HB_NO_AAT result = font->face->table.lcar->get_lig_carets (font, direction, glyph, start_offset, caret_count, caret_array); +#else + if (caret_count) *caret_count = 0; #endif + } return result; } #endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc index fd099cac73e..a04c92074f5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc @@ -131,13 +131,6 @@ indic_features[] = {HB_TAG('b','l','w','s'), F_GLOBAL_MANUAL_JOINERS}, {HB_TAG('p','s','t','s'), F_GLOBAL_MANUAL_JOINERS}, {HB_TAG('h','a','l','n'), F_GLOBAL_MANUAL_JOINERS}, - /* - * Positioning features. - * We don't care about the types. - */ - {HB_TAG('d','i','s','t'), F_GLOBAL}, - {HB_TAG('a','b','v','m'), F_GLOBAL}, - {HB_TAG('b','l','w','m'), F_GLOBAL}, }; /* @@ -163,10 +156,6 @@ enum { _INDIC_PSTS, _INDIC_HALN, - _INDIC_DIST, - _INDIC_ABVM, - _INDIC_BLWM, - INDIC_NUM_FEATURES, INDIC_BASIC_FEATURES = INDIC_INIT, /* Don't forget to update this! */ }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc index b1fa0156aec..cd82900ba11 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc @@ -56,13 +56,6 @@ khmer_features[] = {HB_TAG('a','b','v','s'), F_GLOBAL_MANUAL_JOINERS}, {HB_TAG('b','l','w','s'), F_GLOBAL_MANUAL_JOINERS}, {HB_TAG('p','s','t','s'), F_GLOBAL_MANUAL_JOINERS}, - /* - * Positioning features. - * We don't care about the types. - */ - {HB_TAG('d','i','s','t'), F_GLOBAL}, - {HB_TAG('a','b','v','m'), F_GLOBAL}, - {HB_TAG('b','l','w','m'), F_GLOBAL}, }; /* @@ -80,10 +73,6 @@ enum { _KHMER_BLWS, _KHMER_PSTS, - _KHMER_DIST, - _KHMER_ABVM, - _KHMER_BLWM, - KHMER_NUM_FEATURES, KHMER_BASIC_FEATURES = _KHMER_PRES, /* Don't forget to update this! */ }; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc index 14d215eac31..8b9afa503f2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc @@ -59,25 +59,6 @@ myanmar_other_features[] = HB_TAG('b','l','w','s'), HB_TAG('p','s','t','s'), }; -static const hb_tag_t -myanmar_positioning_features[] = -{ - /* - * Positioning features. - * We don't care about the types. - */ - HB_TAG('d','i','s','t'), - /* Pre-release version of Windows 8 Myanmar font had abvm,blwm - * features. The released Windows 8 version of the font (as well - * as the released spec) used 'mark' instead. The Windows 8 - * shaper however didn't apply 'mark' but did apply 'mkmk'. - * Perhaps it applied abvm/blwm. This was fixed in a Windows 8 - * update, so now it applies mark/mkmk. We are guessing that - * it still applies abvm/blwm too. - */ - HB_TAG('a','b','v','m'), - HB_TAG('b','l','w','m'), -}; static void setup_syllables_myanmar (const hb_ot_shape_plan_t *plan, @@ -114,9 +95,6 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan) for (unsigned int i = 0; i < ARRAY_LENGTH (myanmar_other_features); i++) map->enable_feature (myanmar_other_features[i], F_MANUAL_ZWJ); - - for (unsigned int i = 0; i < ARRAY_LENGTH (myanmar_positioning_features); i++) - map->enable_feature (myanmar_positioning_features[i]); } static void diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc index 1ea2957f261..ffef685babb 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc @@ -88,17 +88,6 @@ use_other_features[] = HB_TAG('p','r','e','s'), HB_TAG('p','s','t','s'), }; -static const hb_tag_t -use_positioning_features[] = -{ - /* - * Positioning features. - * We don't care about the types. - */ - HB_TAG('d','i','s','t'), - HB_TAG('a','b','v','m'), - HB_TAG('b','l','w','m'), -}; static void setup_syllables_use (const hb_ot_shape_plan_t *plan, @@ -154,10 +143,6 @@ collect_features_use (hb_ot_shape_planner_t *plan) /* "Standard typographic presentation" */ for (unsigned int i = 0; i < ARRAY_LENGTH (use_other_features); i++) map->enable_feature (use_other_features[i], F_MANUAL_ZWJ); - - /* "Positional feature application" */ - for (unsigned int i = 0; i < ARRAY_LENGTH (use_positioning_features); i++) - map->enable_feature (use_positioning_features[i]); } struct use_shape_plan_t diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc index c8bda2aad50..d0c66b44613 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc @@ -285,6 +285,8 @@ hb_ot_shape_plan_t::position (hb_font_t *font, static const hb_ot_map_feature_t common_features[] = { + {HB_TAG('a','b','v','m'), F_GLOBAL}, + {HB_TAG('b','l','w','m'), F_GLOBAL}, {HB_TAG('c','c','m','p'), F_GLOBAL}, {HB_TAG('l','o','c','l'), F_GLOBAL}, {HB_TAG('m','a','r','k'), F_GLOBAL_MANUAL_JOINERS}, @@ -299,6 +301,7 @@ horizontal_features[] = {HB_TAG('c','a','l','t'), F_GLOBAL}, {HB_TAG('c','l','i','g'), F_GLOBAL}, {HB_TAG('c','u','r','s'), F_GLOBAL}, + {HB_TAG('d','i','s','t'), F_GLOBAL}, {HB_TAG('k','e','r','n'), F_GLOBAL_HAS_FALLBACK}, {HB_TAG('l','i','g','a'), F_GLOBAL}, {HB_TAG('r','c','l','t'), F_GLOBAL}, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh index 57a3a6d16f8..45f702dbd9e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh @@ -49,9 +49,10 @@ struct AxisValueMap } public: - F2DOT14 fromCoord; /* A normalized coordinate value obtained using - * default normalization. */ - F2DOT14 toCoord; /* The modified, normalized coordinate value. */ + F2DOT14 coords[2]; +// F2DOT14 fromCoord; /* A normalized coordinate value obtained using +// * default normalization. */ +// F2DOT14 toCoord; /* The modified, normalized coordinate value. */ public: DEFINE_SIZE_STATIC (4); @@ -59,12 +60,13 @@ struct AxisValueMap struct SegmentMaps : ArrayOf<AxisValueMap> { - int map (int value) const + int map (int value, unsigned int from_offset = 0, unsigned int to_offset = 1) const { +#define fromCoord coords[from_offset] +#define toCoord coords[to_offset] /* 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 < 2) { if (!len) @@ -91,8 +93,12 @@ struct SegmentMaps : ArrayOf<AxisValueMap> return arrayZ[i-1].toCoord + ((arrayZ[i].toCoord - arrayZ[i-1].toCoord) * (value - arrayZ[i-1].fromCoord) + denom/2) / denom; +#undef toCoord +#undef fromCoord } + int unmap (int value) const { return map (value, 1, 0); } + public: DEFINE_SIZE_ARRAY (2, *this); }; @@ -133,6 +139,18 @@ struct avar } } + void unmap_coords (int *coords, unsigned int coords_length) const + { + unsigned int count = hb_min (coords_length, axisCount); + + const SegmentMaps *map = &firstAxisSegmentMaps; + for (unsigned int i = 0; i < count; i++) + { + coords[i] = map->unmap (coords[i]); + map = &StructAfter<SegmentMaps> (*map); + } + } + protected: FixedVersion<>version; /* Version of the avar table * initially set to 0x00010000u */ @@ -140,7 +158,7 @@ struct avar HBUINT16 axisCount; /* The number of variation axes in the font. This * must be the same number as axisCount in the * 'fvar' table. */ - SegmentMaps firstAxisSegmentMaps; + SegmentMaps firstAxisSegmentMaps; public: DEFINE_SIZE_MIN (8); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh index 18b9518d3a4..f1d024560e5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh @@ -240,6 +240,20 @@ struct fvar return roundf (v * 16384.f); } + float unnormalize_axis_value (unsigned int axis_index, float v) const + { + hb_ot_var_axis_info_t axis; + get_axis_info (axis_index, &axis); + + if (v == 0) + return axis.default_value; + else if (v < 0) + v = v * (axis.default_value - axis.min_value) / 16384.f + axis.default_value; + else + v = v * (axis.max_value - axis.default_value) / 16384.f + axis.default_value; + return v; + } + unsigned int get_instance_count () const { return instanceCount; } hb_ot_name_id_t get_instance_subfamily_name_id (unsigned int instance_index) const |