Commit Graph

60 Commits

Author SHA1 Message Date
Behdad Esfahbod 47e7a1800f Revert "Fix Context lookup application when moving back after a glyph delete"
This reverts commit b9b005f3a4.

This introduced invalid access cases. Revert until I fix correctly.
2017-03-10 13:23:02 -08:00
Behdad Esfahbod b9b005f3a4 Fix Context lookup application when moving back after a glyph delete
This was broken forever, since days that we did not allow moving
tape backwards. Works now. Reported by Doug Felt.
2017-03-01 14:27:23 -08:00
Behdad Esfahbod a11501444c Add few tests found by libFuzzer and oss-fuzz 2017-02-25 13:37:54 -08:00
jfkthame 44f7d6ecde Guard against underflow when adjusting length (#421)
* Guard against underflow when adjusting length

With the fuzz-testcase in mozilla bug 1295299, we end up with a recursed lookup that removes 3 items, when `match_positions[idx]` is 0, which results in (unsigned) `end` wrapping to a huge value.

Making `end` a signed int is probably the simplest route to a fix.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1295299.

* Add testcase for #421.
2017-02-16 19:03:24 -08:00
jfkthame 45766b673f [indic] Add support for Grantha marks that may be used in Tamil to th… (#401)
* [indic] Add support for Grantha marks that may be used in Tamil to the Indic table.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1331339.

Testcase: U+0BA4,U+0BC6,U+1133c,U+0BAA,U+1133c,U+0BC6,U+1133c

* [indic] Add test for Grantha nukta that is allowed in Tamil by ScriptExtensions.txt
2017-02-16 09:40:21 -08:00
Behdad Esfahbod e888f642db Route Adlam through Arabic shaper
Fixes joined Adlam rendering.

Fixes https://github.com/googlei18n/noto-fonts/issues/828
2017-01-26 14:50:14 -08:00
Khaled Hosny 2452543fdd [ot] Fix automatic fraction for RTL scripts (#405)
The numbers for right-to-left scripts are processed also from right to
left, so the order of applying “numr” and “dnom” features should be
reversed in such case.

Fixes https://github.com/behdad/harfbuzz/issues/395
2017-01-18 12:48:13 -08:00
Behdad Esfahbod 31f7b1bb94 Add tests for USE using Marchen font and text
From http://www.babelstone.co.uk/Fonts/Marchen.html
2017-01-05 20:20:06 -08:00
Behdad Esfahbod 4b4a1b9f23 Fix assert fail with contextual matching
As discovered by libFuzzer / Chromium fuzzing.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=659496
CC https://github.com/behdad/harfbuzz/issues/139
2016-12-21 23:14:16 -06:00
Behdad Esfahbod 9f6144cdb9 [CBDT] Add test for fetching glyph extents 2016-12-04 19:55:17 -08:00
Behdad Esfahbod d163cd9562 [tests] Add tests for vertical origin with ft and ot font-funcs 2016-10-26 18:27:48 +02:00
Behdad Esfahbod f1b76275da Add tests for Chinese language tags
Using font from https://github.com/behdad/harfbuzz/issues/300
2016-08-08 18:06:09 -07:00
Behdad Esfahbod 9b6312f945 [use] Update to draft spec from Andrew Glass from August 2015 2016-05-06 17:41:49 +01:00
Behdad Esfahbod f00ab2a33a [hb-ot-font] Make 'glyf' table loading lazy
Apparently some clients have reference-table callbacks that copy the table.
As such, avoid loading 'glyf' table which is only needed if fallback positioning
happens.
2016-05-02 10:24:00 +02:00
Behdad Esfahbod b20305022a Do NOT ignore Mongolian Free Variation Selectors during matching
Fixes https://github.com/behdad/harfbuzz/issues/234
2016-04-26 16:41:17 -07:00
Behdad Esfahbod 6e55199b5f Add test for 6dd80faf0d 2016-04-04 16:24:27 -07:00
Behdad Esfahbod 284481b312 Add test for mark positioning in rtl with non-zero mark advance
Apparently I broke this 86c68c7a2c.
Fix coming.
2016-02-24 15:52:37 +09:00
Behdad Esfahbod f8ee7906d0 Remove MANIFEST files
They are unused currently.  We can add later if we hook them up
to anything useful.
2016-02-23 13:45:38 +09:00
Behdad Esfahbod c373155904 [fuzzing] Add test for recent fix
Test from https://github.com/behdad/harfbuzz/issues/223

I forgot that we do run hb-fuzzer on tests in shaping/tests/fuzzed.tests.
2016-02-19 15:13:07 +07:00
Behdad Esfahbod da41e48f0a [USE] Zero mark advances by GDEF early
This is what Microsoft's implementation does.  Marks that need advance
need to add it back using 'dist' or other feature in GPOS.  Update tests to
match.
2016-02-16 17:16:33 +07:00
Behdad Esfahbod 86c68c7a2c [GPOS] Fix interaction of mark attachments and cursive chaining
Fixes https://github.com/behdad/harfbuzz/issues/211

What happens in that bug is that a mark is attached to base first,
then a second mark is cursive-chained to the first mark.  This only
"works" because it's in the Indic shaper where mark advances are
not zeroed.

Before, we didn't allow cursive to run on marks at all.  Fix that.
We also where updating mark major offsets at the end of GPOS, such
that changes in advance of base will not change the mark attachment
position.  That was superior to the alternative (which is what Uniscribe
does BTW), but made it hard to apply cursive to the mark after it
was positioned.  We could track major-direction offset changes and
apply that to cursive in the post process, but that's a much trickier
thing to do than the fix here, which is to immediately apply the
major-direction advance-width offsets...  Ie.:

https://github.com/behdad/harfbuzz/issues/211#issuecomment-183194739

If this breaks any fonts, the font should be fixed to do mark attachment
after all the advances are set up first (kerning, etc).

Finally, this, still doesn't make us match Uniscribe, for I explained
in that bug.  Looks like Uniscribe applies minor-direction cursive
adjustment immediate as well.  We don't, and we like it our way, at
least for now.  Eg. the sequence in the test case does this:

- The first subscript attaches with mark-to-base, moving in x only,
- The second subscript attaches with cursive attachment to first subscript
  moving in x only,
- A final context rule moves the first subscript up by 104 units.

The way we do, the final shift-up, also shifts up the second subscript
mark because it's cursively-attached.  Uniscribe doesn't.  We get:

[ttaorya=0+1307|casubscriptorya=0@-242,104+-231|casubscriptnarroworya=0@20,104+507]

while Uniscribe gets:

[ttaorya=0+1307|casubscriptorya=0@-242,104+-211|casubscriptnarroworya=0+487]

note the different y-offset of the last glyph.  In our view, after cursive,
things move together, period.
2016-02-16 16:07:20 +07:00
Behdad Esfahbod 5b5dc2c040 [tests] Add test for advance zeroing of an ASCII letter marked as mark in GDEF 2016-02-11 12:15:38 +07:00
Behdad Esfahbod 3fe0cf1040 Fix previous commit! 2016-02-10 18:43:43 +07:00
Behdad Esfahbod 293a210eee [tests] Fix fonts in cc4a78bf22
They had an invalid LookupFlag (32).
2016-02-10 18:39:59 +07:00
Behdad Esfahbod cc4a78bf22 [tests] Add tests for Latin mark zeroing 2016-02-10 18:24:35 +07:00
Behdad Esfahbod 55ff34b9c1 [tests] Add tests for Thai mark zeroing 2016-02-10 18:24:32 +07:00
Behdad Esfahbod 6173c2a6fc Fix flaky test
This test font had a upem of 769, which results in rounding-related errors with
the FreeType font funcs.  Change the upem to 1024 to fix that.

Fixes https://github.com/behdad/harfbuzz/issues/201
2015-12-25 18:18:23 +01:00
Behdad Esfahbod 2f02fc79a5 Improve ligature-component handling
We use three bits for lig_id these days, so we finally got a report of
two separate ligatures with the same lig_id happening adjacent to each
other, and then the component-handling code was breaking things.
Protect against that by ignoring same-lig-id but lig-comp=0 glyphs after
a new ligature.

Fixes https://github.com/behdad/harfbuzz/issues/198
2015-12-17 15:21:14 +00:00
Behdad Esfahbod 2ab0de9fbd [use] Fix halant detection
Before, we were just checking the use_category().  This detects as
halant a ligature that had the halant as first glyph (as seen in
NotoSansBalinese.)  Change that to use the is_ligated() glyph prop
bit.  The font is forming this ligature in ccmp, which is before
the rphf / pref tests.  So we need to make sure the "ligated" bit
survives those tests.  Since those only check the "substituted" bit,
we now only clear that bit for them and "ligated" survives.

Fixes https://github.com/behdad/harfbuzz/issues/180
2015-12-17 11:59:15 +00:00
Behdad Esfahbod 1c6a057dd1 Add tests for previous commit 2015-11-26 18:48:30 -05:00
Behdad Esfahbod 9cc1ed4fa6 Do not allow recursiving to same position and same lookup
This is just to make it harder to be extremely slow.  There definitely
are ways still, just harder.  Oh well... how do we tame this problem
without solving halting problem?!

Fixes https://github.com/behdad/harfbuzz/issues/174
2015-11-19 12:39:09 -08:00
Behdad Esfahbod 85062e3b46 Add tests for previous two commits
To fully test what these are supposed to test, they should be run
against libharfbuzz-fuzzing.la instead of libharfbuzz.la, but for
now just record the files.
2015-11-18 23:09:13 -08:00
Behdad Esfahbod 5a7eb5d4d8 [fuzzing] Add test case for OOM
From https://github.com/behdad/harfbuzz/issues/161
2015-11-06 00:01:24 -08:00
Behdad Esfahbod 04fd8517f8 Add tests for hyphen fallback
U+2011 is <noBreak> equivaent of U+2010, so we should do the fallback
for it.  Currently fails.
2015-11-04 17:39:26 -08:00
Behdad Esfahbod 7793aad946 Normalize various spaces to space if font doesn't support
This resurrects the space fallback feature, after I disabled
the compatibility decomposition.  Now I can release HarfBuzz
again without breaking Pango!

It also remembers which space character it was, such that later
on we can approximate the width of this particular space
character.  That part is not implemented yet.

We normalize all GC=Zs chars except for U+1680 OGHA SPACE MARK,
which is better left alone.
2015-11-04 15:51:41 -08:00
Behdad Esfahbod df698f3299 [ot-font] Fix hmtx table length checking, *again*
Exactly the same problem that I fixed in
63ef0b41dc

I rewrote the table checking yesterday in
67f8821fb2
and introduced the exact same issue again. :(
Good thing we have ongoing fuzzing going now.  Was discovered
immediately by libFuzzer.  Thanks kcc!

https://github.com/behdad/harfbuzz/issues/139#issuecomment-153449473
Fixes https://github.com/behdad/harfbuzz/issues/156
2015-11-03 12:15:12 -08:00
Behdad Esfahbod 338ffec9e4 Add tests for a couple of fixed issues found by libFuzzer
From:
https://github.com/behdad/harfbuzz/issues/139#issuecomment-147616887
https://github.com/behdad/harfbuzz/issues/139#issuecomment-148289957
2015-10-15 12:56:19 -03:00
Behdad Esfahbod 55db94be2b Add test for previous commit 2015-10-13 00:33:59 -04:00
Behdad Esfahbod 98c6fccc00 Add test for ee9b0b6cb5 2015-10-11 21:41:04 -04:00
Behdad Esfahbod 34379b49e6 Add test for previous fix 2015-10-09 12:34:02 -04:00
Behdad Esfahbod b6d7d161a8 [tests] Add Hebrew test for normalization under cluster-level=1
Currently fails.
https://bugzilla.gnome.org/show_bug.cgi?id=541608
2015-09-01 16:12:44 +01:00
Behdad Esfahbod 7368da6724 [test] Add test for cursive-positioning with mixed directions
Fails now.  Fix coming.  See thread "Issue with cursive attachment"
started by Khaled.  Test fonts were made by modifying test font
from Khaled to add more anchors.
2015-08-25 20:29:36 +01:00
Behdad Esfahbod f3792342f6 [tests] Add test for fallback positioning with cluster_level > 0
For https://github.com/behdad/harfbuzz/pull/123
Currently fails.  Fix coming.
2015-08-08 18:03:16 +02:00
Behdad Esfahbod c81d957a26 [test] Add tests for improved 'vert' feature 2015-07-23 12:50:48 +01:00
Behdad Esfahbod 582069172c Add test case for deleting default ignorables with positioning 2015-07-22 18:44:59 +01:00
Behdad Esfahbod e6f80fa104 [indic] Allow ZWJ/ZWNJ before SM
In Oriya, a ZWJ/ZWNJ might be added before candrabindu to encourage
or stop ligation of the candrabindu.  This is clearly specified in
the Unicode section on Oriya.  Allow it there.  Note that Uniscribe
doesn't allow this.

Micro tests added using Noto Sans Oriya draft.

No changes in numbers.  Currently at:

BENGALI: 353725 out of 354188 tests passed. 463 failed (0.130722%)
DEVANAGARI: 707307 out of 707394 tests passed. 87 failed (0.0122987%)
GUJARATI: 366349 out of 366457 tests passed. 108 failed (0.0294714%)
GURMUKHI: 60732 out of 60747 tests passed. 15 failed (0.0246926%)
KANNADA: 951190 out of 951913 tests passed. 723 failed (0.0759523%)
KHMER: 299070 out of 299124 tests passed. 54 failed (0.0180527%)
MALAYALAM: 1048147 out of 1048334 tests passed. 187 failed (0.0178378%)
ORIYA: 42320 out of 42329 tests passed. 9 failed (0.021262%)
SINHALA: 271662 out of 271847 tests passed. 185 failed (0.068053%)
TAMIL: 1091753 out of 1091754 tests passed. 1 failed (9.15957e-05%)
TELUGU: 970555 out of 970573 tests passed. 18 failed (0.00185457%)
2014-12-10 12:05:24 -08:00
Behdad Esfahbod d5e61470fa [arabic] Fix fallback shaping regression
Was broken in 615d00ea25.

Fixes https://github.com/behdad/harfbuzz/pull/48

Micro-test added.
2014-08-05 14:19:36 -04:00
Behdad Esfahbod ac53443f1c [hangul] Don't apply 'calt'
See comments.

Micro-test added.
2014-07-31 18:54:43 -04:00
Behdad Esfahbod 9e834e29e0 [hebrew] Zero mark advance by GDEF late
Seems to be what Uniscribe does.

At this point I think it's work checking our default...

Fixes Bug 76767 - Zeroing of advance of 2nd component of multiple
substitution with SBL Hebrew
https://bugs.freedesktop.org/show_bug.cgi?id=76767

Micro-test added.
2014-07-26 20:34:01 -04:00
Behdad Esfahbod 6f2d9ba52a Add old-Myanmar shaper
Looks like Unsicribe responds to the 'mymr' tag by zeroing marks
GDEF_LATE instead of generic-shaper UNICODE_LATE.  Implement that.

Fixes
Bug 81775 - Incorrect Rendering with harfbuzz-ng myanmar unicode
https://bugs.freedesktop.org/show_bug.cgi?id=81775

Micro-test added based on Padauk.
2014-07-26 19:18:59 -04:00