Commit Graph

1990 Commits

Author SHA1 Message Date
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