Commit Graph

2185 Commits

Author SHA1 Message Date
Garret Rieger 311413f16b [subset] Fix fuzzer issue.
Fixes https://oss-fuzz.com/testcase-detail/5693568490012672. new_index should be set from new_index2 when the entry is present in the map.
2022-06-14 17:49:13 +01:00
Behdad Esfahbod 697287fbd7 [benchmark-shape,hb-shape-threads] Fix argument parsing order
After recent change.
2022-06-05 06:53:42 -06:00
Behdad Esfahbod c03a31417b [hb-shape-threads] Adjustments similar to benchmark-shape
Duplication sighz.
2022-06-05 02:31:21 -06:00
Behdad Esfahbod d7c9cc34ae Fix build 2022-06-05 02:30:11 -06:00
Behdad Esfahbod b39b5f2f31 [name] Implement approximate language matching
Very rudimentary.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3354
2022-06-03 13:00:33 +01:00
Khaled Hosny 26d8066a41 [test/shape] Remove texts subdirectory
These texts were never hooked into the test suite, they however
represent a good collection of test texts, but one can always access
them from git history.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3123
2022-06-03 12:12:13 +01:00
Khaled Hosny cd41557a96 [test/shape] Add PhagsPa tests
Adopted from texts/in-house/shaper-arabic/script-phags-pa/misc/misc.txt.

Using Noto Sans PhagsPa.
2022-06-03 12:12:13 +01:00
Khaled Hosny 1ab12e314a [test/shape] Add Malayalam dot-reph tests
Adopted from texts/in-house/shaper-indic/script-malayalam/misc/dot-reph.txt.

Using Noto Sans Malayalam.
2022-06-03 12:12:13 +01:00
Khaled Hosny 6b2f3b5a99 [test/shape] Add Javanese tests
Adopted from texts/in-house/shaper-use/script-javanese/misc.txt.

I don’t know what font this was originally tested against, so I used
Noto Sans Javanese.
2022-06-03 12:12:13 +01:00
Khaled Hosny c9c47dd8ad [test/shape] Add Hebrew diacritics tests
Adopted from 406044986a. Using
TaameyFrankCLM.ttf from the Mozilla issue.
2022-06-03 12:12:13 +01:00
Khaled Hosny ef5d7febc8 [test/shape] Allow using hb-subset in record-test.sh
I think it is about time we use our own subsetter here. FontTools can
still be used.
2022-06-03 12:12:13 +01:00
Behdad Esfahbod 7aacdd05bd [cplusplus] Test hashing shared_ptr / unique_ptr 2022-06-03 02:10:06 -06:00
Behdad Esfahbod d7785a6da0 [cplusplus] Add unique_ptr 2022-06-02 12:43:04 -06:00
Behdad Esfahbod e0f3cab246 [cplusplus] Add hb-cplusplus.hh
Fixes https://github.com/harfbuzz/harfbuzz/issues/2152
2022-06-02 18:22:05 +01:00
Garret Rieger 98aaecd397 [subset] fix data race touching Crap() in cff subsetting. 2022-06-01 22:50:35 +01:00
Garret Rieger d8d96b26e7 [threads-test] Add a threads test against hb-subset. 2022-06-01 22:50:35 +01:00
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
Behdad Esfahbod 18cd15bede Rename test 2022-06-01 07:55:59 -06:00
Behdad Esfahbod 62e803b361 [sbix] Limit glyph extents
Fixes https://github.com/harfbuzz/harfbuzz/issues/3557
2022-06-01 07:39:20 -06:00
Behdad Esfahbod 5a058ba158 [shape-fuzzer] Add commented out more buffer-verify option
Those currently fail and I've been unable to debug them.

I tried two, passing them to hb-shape doesn't reproduce the failure. :(
2022-06-01 04:53:50 -06:00
Behdad Esfahbod 189f65344a [fuzz-shape] Verify shape output
Let the fuzzers loose on shape verify.
2022-06-01 04:53:50 -06:00
Behdad Esfahbod 33145a4b75 [test/shape] Pass --unsafe-to-concat to hb-shape 2022-05-31 06:36:08 -06:00
Behdad Esfahbod b010962c3b [test/hb-shape-threads] Silence hb_language_get_default() threadysafety issue 2022-05-30 05:34:25 -06:00
Behdad Esfahbod 4e59900ff5 [test/hb-shape-threads] Share font amongst threads 2022-05-30 05:21:55 -06:00
Behdad Esfahbod 18b0bd0f5f [test/hb-shape-threads] Verify buffer 2022-05-30 05:12:12 -06:00
Behdad Esfahbod 484cc18732 [test-shape-threads] Set language 2022-05-30 05:09:53 -06:00
Behdad Esfahbod f371789b40 Sprinkle static around 2022-05-30 05:09:53 -06:00
Behdad Esfahbod 4386626ee0 [test/threads] Fix dependency 2022-05-30 05:09:53 -06:00
Behdad Esfahbod e0544c481d [test/threads] Fix distcheck 2022-05-30 05:09:53 -06:00
Behdad Esfahbod e3d5a117a3 [hb-shape-threads] Fix tsan race 2022-05-30 05:09:53 -06:00
Behdad Esfahbod 33c990f0a9 Include cassert to fix bots 2022-05-30 05:09:53 -06:00
Behdad Esfahbod 049af18684 [threads] Add suite to test 2022-05-30 05:09:53 -06:00
Behdad Esfahbod 87453f63fa [hb-shape-threads] Fix current-work-dir so test passes 2022-05-30 05:09:53 -06:00
Behdad Esfahbod f77faf8654 [hb-shape-threads] Allow overriding test parameters from cmdline 2022-05-30 05:09:53 -06:00
Behdad Esfahbod f0fba59969 [hb-shape-threads] Reduce num-iterations 2022-05-30 05:09:53 -06:00
Behdad Esfahbod e8a2436332 [threads] Add a condition_variable to test for all threads to be ready 2022-05-30 05:09:53 -06:00
Behdad Esfahbod 4d42a94c19 [threads] Add hb-shape-threads test 2022-05-30 05:09:53 -06:00
Garret Rieger 3472f73b79 [subset] also include no subset tables when guessing which tables are present. 2022-05-25 21:52:48 +00:00
Garret Rieger 9564d98739 [subset] fix subsetting of faces created via hb_face_create_for_tables.
Fixes #3609.
2022-05-25 21:16:37 +00:00
Garret Rieger 4e11da054d [repacker] update repacker test golden file.
Changed due to removal of Kahn sorting.
2022-05-20 09:41:18 -06:00
Behdad Esfahbod 25393288f0 [test] Fix compiler warning 2022-05-19 18:16:48 -06:00
Garret Rieger 52d59bf150 [perf] Make subset benchmark data driven. 2022-05-10 14:30:08 -06:00
Garret Rieger 8f9f0c494b [subset] Enforce cmap12 group ordering constraints in collect_mapping.
Fixes fuzzer issue: https://oss-fuzz.com/testcase-detail/6365271012540416
2022-05-10 12:15:09 -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 ca8a0f3ea3 [gvar] Protect against out-of-range access
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47281
Fixes https://oss-fuzz.com/testcase-detail/5508865908670464
2022-05-06 11:54:38 -06:00
Behdad Esfahbod 4de5352a3d [test] Add test
From https://github.com/harfbuzz/harfbuzz/issues/3545

Dropped the CFF table.
2022-04-28 14:40:33 -06:00
Behdad Esfahbod 4d48fae4f2 Enforce Regional_Indicators native direction to LTR
And undo the morx direction reversal change introduced in
https://github.com/harfbuzz/harfbuzz/pull/3315
23159084b4

This fixes original bug https://github.com/harfbuzz/harfbuzz/issues/3314

And the reversion in morx code fixes regressions:
https://github.com/harfbuzz/harfbuzz/issues/3528
https://github.com/harfbuzz/harfbuzz/issues/3535

Supersedes:
https://github.com/harfbuzz/harfbuzz/pull/3529
2022-04-21 11:15:34 -06:00
Khaled Hosny 383c11d756 Add test for ligature-id allocation
Test for the fix in 7bdc20ec81 for the
regression from 43be5ba442.
2022-04-19 16:33:57 +02:00
David Corbett ecb3e7ec92 Enable indic-feature-order.tests 2022-03-28 18:02:36 -06:00
Behdad Esfahbod 044d7a06db [indic-like] Add per-lookup per-syllable flag
This allows mix-and-matching per-syllable and other lookups.
In fact, removes the clear-syllables call completely.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3513
2022-03-28 17:39:54 -06:00
Behdad Esfahbod 18c0290cf5 Add test for previous commit 2022-03-28 13:24:16 -06:00
Behdad Esfahbod a665e29ed7 [use] Avoid O(n^2) in the machine
Fixes https://github.com/harfbuzz/harfbuzz/issues/3502
2022-03-25 15:17:55 -06:00
Behdad Esfahbod ccd9161bfd [apply-lookup] Try to fix the logic for contextual lookups
Fixes https://github.com/harfbuzz/harfbuzz/issues/1611

Notably, this fixes Myles's AdditionFont:
https://litherum.blogspot.com/2019/03/addition-font.html

Test with AdditionFont, eg.:
$ util/hb-view AdditionFont.otf =1112112+1113134=
2022-03-25 15:14:40 -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
Khaled Hosny f76ffa8374 [build] Change how platform shaper tests are enable
Run the tests unconditionally and skip if the shaper is not available.
This fixes distcheck (https://github.com/harfbuzz/harfbuzz/pull/3504)
and shows SKIP for these tests instead of ignoring them.
2022-03-24 06:48:12 +02:00
Chun-wei Fan eb44d64bc2 test: Dist the platform shaper test data
For builds from release tarballs, the tests fail in the DirectWrite and
Uniscribe tests when these platform shapers are enabled, since the data files
were not found in the source tree, when building with Meson at least.

Fix this by dist'ing the platform shaper test data files.
2022-03-24 11:25:50 +08:00
Behdad Esfahbod 36b8f97413 Update tests for recent changes 2022-03-21 21:50:04 -06:00
Behdad Esfahbod 03085132ba [buffer] Fix out-buffer under memory-alloc failure
This was broken in July refactoring of the buffer, and exposed to
ReverseChainSingleSubstFormat1 in 3807061d63

Fixes:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38800
https://bugs.chromium.org/p/chromium/issues/detail?id=1303552
2022-03-21 18:09:06 -06:00
David Corbett 98b4852434 [indic] Test clearing syllables earlier 2022-03-21 15:42:08 -06:00
Andy John ef588ea97b Add option to insert a sorted arrays of values to sets. 2022-03-21 15:32:59 -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
David Corbett 49fb8f9072 [USE] Treat visible viramas like dependent vowels 2022-03-13 14:45:27 -06:00
Qunxin Liu a35757c6bc [repacker] expose hb_subset_repack() API, hb_object_t and hb_link_t structs 2022-03-10 17:26:20 -07:00
Garret Rieger f6071c16b0
[subset] Rename codepoint -> unicode in subset plan api 2022-02-28 23:45:40 +02:00
Behdad Esfahbod 222301bfa4
Merge pull request #3429 from harfbuzz/external_plan
[subset] expose subset plan in public subsetting API
2022-02-24 12:55:01 -07:00
Matthias Clasen d4cb07728c Add a missing file
The style test is using notosansitalic.ttf now,
but I forgot to add it with the test. Fix that.
2022-02-18 18:27:02 -06:00
Matthias Clasen 16b232be0e [hb-style] Fix the sign of slant ratios
We want negative slant angles to yield
positive slant ratios. Fix that.

Test included.
2022-02-18 18:10:34 -06:00
Matthias Clasen e76061a737 [hb-style] Fix synthetic slant values
When reporting the slant ratio of a font
that has synthetic slant set, we were
reporting twice the expected value.
Fix that. Test included.
2022-02-18 17:53:54 -06:00
Behdad Esfahbod 56f11ec938 [buffer] Add HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT
Fixes https://github.com/harfbuzz/harfbuzz/issues/3454
2022-02-18 17:52:27 -06:00
Behdad Esfahbod f8e9e315bb
Merge pull request #3437 from matthiasclasen/synthesize-missing-baselines
[BASE] Synthesize missing baselines
2022-02-17 14:34:46 -06:00
Matthias Clasen f81578fd86 [ot-layout] Synthesize missing baselines
Add a variation of hb_ot_layout_get_baseline that
synthesizes missing baselines, using heuristics in part
taken from the CSS Inline Layout Module, Level 3.

Includes some new tests for synthesized baselines.
The base2.ttf is a subset of Noto Sans Bengali that
includes just the Bengali Ka.

New API: hb_ot_layout_get_baseline_with_fallback
2022-02-16 17:37:33 -06:00
Behdad Esfahbod d2998faad3
Merge pull request #3410 from harfbuzz/boring-expansion
[Boring Expansion] >64k loca & hmtx tables

This does two things:

The num-glyphs reported by the face now is the maximum reported by the maxp and that deduced from the length of the loca table; I think this is the right thing to do anyway; According to OpenType such loca tables are invalid.

The interpretation hmtx tables that have excessive bytes at the end, again, invalid according to OpenType, has changed. Previously we were interpreting those excessive bytes as extra lsb values. Now we interpret them as extra advance values, the last of which is repeated for all missing glyphs. Again, these are tables that are invalid according to OpenType, and the advances are for glyph indices beyond maxp table's num-glyphs.

The combined effect is that the font can have shapes and advances for gid's beyond the maxp limit of 64k. In fact, maxp table becomes optional.
2022-02-16 14:37:09 -06:00
Khaled Hosny cfa8cd7fb0 [autotools] Fix make distcheck
The test-draw.c can now optionally uses hb-ft, but automake file was not
passing FreeType cflags or libs to it.
2022-02-16 11:58:38 +02:00
Behdad Esfahbod a396543ae1
Merge pull request #3411 from harfbuzz/draw
[draw] Finish and release draw API
2022-02-15 18:47:55 -06:00
Behdad Esfahbod 67eb9acf79 [config] Add HB_NO_BORING_EXPANSION 2022-02-15 17:17:49 -06:00
Behdad Esfahbod 1bf588e28b [test/shape] Internal rename
Residual from e0d7060f80
2022-02-15 16:57:23 -06:00
Behdad Esfahbod 197ed8f592 [test/api] Fix leaks 2022-02-15 14:30:12 -06:00
Behdad Esfahbod 531c27d199 Fix build 2022-02-15 14:20:54 -06:00
Behdad Esfahbod 8b7ccc41c4 [hmtx] Implement [boring-expansion] >64k expansion
This implements https://github.com/be-fonts/boring-expansion-spec/issues/7
2022-02-15 14:15:12 -06:00
Behdad Esfahbod 379e526aa4 [test] Add test for current hmtx logic 2022-02-14 15:02:31 -06:00
Behdad Esfahbod ed6d287d11 [ot-face] Load num-glyphs from `loca` table before `maxp`
Implements [boring-expansion] [maxp] Relax
https://github.com/be-fonts/boring-expansion-spec/issues/6
2022-02-14 13:52:30 -06:00
Ebrahim Byagowi 6b75a30a73 [draw/test] Swap a freetype test case with a simpler one
As CI failure, apparently the my local freetype and CI one have different
result so let's switch the case with a simpler one just to test quadratic command
is emitted correctly.
2022-02-14 01:54:33 +03:30
Behdad Esfahbod ae223764a3 [test/draw] Typo 2022-02-13 15:39:14 -06:00
Ebrahim Byagowi 0429921c10 [draw/test] Add test for freetype callback
Let's have that part of the code also covered.
2022-02-14 00:18:13 +03:30
Ebrahim Byagowi d4588204e5 [draw/glyf] Emit empty contours
This makes it actually match freetype behaviour even though rasterizer
should filter such contours specially for stroking.

See https://github.com/harfbuzz/harfbuzz/pull/3411#discussion_r802283827 for the context.
2022-02-13 23:50:53 +03:30
Khaled Hosny 0e357c504c [draw] Test scaling subfont differently from parent 2022-02-13 13:21:15 -06:00
Behdad Esfahbod 151f205819 [draw] Emit move_to immediately, like other operators 2022-02-13 13:21:15 -06:00
Khaled Hosny aca80a4a40 [draw] Add test for applying synthetic slant 2022-02-13 13:21:15 -06:00
Khaled Hosny 052fd2d8b9 [draw] Add test for hb_draw_move_to() etc 2022-02-13 13:21:15 -06:00
Behdad Esfahbod f1a9a9ccaf [draw-state] Pass state down to callbacks 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 9f05362d43 [test-draw] Fix compiler warning 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 1740916ede [draw] Remove check for no-op
This is unnecessary overhead. Up to rasterizers to handle this.  Plus,
this throws off point-numbers in uses that rely on it.

Disabled one test that broke with this.
2022-02-13 13:21:14 -06:00
Behdad Esfahbod 5610fa1da0 [test-draw] Re-enable two disabled tests 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 8b4f429000 [draw] Virtualize hb_font_draw_glyph() into hb_font_get_glyph_shape()
To be implemented in hb-ft.
2022-02-13 13:21:14 -06:00
Behdad Esfahbod 2bed4f46fb [draw] Fix draw signatures 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 08e1096609 [draw-fuzzer] Fix signatures 2022-02-13 13:21:14 -06:00
Behdad Esfahbod e0ac6c587b Remove remaining traces of HB_EXPERIMENTAL_API 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 5207ce828a [draw] Enable draw tests
Disable two failing ones.
2022-02-13 13:21:14 -06:00
Behdad Esfahbod 157caf254e [test-draw] Fix compiler warning 2022-02-13 13:21:14 -06:00
Behdad Esfahbod b263371b09
Merge pull request #3398 from harfbuzz/buffer-verify
Add HB_BUFFER_FLAG_VERIFY
2022-02-12 15:06:47 -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
Behdad Esfahbod af407dd24d Add a fuzzer font 2022-02-12 14:22:35 -06:00
Garret Rieger 670ef070bd [subset] Change subset plan create to be or_fail. 2022-02-11 16:01:33 -08:00
Garret Rieger ae8d373bcf [subset] add subset plan reference, set/get user data functions. 2022-02-11 14:54:23 -08:00
Garret Rieger b65e48a786 [subset] Add subset plan to public API.
Add the ability to create a subset plan which an be used to gather info on things like glyph mappings in the final subset. The plan can then be passed on to perform the subsetting operation.
2022-02-11 14:37:21 -08:00
Alexis King 81754a5a96 [ot-math] Add hb_ot_math_get_glyph_kernings
closes #3396
2022-02-09 12:03:07 -06:00
Alexis King 1bc4bad7a5 [ot-tag] Add HB_SCRIPT_MATH (Zmth) and map it to OT ‘math’ tag
The ISO 15924 code for mathematical notation is ‘Zmth’, but the
OpenType script is ‘math’.
2022-02-08 12:40:15 -06:00
Behdad Esfahbod 7657bdd91f Revert "Fix failing Mac test for previous commit"
This reverts commit 070e30e6da.
2022-02-04 19:16:54 -06:00
Behdad Esfahbod 44da4e2a27 Revert "One more fix"
This reverts commit cab943a015.
2022-02-04 19:16:47 -06:00
Behdad Esfahbod 88798ee8be [GPOS] Disable split-kerning
Fixes https://github.com/harfbuzz/harfbuzz/issues/3408
Reverts https://github.com/harfbuzz/harfbuzz/pull/3235
Fixes https://github.com/harfbuzz/harfbuzz/pull/3235#issuecomment-1029814978
2022-02-04 19:01:57 -06:00
Garret Rieger 4e2f409bce [subset] Don't hold references to members of the active_glyph_stack.
These references may get invalidated after the vector for the stack is resized. Fixes: https://oss-fuzz.com/testcase-detail/5422577634377728
2022-01-31 22:58:53 +02: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
Behdad Esfahbod 61856359cb [fuzz] Disable verification for now. 2022-01-28 14:07:29 -07:00
Behdad Esfahbod 6596e42d16 [fuzz] Verify shape results 2022-01-28 13:55:24 -07:00
Behdad Esfahbod 909e34f68a [unsafe-to-concat] Adjust Arabic-joining start boundary condition more 2022-01-22 11:53:18 -07:00
Behdad Esfahbod cab943a015 One more fix 2022-01-20 14:32:30 -07:00
Behdad Esfahbod 070e30e6da Fix failing Mac test for previous commit 2022-01-20 14:31:31 -07:00
Behdad Esfahbod 84aa1a836c
[PairPos] Split GPOS kerning to both sides (#3235) 2022-01-20 14:18:19 -07:00
Khaled Hosny 1522015bb2 [test] Add --single-par to more places in hb-aots-tester [ci skip] 2022-01-19 23:15:45 +02:00
Behdad Esfahbod 7e160dc347 [gpos] Fix unsafe-to-break of mark-attachment
This was undetected because most of the time marks were in same
cluster of their base already.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3093
2022-01-19 09:27:55 -07:00
Behdad Esfahbod c8195dbc01
Merge pull request #3365 from harfbuzz/gdef-fix
GDEF fix
2022-01-19 06:56:05 -08:00
Simon Cozens 282642311f Test for #2140 2022-01-19 16:05:09 +02:00
Simon Cozens fc5354c5e5 Add test for #2516 2022-01-19 16:04:58 +02:00
luz paz e2e305066a Fix various typos
Found via `codespell -q 3 -S ./perf/texts -L actualy,ba,beng,fo,gir,inout,nd,ot,pres,ro,te,teh,timne`
2022-01-16 05:39:03 -08:00
Garret Rieger 87496bf63e [subset] fix fuzzer timeout if visisted_paint goes into error. 2022-01-13 11:08:24 -08:00
Garret Rieger 067f90a820 [subset] Fix for fuzzer timeout.
Fixes https://oss-fuzz.com/testcase-detail/5549945449480192

In prune_langsys: move LangSys visited check up before any work is done for a LangSys. In this particular case the compare() method is responsible for the majority of the time spent and wasn't being guarded with a visisted check.
2021-12-14 17:34:21 -07:00
Garret Rieger c4573c2ec7 [repacker] don't infinite loop if visited or roots is in error.
Fixes https://oss-fuzz.com/testcase-detail/5205038086094848
2021-12-14 15:57:48 -07:00
Behdad Esfahbod 23159084b4 [morx] Reverse graphemese, not whole buffer
Fixes https://github.com/harfbuzz/harfbuzz/issues/3314
Supersedes https://github.com/harfbuzz/harfbuzz/pull/3315
2021-12-10 15:02:57 -07: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
Khaled Hosny 6c81cd9543 [tests] Add tests for platform shapers
Fixes https://github.com/harfbuzz/harfbuzz/issues/3115
2021-12-01 19:55:48 +02: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
Behdad Esfahbod 720ab0883b [util] Add --single-par
Use it in aots tests

Fixes https://github.com/harfbuzz/harfbuzz/issues/3129
Related https://github.com/harfbuzz/harfbuzz/issues/3298
2021-11-25 11:49:16 -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
Garret Rieger ace98cc65f [subset] Only sanitize recursion depth in COLR. 2021-11-10 10:34:46 -07:00
Garret Rieger f51b48c8e7 [subset] Fix fuzzer found memory leak.
Happens because an insert into a map with an invalid key reports successful, but this causes the set being inserted to be lost.
2021-11-02 17:00:07 -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 0a7563a53f [subset] fuzzer fix: https://oss-fuzz.com/testcase?key=6254792024915968
Make sure input is valid, each gid has a corresponding offset value in
the map
2021-11-02 15:25:18 -07: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
Matthias Clasen 8dc86d0703 Add a test font scale rounding behavior
This test verifies the fix for
https://github.com/harfbuzz/harfbuzz/issues/3274
2021-11-01 17:59:48 -07:00
Qunxin Liu 85deddb16e [subset] fuzzer fix: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40406 2021-10-27 16:16:15 -07: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
David Corbett 8eaee2f887 [USE] Only skip default ignorables within CCSes 2021-10-08 10:15:08 -06:00
Garret Rieger 79937d24b7 [repacker] Add repacker test that requires space splitting. 2021-10-05 12:53:21 -07:00
Khaled Hosny bb57df7a4f [test] Add test for https://github.com/harfbuzz/harfbuzz/issues/2757#issuecomment-933531978 2021-10-05 16:04:10 +02:00
Khaled Hosny 1624550377 [test] Add test for https://github.com/harfbuzz/harfbuzz/issues/3244 2021-10-05 16:04:10 +02:00
Qunxin Liu 794b00db4b [subset] fuzzer fix: https://oss-fuzz.com/testcase-detail/6616166961905664 2021-09-29 10:29:06 -06: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
Garret Rieger 74f96d9d4b [repacker] fix heap use after free in repacker.
Don't store a reference to the link in overflow records as the link object may be freed if the sorted graph vector is resized.
2021-09-19 09:06:17 -06:00
Garret Rieger d700646c33 [subset] In preperation for 3.0.0 release remove legacy subsetting api methods. 2021-09-16 15:31:29 -06:00
David Corbett a0101a31b5 [Unicode 14] Add tests 2021-09-14 18:38:50 -04:00
Khaled Hosny 4d9b7de0b6 [style] Prepare for release 2021-09-13 10:10:10 -06:00
Behdad Esfahbod 201cbe3c66 [style] Rename HB_STYLE_TAG_SLANT to HB_STYLE_TAG_SLANT_ANGLE 2021-09-10 04:59:16 -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
Khaled Hosny 9fddbb3e24 [test] Rename test and split into smaller subtests 2021-09-03 18:24:40 +02:00
Khaled Hosny c6bb719e65 [test] Add tests for Arabic decomposition
Test that both NFC and NFD input produces identical results for fonts
that used composed fonts internally (Amiri here) and fonts that
decompose internally (Noto Nastaliq Urdu here) and that for the former
composed forms are used.

See https://github.com/harfbuzz/harfbuzz/issues/3179
2021-09-03 08:58:35 -06:00
Khaled Hosny a9dc4fbeac [test] Make shape test names match file names
No idea why test names are underscorified but it it just makes calling
meson test testname harder than it should being not able to copy file
name directly.
2021-09-03 08:56:34 -06:00
Garret Rieger 102666dab7 [subset] add test for hb_subset_input_set (...). 2021-08-27 10:36:42 -07:00
Behdad Esfahbod 99356ea5f0
Merge pull request #3150 from harfbuzz/item-context-tests
[test] Add tests for item context
2021-08-25 17:19:06 -06:00
Behdad Esfahbod 955f86a034 [test-set] Fix compiler warnings 2021-08-24 23:16:24 -06:00
Garret Rieger f2441a4b65 [subset] Remove retain all layout features flag.
Instead use inverted sets to handle requesting all features. Modifies feature collection in subset plan to intersect the set of requested features against the features in the font. This prevents iterating a fully filled feature tag set.
2021-08-24 18:17:07 -06:00
Garret Rieger f84daccb4f [set] include null pool sets in the permutations tested by inverted_operations. 2021-08-24 16:51:11 -06:00
Garret Rieger fb07f8f876 During subset input creation check for set alloc failures and fail if encountered. 2021-08-24 10:59:14 -06:00
Khaled Hosny 33bfe9edd6 [test] Add tests for item context
Test pre-context and post-context in Arabic shaper, as well as
interaction of pre-context with BOT flag.
2021-08-24 02:12:34 +02: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
Behdad Esfahbod 829b0f3353
Merge pull request #3154 from harfbuzz/set-invert
Resurrect hb_set_invert()
2021-08-20 01:28:15 -06:00
Garret Rieger 915550ab19 [set] remove inverted test TODO. 2021-08-19 17:48:38 -07:00
Garret Rieger c4ed582997 [set] add test for inverted set operations.
This test checks all possible set configurations against each operation type.
2021-08-19 17:47:41 -07:00
Garret Rieger 325fd6ddb8 [set] add tests for inverted set equality. 2021-08-19 15:54:31 -07:00
Garret Rieger 287032af6c [set] update set test TODO list. 2021-08-19 15:45:28 -07:00
Garret Rieger 5c003d80a6 [set] add tests for inverted previous iteration. 2021-08-19 15:41:12 -07:00
Garret Rieger 3f2cc582f2 [set] add basic and iteration set inverion tests. 2021-08-19 15:05:10 -07:00
Garret Rieger dc31920bbe Don't serialize null offsets in CPAL.
Fixes https://oss-fuzz.com/testcase-detail/5443213648330752
2021-08-18 16:52:45 -06:00
Garret Rieger cb05c363d7 [subset] add some basic tests for the legacy subset methods. 2021-08-14 10:37:02 -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
Garret Rieger c0f3af91b8 [subset] speed up add_gid_and_children and adjust op limit.
Fix for fuzzer timeout: https://oss-fuzz.com/testcase-detail/5001604901240832.

- Operation limit is per glyph, so 100,000 should still be far more than needed.
- Switches from for(...) to while(...) loop for iteration. for(...) calls it.end() which in this case triggers a complete iteration.
- Cache CompositeGlyph size in the iterator to avoid needing to recalculate it.
2021-08-12 14:50:42 -06:00
Behdad Esfahbod 23282c9c9d [util/hb-subset] Support ranges in --unicodes / --unicodes-file
Fixes https://github.com/harfbuzz/harfbuzz/issues/3109
2021-08-11 22:49:47 -06:00
Behdad Esfahbod 58bfe40794 [util] Move hb-subset away from main-font-text 2021-08-11 20:12:36 -06:00
Behdad Esfahbod 3147e081da Merge branch 'main' into post-parse 2021-08-11 19:33:00 -06:00
Khaled Hosny 43722cc9f4 [test] Add some real reverse sub tests 2021-08-11 19:30:16 -06:00
Behdad Esfahbod e0d7060f80 [test] Rename shaping/ to shape/ 2021-08-11 18:49:59 -06:00