Commit Graph

254 Commits

Author SHA1 Message Date
Garret Rieger 858570b1d9 [subset] add some additional 32bit var store cases.
Test the path where the 32 bit delta is not included.
2022-06-01 19:31:55 +01:00
Garret Rieger 209d6aa2b7 [subset] Update make files for 32bit_var_store test. 2022-06-01 19:31:55 +01:00
Garret Rieger 9c41bfe1a6 [subset] Add subset test of font with 32 bit delta in a var store. 2022-06-01 19:31:55 +01:00
Garret Rieger 52d59bf150 [perf] Make subset benchmark data driven. 2022-05-10 14:30:08 -06:00
Garret Rieger b051f3fa83 [subset] Fix cpal subsetting when there are partial palette overlaps.
The existing code doesn't correctly handle the case where palettes partially overlap in the color record array. This changes the subsetting to only share entries in the color record array when palettes have the same first color index. Partially overlapping palettes will be converted to disjoint segments in the color record array.

Updates one of the color tests to use multiple palettes.

Also fixes fuzzer: https://oss-fuzz.com/testcase-detail/5568200165687296.
2022-05-09 12:25:05 -06:00
Behdad Esfahbod a003fc0df1 Remove accidental files 2022-03-25 09:37:50 -06:00
Andrew John 0182988229
[set] Add call to export set contents to an array. (#3500)
[set] Add hb_set_next_many.
2022-03-25 09:36:44 -06:00
Qunxin Liu 7cb002cb58 [subset] bug fix in prune_langsys
we should not cache visited langsys cause 2 different Record<Langsys>
could have different Tag while pointing to the same Langsys, a langsys
is redundant in Record<Langsys> A does not mean it's redundant in Record
B. Same thing for visited_script.
Also adding the number of features in the LangSys's feature list to the
visited langsys count so it's more accurate.
Plus some improvement in langsys compare()
2022-03-16 13:08:13 -06:00
Behdad Esfahbod b3f8288cca [test/subset] Don't hash files without reason
Fixes https://github.com/harfbuzz/harfbuzz/issues/3118#issuecomment-894021518
2022-02-12 14:52:42 -06:00
Garret Rieger bc899650c7 [subset] Fix for issue #3397.
cur_intersected_glyphs gets modified during recursion leading to incorrect filtering of sub tables in some cases. So don't use cur_intersected_glyphs. Instead just add an additional entry onto the parent_active_glyphs () stack.

Additionaly expands NotoNastaliqUrdu tests to include coverage of the issue from #3397.
2022-01-28 14:20:33 -08:00
Qunxin Liu 706014f69d [subset] (Chain)ContextSubst glyph_closure fix
- When pos_glyphs is empty, use current full glyphs set as input for
subsequent recursive closure process
- Also increase max_lookup_visit_count to 35000 cause a real font file hit
previous limit 20000 and some lookups are dropped unexpectedly
2021-12-10 11:08:36 -07:00
Qunxin Liu 51655a078e [subset] COLR : only include glyphs after COLR closure 2021-12-06 13:29:21 -07:00
Qunxin Liu 74b46b29e7 [subset] MATH: don't serialize coverage table when iterator is empty
when iterator is empty, just set coverage offset to 0.
serialize() in coverage will at lease write out a 16-bit format header.
2021-12-03 08:00:33 -07:00
Garret Rieger 9121ed0cec [subset] Improve sharing of Ligature subtables.
Ligature subtables use virtual links to enforce an ordering constraint between the subtables and the coverage table. Unfortunately this has the sideeffect of prevent the subtables from being shared by another Ligature with a different coverage table since object equality compares all links real and virtual. This change makes virtual links stored separately from real links and updates the equality check to only check real links. If an object is de-duped any virtual links it has are merged into the object that replaces it.
2021-12-01 08:37:04 -07:00
Garret Rieger 95329081c2 [subset] further optimize cmap4 packing. 2021-11-28 07:47:49 -07:00
Garret Rieger 599143824c [subset] Don't pad glyphs when using long loca. 2021-11-26 18:01:04 -07:00
Garret Rieger d9660fd58a [subset] Make cmap4 packing more optimal.
The current CMAP4 implementation uses whatever the current codepoint ranges are and then encodes them as indivudal glyph ids or as a delta if possible. However, it's often possible to save bytes by splitting up existing ranges and encoding parts of them using deltas where the cost of splitting the range is less than encoding each glyph individual.
2021-11-26 13:21:50 -07:00
Qunxin Liu 903a6baece [subset] layout_features filtering fix
we should not use get_size (), which returns length * item_size
2021-11-25 11:24:41 -07:00
Khaled Hosny 69d8f27c69 [meson] Require 0.55.0
We implicitly require it for building ragel subproject. This new version
requirement should satisfied in both Fedora 33 and Debian bullseye, and
not be too cutting edge for us.
2021-11-22 03:11:36 +02:00
Qunxin Liu 84dc4e85e8 [subset] avoid writing out duplicate extra glyph names in post table
Add check for possible duplicate with other name index
2021-11-19 17:22:35 -07:00
Qunxin Liu ca418cac74 [subset] keep features that have FeatureParams and the tag is "size" 2021-11-19 13:31:25 -07:00
Qunxin Liu e88fc41ef3 [subset] inputSequence could be empty, change the sanity check 2021-11-19 12:57:43 -07:00
Qunxin Liu 540f19b6fe [subset] fix bug in (Chain)ContextFormat2
Only keep rulesets for glyphs class numbers that survived in coverage
2021-11-02 16:05:55 -07:00
Garret Rieger e260eeb9be [subset] Update test goldens for gdef.glyphset. 2021-11-02 16:56:52 -06:00
Qunxin Liu 60e203644b [subset] use glyphset_gsub instead of glyphset for GDEF 2021-11-02 16:56:52 -06:00
Garret Rieger e39647c0f1 [subset] update subset goldens to fix tests. 2021-11-02 16:26:02 -06:00
Qunxin Liu 364b6b3989 [subset] Don't assume FeatureList is sorted
Though the spec said FeatureRecords are sorted alphabetically by feature
tag, there're font files with unsorted FeatureList. And harfbuzz is not
able to subset these files correctly because we use binary search in
finding featureRecords when collecting lookups. Also
find_duplicate_features needs to be updated to handle this.
2021-11-02 15:15:02 -07: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 4262636926
Merge pull request #3248 from googlefonts/connected_components
[repacker] Keep connected subgraphs in the same space.
2021-10-23 13:18:22 -07:00
Qunxin Liu 8c583db9b5 [subset] COLRv1: update subset() method for new strutc ClipList and VarIdxMap
Also fix issues in struct PaintTransform definition
2021-10-23 11:22:39 -07:00
Garret Rieger 79937d24b7 [repacker] Add repacker test that requires space splitting. 2021-10-05 12:53:21 -07:00
Garret Rieger d5beb96e06 [repacker] add repacker isolation test on real font. 2021-09-22 18:18:50 -06:00
Qunxin Liu ca7b9daef0 [subset] subset MATH table 2021-09-22 18:08:30 -04:00
Garret Rieger c2cc566c9d [subset] Fix subset_offset_array adding unused space to serializer.
ArrayOf.serialize_append allocates space for the new item, but ArrayOf.pop() does not recover the allocated space. So in the case where the revert path was entered the extra space added by serialize_append gets left in the serialization buffer. This moves the snapshot to before ArrayOf.serialize_append is called so that revert cleans up the buffer extend.
2021-09-22 16:07:18 -06:00
Qunxin Liu 8c5c81746d [subset] fix find_duplicate_features
We should check each feature against all other features with the same
tag for duplicates.
2021-09-22 15:35:38 -06:00
Qunxin Liu 37379f8f7d [subset] fox for (Chain)ContextFormat3: subset lookupRecord
skip copying a lookupRecord if lookup referenced in the lookupRecord is
not retained after subset
2021-09-08 13:55:21 -06:00
Qunxin Liu 34e0b28fae [subset] make glyph-names option match fonttools behavior
Don't encode psNames that are contained in standard glyph names set
2021-08-20 01:30:23 -06:00
Garret Rieger 44802c8ec4 [subset] use layout-features=* for layout subsetting tests w/ synthetic test fonts. 2021-08-12 14:57:18 -06:00
Behdad Esfahbod 58bfe40794 [util] Move hb-subset away from main-font-text 2021-08-11 20:12:36 -06:00
Khaled Hosny f122698810 [test] Improve generate-expected-outputs.py diff output 2021-08-12 02:02:10 +02:00
Garret Rieger e39c3bde7b [subset] fix bug in parsing glyf flags.
the bytes of the flag stream were being treated as signed integers instead of unsigned as specified in the spec.
2021-08-10 12:57:07 -06:00
Behdad Esfahbod f3acb977ec [test/shaping;util] Use ';' instead of ':' to separate test fields
Accept that in --batch mode. Also in batch mode don't send the 0th arg.

Related discussion: https://github.com/harfbuzz/harfbuzz/pull/3102
2021-08-10 11:08:36 -06:00
Behdad Esfahbod b83fd3a564 [util] Refactor batch-processing code into batch.hh 2021-08-10 02:32:55 -06:00
Garret Rieger c2ee1fdd40 [subset] remove unsed table_entry struct. 2021-08-05 11:47:07 -06:00
Garret Rieger dea0fe5717 [subset] discard extra copies of a table in face builder.
Fixes #2361. Stores tables in the builder in a hashmap so you end up with at most one copy of each table. Table serialization order is now based on tag sort order instead of order of insertion into the builder.
2021-08-05 11:47:07 -06:00
Garret Rieger 2c024dc3cb [subset] prune redundant cmap12 subtables.
If the post subset cmap12 table is equivalent to another cmap subtable don't include the 12 table in the final subset. Matches change https://github.com/fonttools/fonttools/pull/2146 from fontTools.
2021-08-04 17:36:24 -06:00
Khaled Hosny 84946e4d2c [test] Suggest updating the expectation if ttx matches
https://github.com/harfbuzz/harfbuzz/issues/3089#issuecomment-892208892
2021-08-04 17:35:19 -06:00
Khaled Hosny f698fe5aee [test] Always fail subset tests if hashes don’t match
Regardless of the pre sentience or absence of fonttools.
2021-08-04 10:26:14 -06:00
Khaled Hosny 9f544e5008 [test] Don’t skip subset tests early
Check for FontTools only when the checksums are mismatching.
2021-08-04 04:20:14 +02:00
Khaled Hosny b084153317 [test] Remove subset tests from the slow suite 2021-08-04 04:12:31 +02:00