Skip to content

Commit

Permalink
Merge pull request #97677 from bruvzg/hb1001
Browse files Browse the repository at this point in the history
Update HarfBuzz to 10.0.1
  • Loading branch information
akien-mga committed Oct 2, 2024
2 parents 2bd0fd8 + b6a369d commit 991b741
Show file tree
Hide file tree
Showing 85 changed files with 6,998 additions and 4,760 deletions.
1 change: 1 addition & 0 deletions modules/text_server_adv/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ if env["builtin_harfbuzz"]:
"src/hb-ucd.cc",
"src/hb-unicode.cc",
# "src/hb-uniscribe.cc",
"src/OT/Var/VARC/VARC.cc",
]

if freetype_enabled:
Expand Down
1 change: 1 addition & 0 deletions modules/text_server_adv/gdextension_build/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ thirdparty_harfbuzz_sources = [
"src/hb-ucd.cc",
"src/hb-unicode.cc",
# "src/hb-uniscribe.cc",
"src/OT/Var/VARC/VARC.cc",
]

if env["freetype_enabled"]:
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ Files extracted from upstream source:
## harfbuzz

- Upstream: https://github.com/harfbuzz/harfbuzz
- Version: 8.5.0 (30485ee8c3d43c553afb9d78b9924cb71c8d2f19, 2024)
- Version: 10.0.1 (a1d9bfe62818ef0fa9cf63b6e6d51436b1c93cbc, 2024)
- License: MIT

Files extracted from upstream source:
Expand Down
16 changes: 9 additions & 7 deletions thirdparty/harfbuzz/src/OT/Color/COLR/COLR.hh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public:
hb_map_t current_glyphs;
hb_map_t current_layers;
int depth_left = HB_MAX_NESTING_LEVEL;
int edge_count = HB_COLRV1_MAX_EDGE_COUNT;
int edge_count = HB_MAX_GRAPH_EDGE_COUNT;

hb_paint_context_t (const void *base_,
hb_paint_funcs_t *funcs_,
Expand Down Expand Up @@ -2339,15 +2339,21 @@ struct COLR
c->plan->colrv1_varstore_inner_maps.as_array ()))
return_trace (false);

if (!out->varStore.serialize_serialize (c->serializer,
/* do not serialize varStore if there's no variation data after
* instancing: region_list or var_data is empty */
if (item_vars.get_region_list () &&
item_vars.get_vardata_encodings () &&
!out->varStore.serialize_serialize (c->serializer,
item_vars.has_long_word (),
c->plan->axis_tags,
item_vars.get_region_list (),
item_vars.get_vardata_encodings ()))
return_trace (false);

/* if varstore is optimized, update colrv1_new_deltaset_idx_varidx_map in
* subset plan */
* subset plan.
* If varstore is empty after instancing, varidx_map would be empty and
* all var_idxes will be updated to VarIdx::NO_VARIATION */
if (optimize)
{
const hb_map_t &varidx_map = item_vars.get_varidx_map ();
Expand Down Expand Up @@ -2579,10 +2585,6 @@ struct COLR
{
// COLRv1 glyph

ItemVarStoreInstancer instancer (&(this+varStore),
&(this+varIdxMap),
hb_array (font->coords, font->num_coords));

bool is_bounded = true;
if (clip)
{
Expand Down
18 changes: 9 additions & 9 deletions thirdparty/harfbuzz/src/OT/Layout/GDEF/GDEF.hh
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ struct GDEFVersion1_2
ligCaretList.sanitize (c, this) &&
markAttachClassDef.sanitize (c, this) &&
hb_barrier () &&
(version.to_int () < 0x00010002u || markGlyphSetsDef.sanitize (c, this)) &&
(version.to_int () < 0x00010003u || varStore.sanitize (c, this)));
((version.to_int () < 0x00010002u && hb_barrier ()) || markGlyphSetsDef.sanitize (c, this)) &&
((version.to_int () < 0x00010003u && hb_barrier ()) || varStore.sanitize (c, this)));
}

static void remap_varidx_after_instantiation (const hb_map_t& varidx_map,
Expand Down Expand Up @@ -668,13 +668,13 @@ struct GDEFVersion1_2
// the end of the GDEF table.
// See: https://github.com/harfbuzz/harfbuzz/issues/4636
auto snapshot_version0 = c->serializer->snapshot ();
if (unlikely (version.to_int () >= 0x00010002u && !c->serializer->embed (markGlyphSetsDef)))
if (unlikely (version.to_int () >= 0x00010002u && hb_barrier () && !c->serializer->embed (markGlyphSetsDef)))
return_trace (false);

bool subset_varstore = false;
unsigned varstore_index = (unsigned) -1;
auto snapshot_version2 = c->serializer->snapshot ();
if (version.to_int () >= 0x00010003u)
if (version.to_int () >= 0x00010003u && hb_barrier ())
{
if (unlikely (!c->serializer->embed (varStore))) return_trace (false);
if (c->plan->all_axes_pinned)
Expand Down Expand Up @@ -712,7 +712,7 @@ struct GDEFVersion1_2
}

bool subset_markglyphsetsdef = false;
if (version.to_int () >= 0x00010002u)
if (version.to_int () >= 0x00010002u && hb_barrier ())
{
subset_markglyphsetsdef = out->markGlyphSetsDef.serialize_subset (c, markGlyphSetsDef, this);
}
Expand Down Expand Up @@ -875,7 +875,7 @@ struct GDEF
bool has_mark_glyph_sets () const
{
switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010002u && u.version1.markGlyphSetsDef != 0;
case 1: return u.version.to_int () >= 0x00010002u && hb_barrier () && u.version1.markGlyphSetsDef != 0;
#ifndef HB_NO_BEYOND_64K
case 2: return u.version2.markGlyphSetsDef != 0;
#endif
Expand All @@ -885,7 +885,7 @@ struct GDEF
const MarkGlyphSets &get_mark_glyph_sets () const
{
switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010002u ? this+u.version1.markGlyphSetsDef : Null(MarkGlyphSets);
case 1: return u.version.to_int () >= 0x00010002u && hb_barrier () ? this+u.version1.markGlyphSetsDef : Null(MarkGlyphSets);
#ifndef HB_NO_BEYOND_64K
case 2: return this+u.version2.markGlyphSetsDef;
#endif
Expand All @@ -895,7 +895,7 @@ struct GDEF
bool has_var_store () const
{
switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010003u && u.version1.varStore != 0;
case 1: return u.version.to_int () >= 0x00010003u && hb_barrier () && u.version1.varStore != 0;
#ifndef HB_NO_BEYOND_64K
case 2: return u.version2.varStore != 0;
#endif
Expand All @@ -905,7 +905,7 @@ struct GDEF
const ItemVariationStore &get_var_store () const
{
switch (u.version.major) {
case 1: return u.version.to_int () >= 0x00010003u ? this+u.version1.varStore : Null(ItemVariationStore);
case 1: return u.version.to_int () >= 0x00010003u && hb_barrier () ? this+u.version1.varStore : Null(ItemVariationStore);
#ifndef HB_NO_BEYOND_64K
case 2: return this+u.version2.varStore;
#endif
Expand Down
8 changes: 1 addition & 7 deletions thirdparty/harfbuzz/src/OT/Layout/GPOS/PairPosFormat2.hh
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,8 @@ struct PairPosFormat2_4 : ValueBase
return_trace (false);
}

unsigned int klass2 = (this+classDef2).get_class (buffer->info[skippy_iter.idx].codepoint);
if (!klass2)
{
buffer->unsafe_to_concat (buffer->idx, skippy_iter.idx + 1);
return_trace (false);
}

unsigned int klass1 = (this+classDef1).get_class (buffer->cur().codepoint);
unsigned int klass2 = (this+classDef2).get_class (buffer->info[skippy_iter.idx].codepoint);
if (unlikely (klass1 >= class1Count || klass2 >= class2Count))
{
buffer->unsafe_to_concat (buffer->idx, skippy_iter.idx + 1);
Expand Down
Loading

0 comments on commit 991b741

Please sign in to comment.