Commit Graph

72 Commits

Author SHA1 Message Date
Behdad Esfahbod 220a5991ba [kern/kerx] Fix trace numbering 2018-11-06 17:16:23 -05:00
Behdad Esfahbod bfafe208da [kern] Switch to dispatch 2018-11-06 12:13:20 -05:00
Behdad Esfahbod b605db2f65 [aat] Clean up ankr table include mess 2018-11-04 12:58:02 -05:00
Behdad Esfahbod 8034d1dda0 [kern] Implement Format1
Also, implement backwards kerning for Format1 in kern and kerx.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1350
2018-11-02 14:48:04 -04:00
Ebrahim Byagowi b053cabacd [mort] Bring back mort generalizations
Started by reverting https://github.com/harfbuzz/harfbuzz/commit/1f1c85a5

Just a starting point, if we agree even mort can come back.
2018-10-30 19:18:06 -07:00
Behdad Esfahbod 39bd07aed5 Fix bunch of unused parameter warnings
Show up with gcc -O0.

There's a few more but those are functions that need to be filled in.

Maybe this is a lost battle...
2018-10-26 21:22:26 -07:00
Behdad Esfahbod b713c13977 [kerx] Implement tuple-kerning in Format0 2018-10-20 14:56:28 -07:00
Behdad Esfahbod 68b7050768 [kerx] Fix sanitize of KerxSubtableFormat2::array read
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11033
2018-10-20 12:20:57 -07:00
Behdad Esfahbod 29d877518f [kerx] Implement variation-kerning tables (without the variation part)
SFSNDisplay uses these.  We just apply the default kern without
variations right now.  But at least makes the default kern work.
2018-10-19 16:06:54 -07:00
Behdad Esfahbod 2352cc3539 [kerx] Whitespace 2018-10-19 10:17:02 -07:00
Behdad Esfahbod 87205ef935 [aat] Make sure Lookup offset is never nulled
It has unbounded size...

Fixes https://oss-fuzz.com/v2/testcase-detail/5718889451749376
2018-10-16 15:41:00 -07:00
Ebrahim Byagowi 42b75dc3a7
[kerx] Minor, remove debug bit 2018-10-16 10:58:09 +03:30
Behdad Esfahbod 11703afce6 [kerx] Fix Format6 sanitize
Fixes https://oss-fuzz.com/v2/testcase-detail/5650286710882304
2018-10-15 21:17:08 -07:00
Behdad Esfahbod bb35725cd7 [kerx/morx] More end-of-text protection 2018-10-15 11:05:10 -07:00
Behdad Esfahbod 40f2b9355c [kerx] Fix Format1 sanitize
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10948
2018-10-14 14:56:32 -07:00
Behdad Esfahbod de6e414c56 [kerx] Sanitize more 2018-10-13 13:48:22 -04:00
Behdad Esfahbod 71f76f2f39 [kerx] Fix-up previous commit
A "&" was missing.  Go back to using pointers that are less error-prone.
2018-10-13 13:36:27 -04:00
Behdad Esfahbod 6d4b054234 [kerx] Use sanitizer instead of handcoded runtime sanitization 2018-10-13 12:20:33 -04:00
Behdad Esfahbod 5733113662 [kerx] Wire up context down to get_kerning 2018-10-13 12:16:12 -04:00
Behdad Esfahbod c4502833b7 [kerx] Use sanitizer.get_num_glyphs() instead of face->get_num_glyphs() 2018-10-13 12:09:59 -04:00
Behdad Esfahbod fc45e698f2 [kerx] Protext against overflows 2018-10-13 12:09:59 -04:00
Behdad Esfahbod fbbd926dba [kerx] Implement Format4 action_type=1 contour-point-based attachment
Untested.

This concludes kerx table support!
2018-10-11 01:22:29 -04:00
Behdad Esfahbod b6bc0d4ff6 [kerx] Implement Format4 action_type=2 coordinate-based attachment
Untested.
2018-10-11 01:17:57 -04:00
Behdad Esfahbod 1622ba5943 [kerx] Implement Format4 'ankr'-based mark attachment
Tested with Kannada MN:

$ HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0CCD,0C95,0CD6
[kn_ka.vattu=0+230|kn_ai_length_mark=1@326,0+607]
2018-10-11 01:17:33 -04:00
Behdad Esfahbod 28f0367aab [kerx] Flesh out Format4
Doesn't apply actions yet.
2018-10-11 00:46:12 -04:00
Behdad Esfahbod f7c45bc33e [kerx] Allow granularly disabling kerning 2018-10-10 22:15:13 -04:00
Behdad Esfahbod 2b72c4b63d [kerx] Comment 2018-10-10 21:53:14 -04:00
Behdad Esfahbod 9f450f07b0 [kerx] Make Format1 work
Tested using Kannada MN:

$ HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0C95,0CCd,C95,CCD
[kn_ka.virama=0+1299|kn_ka.vattu=0+115|_blank=0@-115,0+385]

$ HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0C95,0CCd,C95,CCD --features=-kern
[kn_ka.virama=0+1799|kn_ka.vattu=0+230|_blank=0+0]

I don't see the GPOS table in the font do the same.  ¯\_(ツ)_/¯
2018-10-10 21:46:58 -04:00
Behdad Esfahbod 8496753796 [kerx] Implement Format1
Untested.
2018-10-10 21:18:37 -04:00
Behdad Esfahbod c9165f5450 [kerx] More UnsizedArrayOf<> 2018-10-10 20:43:21 -04:00
Behdad Esfahbod ca54eba484 [kerx] Fix bound-checking error introduced a couple commits past 2018-10-10 20:41:16 -04:00
Behdad Esfahbod 339036dd97 [kerx] Start fleshing out Format1 2018-10-10 20:37:22 -04:00
Behdad Esfahbod ab1f30bd05 [kerx] Implement Format6
Untested.  The only Apple font shipping with this format is San Francisco fonts
that use this for their kerx variation tables, which we don't support.
2018-10-10 20:10:20 -04:00
Behdad Esfahbod c9a2ce9e05 [kerx] Move bounds-checking to subtable length itself 2018-10-10 20:00:44 -04:00
Behdad Esfahbod 22955b23cd [kerx] Start fleshing out Format6 2018-10-10 19:58:20 -04:00
Behdad Esfahbod f6aaad9b4f [kerx] When rejecting variable kerning, also check for tupleCount 2018-10-10 19:20:06 -04:00
Behdad Esfahbod 7ed5366d3c [kerx] No-op
Tested that Format0 works with Kannada MN font:

$ make -j5 lib -s && HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0C95,0CC2
[kn_ka=0+1000|kn_matra_uu=0@-30,0+1345]

$ make -j5 lib -s && HB_OPTIONS=aat ./hb-shape Kannada\ MN.ttc -u 0C95,0CC2 --features=-kern
[kn_ka=0+1030|kn_matra_uu=0+1375]

Note that GPOS does the same with 'dist' feature, and applies the whole difference to the
same glyph:

$ make -j5 lib -s && ./hb-shape Kannada\ MN.ttc -u 0C95,0CC2
[kn_ka=0+970|kn_matra_uu=0+1375]

$ make -j5 lib -s && ./hb-shape Kannada\ MN.ttc -u 0C95,0CC2 --features=-dist
[kn_ka=0+1030|kn_matra_uu=0+1375]
2018-10-10 19:12:27 -04:00
Behdad Esfahbod 5d34164d98 [kern/kerx] Fix offset base
Disable kern Format2.

Fix kerx Format2.  Manually tested this with Tamil MN font and it works:

$ HB_OPTIONS=aat ./hb-shape Tamil\ MN.ttc -u 0B94,0B95
[tgv_au=0+3435|tgc_ka=1@-75,0+1517]

 HB_OPTIONS=aat ./hb-shape Tamil\ MN.ttc -u 0B94,0B95 --features=-kern
[tgv_au=0+3510|tgc_ka=1+1592]
2018-10-10 18:23:09 -04:00
Behdad Esfahbod 60f86d32d7 [kerx] Don't loop over kerning subtables if kerning disabled 2018-10-10 18:10:05 -04:00
Behdad Esfahbod 44f09afd5b [kerx] Skip variation subtables 2018-10-10 17:32:32 -04:00
Behdad Esfahbod 7727e73756 [kerx] Actually hook up, and fix crash 2018-10-10 13:24:51 -04:00
Behdad Esfahbod 0537a40193 [kerx] Comment 2018-10-09 23:37:00 -04:00
Behdad Esfahbod 362d324119 [aat] Rename 2018-10-09 23:27:00 -04:00
Behdad Esfahbod 948f59a13a [kerx] Use subtable range for runtime checks 2018-10-09 23:07:47 -04:00
Behdad Esfahbod ad76307486 [kerx] Comment 2018-10-09 22:57:00 -04:00
Behdad Esfahbod db9600bbe1 [kerx] Remove junk 2018-10-09 22:55:47 -04:00
Behdad Esfahbod 27db859416 [kern/kerx] Adjust bounds check 2018-10-09 22:55:17 -04:00
Behdad Esfahbod c66f7f8c5d [kerx] Implement Format2 apply()
Still, not hooked.
2018-10-09 22:49:33 -04:00
Behdad Esfahbod 4b461785bd Fix check 2018-10-09 22:46:30 -04:00
Behdad Esfahbod 53e5594500 [kerx] Implement Format0 apply()
Not hooked up to be called yet.
2018-10-09 22:35:22 -04:00