From 5a9c7930efc8ec055f60cae5ec2567ff8de0e972 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 22 Jul 2022 21:33:15 -0600 Subject: [PATCH] Add HB_NO_BEYOND_64K --- src/hb-config.hh | 4 ++++ src/hb-ot-hmtx-table.hh | 2 +- src/hb-ot-layout-common.hh | 26 +++++++++++----------- src/hb-ot-layout-gdef-table.hh | 32 +++++++++++++-------------- src/hb-ot-layout-gsubgpos.hh | 40 +++++++++++++++++----------------- src/hb-ot-var-avar-table.hh | 2 +- src/hb-static.cc | 4 ++-- 7 files changed, 57 insertions(+), 53 deletions(-) diff --git a/src/hb-config.hh b/src/hb-config.hh index 2578231d2..509768e61 100644 --- a/src/hb-config.hh +++ b/src/hb-config.hh @@ -98,6 +98,10 @@ /* Closure of options. */ +#ifdef HB_NO_BORING_EXPANSION +#define HB_NO_BEYOND_64K +#endif + #ifdef HB_DISABLE_DEPRECATED #define HB_IF_NOT_DEPRECATED(x) #else diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 628c31fbd..50e4b54fd 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -274,7 +274,7 @@ struct hmtxvmtx if (unlikely (!num_advances)) return default_advance; -#ifdef HB_NO_BORING_EXPANSION +#ifdef HB_NO_BEYOND_64K return 0; #endif diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 202be0bf3..357ae6070 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -1915,7 +1915,7 @@ struct ClassDef switch (u.format) { case 1: return u.format1.get_class (glyph_id); case 2: return u.format2.get_class (glyph_id); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 3: return u.format3.get_class (glyph_id); case 4: return u.format4.get_class (glyph_id); #endif @@ -1963,7 +1963,7 @@ struct ClassDef format = 1; } -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K if (glyph_max > 0xFFFFu) format += 2; #endif @@ -1974,7 +1974,7 @@ struct ClassDef { case 1: return_trace (u.format1.serialize (c, it)); case 2: return_trace (u.format2.serialize (c, it)); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 3: return_trace (u.format3.serialize (c, it)); case 4: return_trace (u.format4.serialize (c, it)); #endif @@ -1992,7 +1992,7 @@ struct ClassDef switch (u.format) { case 1: return_trace (u.format1.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter)); case 2: return_trace (u.format2.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter)); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 3: return_trace (u.format3.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter)); case 4: return_trace (u.format4.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter)); #endif @@ -2007,7 +2007,7 @@ struct ClassDef switch (u.format) { case 1: return_trace (u.format1.sanitize (c)); case 2: return_trace (u.format2.sanitize (c)); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 3: return_trace (u.format3.sanitize (c)); case 4: return_trace (u.format4.sanitize (c)); #endif @@ -2020,7 +2020,7 @@ struct ClassDef switch (u.format) { case 1: return u.format1.cost (); case 2: return u.format2.cost (); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 3: return u.format3.cost (); case 4: return u.format4.cost (); #endif @@ -2036,7 +2036,7 @@ struct ClassDef switch (u.format) { case 1: return u.format1.collect_coverage (glyphs); case 2: return u.format2.collect_coverage (glyphs); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 3: return u.format3.collect_coverage (glyphs); case 4: return u.format4.collect_coverage (glyphs); #endif @@ -2052,7 +2052,7 @@ struct ClassDef switch (u.format) { case 1: return u.format1.collect_class (glyphs, klass); case 2: return u.format2.collect_class (glyphs, klass); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 3: return u.format3.collect_class (glyphs, klass); case 4: return u.format4.collect_class (glyphs, klass); #endif @@ -2065,7 +2065,7 @@ struct ClassDef switch (u.format) { case 1: return u.format1.intersects (glyphs); case 2: return u.format2.intersects (glyphs); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 3: return u.format3.intersects (glyphs); case 4: return u.format4.intersects (glyphs); #endif @@ -2077,7 +2077,7 @@ struct ClassDef switch (u.format) { case 1: return u.format1.intersects_class (glyphs, klass); case 2: return u.format2.intersects_class (glyphs, klass); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 3: return u.format3.intersects_class (glyphs, klass); case 4: return u.format4.intersects_class (glyphs, klass); #endif @@ -2090,7 +2090,7 @@ struct ClassDef switch (u.format) { case 1: return u.format1.intersected_class_glyphs (glyphs, klass, intersect_glyphs); case 2: return u.format2.intersected_class_glyphs (glyphs, klass, intersect_glyphs); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 3: return u.format3.intersected_class_glyphs (glyphs, klass, intersect_glyphs); case 4: return u.format4.intersected_class_glyphs (glyphs, klass, intersect_glyphs); #endif @@ -2103,7 +2103,7 @@ struct ClassDef switch (u.format) { case 1: return u.format1.intersected_classes (glyphs, intersect_classes); case 2: return u.format2.intersected_classes (glyphs, intersect_classes); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 3: return u.format3.intersected_classes (glyphs, intersect_classes); case 4: return u.format4.intersected_classes (glyphs, intersect_classes); #endif @@ -2117,7 +2117,7 @@ struct ClassDef HBUINT16 format; /* Format identifier */ ClassDefFormat1_3 format1; ClassDefFormat2_4 format2; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K ClassDefFormat1_3format3; ClassDefFormat2_4format4; #endif diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index 959b96057..5bc26d918 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -621,7 +621,7 @@ struct GDEF { switch (u.version.major) { case 1: return u.version1.get_size (); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return u.version2.get_size (); #endif default: return u.version.static_size; @@ -634,7 +634,7 @@ struct GDEF if (unlikely (!u.version.sanitize (c))) return_trace (false); switch (u.version.major) { case 1: return_trace (u.version1.sanitize (c)); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return_trace (u.version2.sanitize (c)); #endif default: return_trace (true); @@ -645,7 +645,7 @@ struct GDEF { switch (u.version.major) { case 1: return u.version1.subset (c); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return u.version2.subset (c); #endif default: return false; @@ -656,7 +656,7 @@ struct GDEF { switch (u.version.major) { case 1: return u.version1.glyphClassDef != 0; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return u.version2.glyphClassDef != 0; #endif default: return false; @@ -666,7 +666,7 @@ struct GDEF { switch (u.version.major) { case 1: return this+u.version1.glyphClassDef; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return this+u.version2.glyphClassDef; #endif default: return Null(ClassDef); @@ -676,7 +676,7 @@ struct GDEF { switch (u.version.major) { case 1: return u.version1.attachList != 0; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return u.version2.attachList != 0; #endif default: return false; @@ -686,7 +686,7 @@ struct GDEF { switch (u.version.major) { case 1: return this+u.version1.attachList; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return this+u.version2.attachList; #endif default: return Null(AttachList); @@ -696,7 +696,7 @@ struct GDEF { switch (u.version.major) { case 1: return u.version1.ligCaretList != 0; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return u.version2.ligCaretList != 0; #endif default: return false; @@ -706,7 +706,7 @@ struct GDEF { switch (u.version.major) { case 1: return this+u.version1.ligCaretList; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return this+u.version2.ligCaretList; #endif default: return Null(LigCaretList); @@ -716,7 +716,7 @@ struct GDEF { switch (u.version.major) { case 1: return u.version1.markAttachClassDef != 0; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return u.version2.markAttachClassDef != 0; #endif default: return false; @@ -726,7 +726,7 @@ struct GDEF { switch (u.version.major) { case 1: return this+u.version1.markAttachClassDef; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return this+u.version2.markAttachClassDef; #endif default: return Null(ClassDef); @@ -736,7 +736,7 @@ struct GDEF { switch (u.version.major) { case 1: return u.version.to_int () >= 0x00010002u && u.version1.markGlyphSetsDef != 0; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return u.version2.markGlyphSetsDef != 0; #endif default: return false; @@ -746,7 +746,7 @@ struct GDEF { switch (u.version.major) { case 1: return u.version.to_int () >= 0x00010002u ? this+u.version1.markGlyphSetsDef : Null(MarkGlyphSets); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return this+u.version2.markGlyphSetsDef; #endif default: return Null(MarkGlyphSets); @@ -756,7 +756,7 @@ struct GDEF { switch (u.version.major) { case 1: return u.version.to_int () >= 0x00010003u && u.version1.varStore != 0; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return u.version2.varStore != 0; #endif default: return false; @@ -766,7 +766,7 @@ struct GDEF { switch (u.version.major) { case 1: return u.version.to_int () >= 0x00010003u ? this+u.version1.varStore : Null(VariationStore); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return this+u.version2.varStore; #endif default: return Null(VariationStore); @@ -874,7 +874,7 @@ struct GDEF union { FixedVersion<> version; /* Version identifier */ GDEFVersion1_2 version1; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K GDEFVersion1_2 version2; #endif } u; diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 29187f3cf..5acd228b8 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -477,7 +477,7 @@ struct hb_ot_apply_context_t : { c = c_; match_glyph_data16 = nullptr; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K match_glyph_data24 = nullptr; #endif matcher.set_match_func (nullptr, nullptr); @@ -501,11 +501,11 @@ struct hb_ot_apply_context_t : void set_glyph_data (const HBUINT16 glyph_data[]) { match_glyph_data16 = glyph_data; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K match_glyph_data24 = nullptr; #endif } -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K void set_glyph_data (const HBUINT24 glyph_data[]) { match_glyph_data16 = nullptr; @@ -603,7 +603,7 @@ struct hb_ot_apply_context_t : get_glyph_data () { if (match_glyph_data16) return *match_glyph_data16; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K else if (match_glyph_data24) return *match_glyph_data24; #endif @@ -613,7 +613,7 @@ struct hb_ot_apply_context_t : advance_glyph_data () { if (match_glyph_data16) match_glyph_data16++; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K else if (match_glyph_data24) match_glyph_data24++; #endif @@ -622,7 +622,7 @@ struct hb_ot_apply_context_t : backup_glyph_data () { if (match_glyph_data16) match_glyph_data16--; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K else if (match_glyph_data24) match_glyph_data24--; #endif @@ -633,7 +633,7 @@ struct hb_ot_apply_context_t : hb_ot_apply_context_t *c; matcher_t matcher; const HBUINT16 *match_glyph_data16; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K const HBUINT24 *match_glyph_data24; #endif @@ -2607,7 +2607,7 @@ struct Context case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); case 3: return_trace (c->dispatch (u.format3, std::forward (ds)...)); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 4: return_trace (c->dispatch (u.format4, std::forward (ds)...)); case 5: return_trace (c->dispatch (u.format5, std::forward (ds)...)); #endif @@ -2621,7 +2621,7 @@ struct Context ContextFormat1_4 format1; ContextFormat2_5 format2; ContextFormat3 format3; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K ContextFormat1_4 format4; ContextFormat2_5 format5; #endif @@ -3781,7 +3781,7 @@ struct ChainContext case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...)); case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...)); case 3: return_trace (c->dispatch (u.format3, std::forward (ds)...)); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 4: return_trace (c->dispatch (u.format4, std::forward (ds)...)); case 5: return_trace (c->dispatch (u.format5, std::forward (ds)...)); #endif @@ -3795,7 +3795,7 @@ struct ChainContext ChainContextFormat1_4 format1; ChainContextFormat2_5 format2; ChainContextFormat3 format3; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K ChainContextFormat1_4 format4; ChainContextFormat2_5 format5; #endif @@ -4075,7 +4075,7 @@ struct GSUBGPOS { switch (u.version.major) { case 1: return u.version1.get_size (); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return u.version2.get_size (); #endif default: return u.version.static_size; @@ -4089,7 +4089,7 @@ struct GSUBGPOS if (unlikely (!u.version.sanitize (c))) return_trace (false); switch (u.version.major) { case 1: return_trace (u.version1.sanitize (c)); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return_trace (u.version2.sanitize (c)); #endif default: return_trace (true); @@ -4101,7 +4101,7 @@ struct GSUBGPOS { switch (u.version.major) { case 1: return u.version1.subset (c); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return u.version2.subset (c); #endif default: return false; @@ -4112,7 +4112,7 @@ struct GSUBGPOS { switch (u.version.major) { case 1: return this+u.version1.scriptList; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return this+u.version2.scriptList; #endif default: return Null (ScriptList); @@ -4122,7 +4122,7 @@ struct GSUBGPOS { switch (u.version.major) { case 1: return this+u.version1.featureList; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return this+u.version2.featureList; #endif default: return Null (FeatureList); @@ -4132,7 +4132,7 @@ struct GSUBGPOS { switch (u.version.major) { case 1: return (this+u.version1.lookupList).len; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return (this+u.version2.lookupList).len; #endif default: return 0; @@ -4142,7 +4142,7 @@ struct GSUBGPOS { switch (u.version.major) { case 1: return (this+u.version1.lookupList)[i]; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return (this+u.version2.lookupList)[i]; #endif default: return Null (Lookup); @@ -4152,7 +4152,7 @@ struct GSUBGPOS { switch (u.version.major) { case 1: return (u.version.to_int () >= 0x00010001u ? this+u.version1.featureVars : Null (FeatureVariations)); -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K case 2: return this+u.version2.featureVars; #endif default: return Null (FeatureVariations); @@ -4333,7 +4333,7 @@ struct GSUBGPOS union { FixedVersion<> version; /* Version identifier */ GSUBGPOSVersion1_2 version1; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K GSUBGPOSVersion1_2 version2; #endif } u; diff --git a/src/hb-ot-var-avar-table.hh b/src/hb-ot-var-avar-table.hh index a3b346e48..7bd2e2f37 100644 --- a/src/hb-ot-var-avar-table.hh +++ b/src/hb-ot-var-avar-table.hh @@ -192,7 +192,7 @@ struct avar int v = coords[i]; uint32_t varidx = varidx_map.map (i); float delta = var_store.get_delta (varidx, coords, coords_length, var_store_cache); - v += round (delta); + v += roundf (delta); v = hb_clamp (v, -(1<<14), +(1<<14)); out.push (v); } diff --git a/src/hb-static.cc b/src/hb-static.cc index 19113fa07..af95615c1 100644 --- a/src/hb-static.cc +++ b/src/hb-static.cc @@ -58,7 +58,7 @@ const hb_codepoint_t minus_1 = -1; /* hb_face_t */ -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K static inline unsigned load_num_glyphs_from_loca (const hb_face_t *face) { @@ -88,7 +88,7 @@ hb_face_t::load_num_glyphs () const { unsigned ret = 0; -#ifndef HB_NO_BORING_EXPANSION +#ifndef HB_NO_BEYOND_64K ret = hb_max (ret, load_num_glyphs_from_loca (this)); #endif