Commit Graph

346 Commits

Author SHA1 Message Date
Garret Rieger a9910e258f [reorg] Move SubstLookup and GSUB into the new layout. 2022-03-23 18:05:24 -06:00
Garret Rieger 90af2143d5 [reorg] Move ReverseChainSingleSubst to new layout. 2022-03-23 18:05:24 -06:00
Garret Rieger 403feb3804 [reorg] Move LigatureSubst to new layout. 2022-03-23 18:05:24 -06:00
Garret Rieger 6a369389d6 [reorg] Move AlternateSubst to new layout. 2022-03-23 18:05:24 -06:00
Garret Rieger dea0681db2 [reorg] Move MultipleSubst into new layout. 2022-03-23 18:05:24 -06:00
Garret Rieger 7dfd9e7001 [reorganization] WIP move single substitution into separate files. 2022-03-23 18:05:24 -06:00
Behdad Esfahbod a575992057 [unsafe-to-concat] Mark LigatureSubst
Failures down to two:

209/401 harfbuzz:shaping+aots / gpos6                            FAIL             0.06s   exit status 1
265/401 harfbuzz:shaping+aots / lookupflag_ignore_attach         FAIL             0.06s   exit status 1
2022-01-22 11:53:18 -07:00
Behdad Esfahbod 78481b32c0 [gsubgpos] Combine input/backtrack/lookahead unsafe-to-concat
I feel like this is correct logic. Still have to prove.

Errors unchanged at 10.
2022-01-22 11:53:18 -07:00
Behdad Esfahbod ac1bb3e39e [machinery] Move accelerators to constructor/destructor 2022-01-20 12:10:05 -07:00
Behdad Esfahbod 94d43c008a [buffer] Merge and rename clear_glyph_flags() 2021-12-04 16:56:39 -08:00
Garret Rieger 49c9392412 [subset] During LigatureSubstFormat1 subsetting always place Coverage last.
In Windows 7 on Chrome if the coverage table comes before any of the LigatureSet or Ligature subtables the font won't load. This changes the packing order to always place the Coverage table last. Virtual links are used to ensure the repacker maintains the desired ordering.

Coincidentally fontTools also does the same thing (a3f988fbf6/Lib/fontTools/ttLib/tables/otTables.py (L1137)) to reduce overflows during packing.
2021-11-02 12:19:13 -06:00
Behdad Esfahbod 6d555ce82e [meta] Use std::forward instead of hb_forward() 2021-11-02 00:18:22 -06:00
Behdad Esfahbod c852b86841 Rename HBGlyphID to HBGlyphID16 2021-09-19 16:30:12 -04:00
Behdad Esfahbod f0a1892ff9 [serialize] Remove unnecessary pointer indirection 2021-07-28 17:36:22 -06:00
Behdad Esfahbod 6fe0d7d6e8 [GSUB] If MultipleSubst is applied to a ligature-component, preserve lig-id
Fixes https://github.com/harfbuzz/harfbuzz/issues/3069
2021-07-28 12:06:49 -06:00
Behdad Esfahbod b926fb9bb0 Whitespace 2021-07-28 11:58:10 -06:00
Behdad Esfahbod 40884af17e [ot-layout] Narrow down random feature logic vs safe-to-break 2021-07-09 16:34:08 -07:00
Garret Rieger cc96c4e87e [shaping] Update shaping substituion lookup serialization to use serializer pop()/pack(). 2021-06-14 16:43:23 -07:00
Garret Rieger 5ba46ed067 [subset] Correct OffsetTo serialization in GSUB to use serialize_serialize (). 2021-06-14 12:18:06 -07:00
Garret Rieger 35458b6b66 [subset] Add serialize_serialize to OffsetTo.
Similar to serialize_subset() this will serialize the new object and then link it to the offset.
2021-06-14 12:18:06 -07:00
Behdad Esfahbod 5639e253f9 Add Array16Of<> 2021-03-31 16:04:43 -06:00
Behdad Esfahbod 6c4e0491d7 s/OffsetArrayOf/Array16OfOffset16To/g 2021-03-31 15:31:32 -06:00
Behdad Esfahbod ad28f973f3 Rename offset types to be explicit about their size
Add Offset16To<>, Offset24To<>, and Offset32To<> for most use-cases.
2021-03-31 13:00:07 -06:00
Qunxin Liu 95230e291d [subset] support subsetting GSUB8 2021-03-29 15:54:11 -06:00
Garret Rieger b14475d2ae [subset] further changes to serializer error handling.
- Rename enum type and enum members.
- in_errors() now returns true for any error having been set. hb-subset now looks for offset overflow only errors to divert to repacker.
- Added INT_OVERFLOW and ARRAY_OVERFLOW enum values.
2021-03-18 10:51:26 -07:00
Garret Rieger 73ed59f7a6 [subset] store errors in the serializer as a flag set.
Make check_assign/check_equal specify the type of error to set.
2021-03-17 15:58:34 -07:00
Qunxin Liu 56ca435787 [subset] fix for collect_features and remove_redundant_lamngsys
previously remove_redundant_sys () is missing in harfbuzz, after
redundant langsys removal, some features are removed as well in
prune_features() in fonttools. This change is trying to get the same
result between harfbuzz and fonttools.
2021-03-17 14:24:04 -07:00
Qunxin Liu 0e1c0fa404 [subset] optimize glyph closure method: step 5
add testcase and some fixes
2021-03-17 15:22:07 -06:00
Qunxin Liu b8a58a0c0b [subset] optimize glyph closure method: step 4
optimize recurse_lookups in Context/ChainContext
glyph closure, only the glyphs that the parent lookup
can apply the recursion to can participate in recursing
the lookup.
2021-03-17 15:22:07 -06:00
Qunxin Liu b4fc593c3c [subset] optimize glyph closure method: step1
Previous GSUB glyph closure is done by recursively visiting
all reachable lookup tables that apply to any glyphs in the
current/input glyph set, but actually only the glyphs that
the parent lookup can apply the recursion to can participate
in recursing the lookup. This is step 1 for glyph closure
optimization:
1. Add stack of currently active glyph set pointers into hb_closure_context_t
2. Update closure() method in simple GSUB tables to use
this stack in order not to change current glyph set at different stages
of recursion
3. Add function may_have_non_1to1() to GSUB tables
2021-03-17 15:22:07 -06:00
Garret Rieger e583505334 [subset] Use plan->glyphset_gsub instead of plan->glyphset for GSUB/GPOS
This matches fontTools behaviour. glyphset_gsub does not contain gids added from closing over composite glyphs in glyf, since these cannot particpate in GSUB/GPOS processing.
2020-09-29 11:16:15 -07:00
Ebrahim Byagowi 5a7cc7fd8b minor spacing tweak 2020-07-29 08:33:38 +04:30
Ebrahim Byagowi d0e2addd43 minor 2020-07-18 22:16:02 +04:30
Behdad Esfahbod b2a1acccd9 Simplify get_glyph_alternates() dispatcher
Trying to make it **very simple** to add a specialized dispatcher for
one API to be routed to just a few objects (one in this case).
2020-06-18 16:41:31 -07:00
Behdad Esfahbod ffe8d3f39d Use dispatch for get_glyph_alternates_t
First time we do this in a way that if target object doesn't have the matching
function we basically "ignore".  Risky but I feel like is the right decision
for this case.

I'm going to put back the template varargs and use those, which would make
the dispatcher be just that: "dispatcher", and wouldn't need to carry the
call context.  That would be a refreshing change I think.
2020-06-18 16:31:39 -07:00
Behdad Esfahbod bedf417121 Push get_glyph_alternates() work all the way down 2020-06-18 15:49:01 -07:00
Ebrahim Byagowi 1bac85828c [layout] Rename _get_alternates to _get_glyph_alternates 2020-06-18 22:56:07 +04:30
Ebrahim Byagowi d3c169792b [layout] move alternate buffer iteration logic to AlternateSet 2020-06-18 09:23:13 +04:30
Ebrahim Byagowi 1348a2c865 [layout] hb_ot_layout_lookup_get_alternates, a new API
An API to retrieve one-to-one alternates from a given GSUB lookup index.
2020-06-18 09:11:07 +04:30
Behdad Esfahbod 41ef75f64a [gsub] Don't substitute in ReverseChainSingleSubstFormat1 if missing substitute
Fixes https://github.com/harfbuzz/harfbuzz/issues/2467
2020-06-17 16:29:09 -07:00
Qunxin Liu 973c47f6c9 [subset] Move 2 experimental public api methods to be private methods in GSUB/GPOS.
2 methods are: hb_ot_layout_closure_lookups and hb_ot_layout_closure_features
2020-06-12 01:20:30 +04:30
Behdad Esfahbod 56719474c2 s/blacklist/blocklist/g 2020-06-05 12:57:23 -07:00
Behdad Esfahbod 5cf53c06e6 Rename add_coverage to collect_coverage 2020-04-24 08:16:03 -07:00
ariza 188a0a47c2 removed default base; replaced w/ bias if required 2020-03-08 22:59:43 +03:30
Ebrahim Byagowi 07504569d5 [gsub] minor format 2020-02-21 13:05:44 +03:30
Garret Rieger 411225426f Fix glyph closure for alternate substitution.
It was not filtering on the glyphs to be retained.
2020-02-21 13:01:23 +03:30
ariza 72cbfb9059 remove empty lookup subtables
Added a variant of subset_offset_array which takes an extra arg passed to serialize_subset for this impl.
Added a new api test "test-subset-gpos" for this.
2020-01-21 16:53:19 -08:00
Qunxin Liu e565d1f9bc [subset] subset lookup/feature/script lists for GSUB/GPOS 2020-01-15 14:04:33 -08:00
Qunxin Liu 0b39c48064 [subset] closure lookups for GSUB/GPOS 2020-01-10 13:11:06 -08:00
Behdad Esfahbod a061e47fcc Change a few HB_INTERNAL static methods to static inline 2019-12-10 13:31:50 -06:00