Commit Graph

176 Commits

Author SHA1 Message Date
Behdad Esfahbod 748198a671 Revert "[aat.morx] Remove set_object() business"
This reverts commit ae8ed58a6e.

Apparently this broke Apple Chancery from OS X 10.12 :(.
Investigating...
2018-11-24 22:16:59 -05:00
Behdad Esfahbod ae8ed58a6e [aat.morx] Remove set_object() business
With OS X 10.13 Apple Chancery fails to ligate if we limit each morx
sub-chain to its declared length.  Perhaps their newer compiler does
object-sharing across sub-chains.  Anyway, since that's a valid, if
unspecified, way to compile tables, remove enforcement.

Probably do the same with kern/kerx.
2018-11-24 17:14:09 -05:00
Behdad Esfahbod 20edc70d53 [morx/kerx] Fix sanitize regression
Broke in 8dcc1913a1

If sanitizer is left with another object, it wouldn't work.

Better fix coming soon.
2018-11-24 14:53:05 -05:00
Behdad Esfahbod 8dcc1913a1 [kerx/morx] Make sure object length is sanitized before accessing it 2018-11-24 09:48:06 -05:00
Behdad Esfahbod 758c9d68e2 [morx/kerx] Limit range to subtable when sanitizing 2018-11-22 22:16:12 -05:00
Behdad Esfahbod a9fe787a11 [sanitizer] Add reset_object(), make set_object() do bounds-check
Affects morx/kerx run-time only currently.  Will adjust their sanitize next.
2018-11-22 22:12:36 -05:00
Behdad Esfahbod 2c8188bf59 [kerx] Make sure subtables are non-zero-length
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11400
2018-11-22 22:02:19 -05:00
Behdad Esfahbod 29c5302376 [morx] Minor 2018-11-07 17:29:37 -05:00
Behdad Esfahbod 385f78b312 [aat] Remove deleted-glyhs after applying kerx/kern
Finally:  Fixes https://github.com/harfbuzz/harfbuzz/issues/1356

Test case:
$ ./hb-shape GeezaPro.ttc -u U+0628,U+064A,U+064E,U+0651,U+0629
[u0629.final.tehMarbuta=4+713|u064e_u0651.shaddaFatha=1@0,-200+0|u064a.medial.yeh=1+656|u0628.initial.beh=0+656]

The mark positioning (kern table CrossStream kerning) only works if deleted
glyph (as result of ligation) is still in stream and pushed through the
state machine.
2018-11-07 17:20:47 -05:00
Behdad Esfahbod 241ba7da51 [morx/kerx] Rename types 2018-11-07 11:51:40 -05:00
Behdad Esfahbod d5c88af4a2 [kerx] More towards sharing Format1 2018-11-07 11:20:14 -05:00
Behdad Esfahbod b693fd0dc6 [morx] Simplify 2018-11-07 11:10:24 -05:00
Behdad Esfahbod e890753ebb [morx] Minor 2018-11-07 10:59:53 -05:00
Behdad Esfahbod 17335a8161 Clean up buffer->swap_buffers() calls
That function checks for buffer->successful already.  No need
to check at call site.
2018-11-04 02:25:07 -05:00
Behdad Esfahbod 0382b7184a Use as_array in more places 2018-11-02 12:23:26 -04:00
Behdad Esfahbod 40b19fd469 [aat] Fallback to old style "Letter Case" small caps
Fixes https://github.com/harfbuzz/harfbuzz/issues/1342
2018-10-31 18:51:45 -07:00
Behdad Esfahbod 36e90ef56e [mort] Massage some more 2018-10-31 15:09:09 -07:00
Behdad Esfahbod cbaff4ef19 [mort] Some more 2018-10-31 15:06:12 -07:00
Behdad Esfahbod 3087046d31 [mort] Refactor offset-to-index mapping 2018-10-31 14:59:14 -07:00
Ebrahim Byagowi 2e639c47c9
[aat] Fix older compilers by not referencing enum directly (#1340) 2018-10-31 14:20:14 +03:30
Ebrahim Byagowi 642c9dcf1b
[aat] Minor, remove extra semicolons 2018-10-31 14:02:37 +03:30
Behdad Esfahbod c962d5e714 [mort] Make ligatures work
./hb-shape Apple_Chancery_10_12.ttf  "Th th ll te to tr fr fu fj"
[T_h=0+2308|space=2+569|t_h=3+1687|space=5+569|l_l=6+1108|space=8+569|t_e=9+1408|space=11+569|t_o=12+1531|space=14+569|t_r=15+1385|space=17+569|f_r=18+1432|space=20+569|f_u=21+1733|space=23+569|f_j=24+1098]

Part of https://github.com/harfbuzz/harfbuzz/issues/1331
2018-10-31 01:18:21 -07:00
Behdad Esfahbod c077989600 [mort] More Ligature work 2018-10-31 00:36:03 -07:00
Behdad Esfahbod 431c6e496b [mort] Some Ligature work 2018-10-31 00:15:00 -07:00
Behdad Esfahbod 28b68cffe4 [mort] Implement / adjust Contextual substitution 2018-10-30 23:54:29 -07:00
Behdad Esfahbod 9346b1f158 [morx] Remove stale comment 2018-10-30 20:04:13 -07:00
Behdad Esfahbod f864ef215e [mort] More massaging towards mort 2018-10-30 19:42:21 -07:00
Behdad Esfahbod 2d9467340b [mort] Fix version check in sanitize 2018-10-30 19:33:42 -07:00
Behdad Esfahbod c2527a1bc2 [mort] Make it compile / hook it up
Untested.
2018-10-30 19:26:39 -07:00
Behdad Esfahbod 933babdc07 [mort] Fixup on previous commit 2018-10-30 19:22:43 -07: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 6aa019c4af [morx] Fix merge_cluster to end at last ligature component
Don't assume current position was a component in the ligature.
2018-10-26 22:02:17 -07:00
Behdad Esfahbod 00ae4be6bf [morx] Fix bailing out ligation at end-of-text
Check was after a move_to, which wouldn't work.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11147
2018-10-26 21:59:20 -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 ba5ca6a762 [morx] Use deleted-glyph, instead of actual deletion, in Ligation
Closer to what CoreText does.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1302
2018-10-25 17:46:07 -07:00
Behdad Esfahbod 5c272e3613 [morx] Remove deleted-glyph at the end of processing 2018-10-25 17:39:54 -07:00
Behdad Esfahbod ba502dea1e [morx] Fix cluster-merging when ligating
Only merge when actual ligature happened.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1305
2018-10-23 16:50:31 -07:00
Behdad Esfahbod ffe3478448 [aat] Allow enabling/disabling features
Only works at entire-buffer range, not sub-ranges.

Test with:

$ hb-shape Zapfino.dfont Zapfino
[Z_a_p_f_i_n_o=0+2333]

$ hb-shape Zapfino.dfont Zapfino --features=-dlig
[Z=0+416|a=1@-21,0+264|p_f=2+433|i=4+181|n=5+261|o=6+250]

$ hb-shape Zapfino.dfont Zapfino --features=+dlig
[Z_a_p_f_i_n_o=0+2333]

Fixes https://github.com/harfbuzz/harfbuzz/issues/1303
2018-10-23 14:14:03 -07:00
Behdad Esfahbod 531f9822b2 [morx] Add a few debug messages to Ligature chain 2018-10-23 01:32:08 -07:00
Behdad Esfahbod 0e5bcdef7f [morx] Clear stack upon underflow when acting ligatures 2018-10-23 00:39:44 -07:00
Behdad Esfahbod 792071de40 [morx] Leave ligature on stack after ligating
Test with Apple Color Emoji.ttf of ~66MB and following sequence:

./hb-shape Apple\ Color\ Emoji-old.ttf --font-funcs=ot -u U+1F468,200d,U+1F469,200d,U+1F467,200d,1f466

Should form full family if matching works correctly.  It first makes
family of three, then makes family of four out of that and the last
two characters.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1292
2018-10-22 23:38:34 -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
Behdad Esfahbod 2137582c96 [morx] Reword ligation
Still fails MORX-41.  Am talking to Sascha to better understand what CoreText
is doing.
2018-10-16 14:46:07 -07:00
Behdad Esfahbod c53a25c657 [morx] Comment 2018-10-16 13:57:35 -07:00
Behdad Esfahbod 0f85edb778 [morx] Another end-of-text corner case
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10990
2018-10-15 11:15:54 -07:00
Behdad Esfahbod 55d5ea666c [kerx] Merge clusters in Ligature 2018-10-15 11:05:10 -07:00
Behdad Esfahbod 1c76c8f6ff [morx] Handle end-of-text conditions in Insertion
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10955
2018-10-14 19:39:31 -07:00
Behdad Esfahbod 8496753796 [kerx] Implement Format1
Untested.
2018-10-10 21:18:37 -04:00
Behdad Esfahbod 339036dd97 [kerx] Start fleshing out Format1 2018-10-10 20:37:22 -04:00
Behdad Esfahbod 362d324119 [aat] Rename 2018-10-09 23:27:00 -04:00
Behdad Esfahbod 54c9ecb92d [morx] Use subtable range for embedded sanitizer here as well 2018-10-09 23:18:19 -04:00
Behdad Esfahbod 2a5cb37fdb Revert "[morx] Fix MORX-35"
This reverts commit f62f6e90ad.
2018-10-07 20:37:15 -04:00
Behdad Esfahbod f62f6e90ad [morx] Fix MORX-35
Fixes https://github.com/harfbuzz/harfbuzz/issues/1224
2018-10-07 18:52:48 -04:00
Behdad Esfahbod fdce1e1543 [kerx] Clean up kerx and KerxTable structures 2018-10-07 14:01:33 -04:00
Behdad Esfahbod 3417037eb1 [aat] Add +hb_aat_layout_has_substitution 2018-10-04 11:17:19 +02:00
Sascha Brawer 7810bb1a59 [morx] Only insert glyphs at mark when a mark has been set before
This reverts commit f4072e8cb8.
https://github.com/harfbuzz/harfbuzz/issues/1195
2018-10-04 10:29:23 +02:00
Behdad Esfahbod 98ac01d3b3 [morx] Break out if buffer gets into error
Was getting stuck not making progress somehow.
2018-10-01 12:10:00 +02:00
Behdad Esfahbod f4072e8cb8 [morx] Remove mark_set from Insertion
text-rendering-tests test MORX-32 shows that for Insertion, an unset mark is treated
as mark set at 0.  This is unlike the Reordering lookup where un unset mark performs
nothing.

Fixes MORX-32.
2018-09-28 10:14:23 -04:00
Behdad Esfahbod 0d18ec5467 [morx] unsafe-to-break in Insertion
Makes MORX-29, MORX-30, MORX-31 pass.
2018-09-28 10:01:59 -04:00
Behdad Esfahbod 5fd8bce945 [morx] Fix mark_set check 2018-09-19 22:34:09 -04:00
Behdad Esfahbod dc8ed45292 [morx] Implement forward/backward processing
We reverse too many times. Can be optimized. But I doubt many fonts
use reverse lookups, so doesn't matter.

Other than not applying user features, this completes morx table
implementation.
2018-09-19 16:47:25 -04:00
Behdad Esfahbod 3bccd62196 [morx] Implement horiz-only/vert-only subtables 2018-09-19 16:24:34 -04:00
Behdad Esfahbod 041a08de3d [morx] Improve buffer position in Insertion w DontAdvance and wo
Just speculation. Needs tests to determine which is correct behavior.
2018-09-19 16:02:56 -04:00
Behdad Esfahbod 388ab91642 [morx] Implement InsertionChain 2018-09-17 20:28:32 +02:00
Behdad Esfahbod 89dd4b9597 Fix bots
"Unused private member" warning turned error.  ugh.
2018-09-16 18:11:46 +02:00
Behdad Esfahbod 10642b3fbf Disallow null-enabled offsets to unsized structures...
...like UnsizedArrayOf<>.

This fixes a class of crasher bugs, mostly with color and AAT tables.  We
cannot use nullable offsets to varsized data that does not declare min_size,
because it's nost safe to use our fixed-size null pool for types that have
their size external.  So, use non_null'able offsets for these.

A further enhancement would be to make use of min_size in Null<> itself.
Will try that after.
2018-09-15 19:43:33 +02:00
Behdad Esfahbod 9ff76c6025 [morx] Respect default feature settings
Does NOT apply user-selected features.  But at least now enables
correct subtables.
2018-09-15 18:31:14 +02:00
Behdad Esfahbod 2f97da6e2d [aat] Change version field 2018-09-15 14:51:50 +02:00
Behdad Esfahbod 29c2bd1795 [morx] Add stub for InsertionChain 2018-09-15 14:47:18 +02:00
Behdad Esfahbod dff2c45f1e Port rest from VAR to UnsizedArrayOf<> 2018-09-11 01:01:08 +02:00
Behdad Esfahbod 9507b05a7a Simplify sanitize->check_array()
Fix a bug in CBDT sanitize, and redundant check in avar.
2018-09-10 23:18:23 +02:00
Behdad Esfahbod c77ae40852 Rename hb-*private.hh to hb-*.hh
Sorry for the noise, downstream custom builders.  Please adjust.
2018-08-25 22:36:36 -07:00
Behdad Esfahbod 63f57f4dab Mark more unsized array's as arrayZ 2018-05-08 16:56:11 -07:00
Behdad Esfahbod 5b93f69169 Rename some X-terminated members to Z-terminated
X-terminated means don't access this, it's not located correctly.
Z-terminated means this is a C array with no bound checking.
2018-05-02 14:59:14 -04:00
Ebrahim Byagowi 277e328986
Make some of implicit header uses explicit (#989)
Splitted from #950 and #986 IIRC Chromium had a policy about this encouraging it,
not sure about automated way to detect and add them but for now lets have the needed
ones of them.
2018-04-17 09:13:35 +04:30
Ebrahim Byagowi a02c3ee70f Add or update tables specifications links 2018-04-12 13:44:32 +04:30
Ebrahim Byagowi b799fc8077
minor, use LOffsetTo and LArrayOf whenever possible (#966) 2018-04-11 18:36:09 +04:30
Ebrahim Byagowi 211da5efdc
[aat] Cosmetic changes (#964) 2018-04-11 17:41:24 +04:30
Ebrahim Byagowi 158f2810b2
[aat/ltag] Implement the table parsing (#911) 2018-03-26 12:04:30 +04:30
Behdad Esfahbod c7d7c9898e [aat] Minor 2018-02-13 14:00:14 -08:00
Behdad Esfahbod 2dbfeecf96 Minor 2018-02-13 13:59:39 -08:00
Behdad Esfahbod 91519c6a5b [aat] Add buffer messages 2018-02-10 13:35:17 -06:00
Behdad Esfahbod 5021ba2a21 [aat] Minor 2018-02-08 15:11:28 -06:00
Behdad Esfahbod ee433d36fa [aat] Set debug lookup_index 2018-02-07 12:41:21 -05:00
Behdad Esfahbod 126ffdbe95 [aat] Fix debug compile 2018-02-07 12:26:57 -05:00
Behdad Esfahbod 54e6efadd6 [aat] Fix unsafe-to-break
At any position, if state is not zero, mark unsafe-to-break before,
unless we can reason it safe.

At any position, if there's an action entry for end-of-text, mark
unsafe to break.

Also changes buffer diff impl to allow for flag differences as long
as the buffer glyph flags are superset of reference glyph flags.

With this, all MORX tests pass.
2018-02-04 17:18:54 -05:00
Behdad Esfahbod 89b1906d99 [aat] More adjustment to ContextualSubtable
See comment.

With this, MORX-20 passes if I turn --verify off.  Our unsafe-to-break
logic is currently broken in presence of end-of-text actions.  That's,
ugh, extra work to fix.  Let me try...
2018-02-04 14:45:02 -05:00
Behdad Esfahbod 8be596f0b7 [aat] In ContextualSubstitute, apply end-of-text action to last glyph 2018-02-04 14:40:17 -05:00
Behdad Esfahbod c0b1c7eb2e [aat] Remove unneeded check 2018-02-04 14:19:41 -05:00
Behdad Esfahbod aed32589af [aat] In ContextualSubtable, mark mark after substituting mark
Fixes MORX-21.
2018-02-04 12:36:54 -05:00
Behdad Esfahbod fe5f9b1ae3 [aat] Fix ContextualSubtable sanitization
Fixes MORX-18, MORX-19, and MORX-22.
2018-02-04 12:36:54 -05:00
Behdad Esfahbod 51ce3828e6 [aat] Fix Ligature matching
I hope... Makes "ffi" work with Zapfino. I'm not sure if doing it correctly though...
2018-01-19 18:37:58 -08:00
Behdad Esfahbod bef509855c [aat] Add TODO 2018-01-19 18:24:00 -08:00
Behdad Esfahbod e6f283ed7d [aat] Implement LigatureSubtable
We form the Zapfino ligature now. Yay! No further testing done.
2018-01-19 18:09:48 -08:00
Behdad Esfahbod 046690a4df [aat] Add hb_aat_apply_context_t 2018-01-19 16:40:13 -08:00
Behdad Esfahbod fd03449094 Rename hb_apply_context_t to hb_ot_apply_context_t 2018-01-19 16:40:13 -08:00
Behdad Esfahbod e6263c7142 [aat] Wire up table length to apply() 2018-01-15 15:37:55 -05:00
Behdad Esfahbod 679ae744d0 [aat] Towards implementing LigatureSubtable 2018-01-14 15:03:31 -05:00
Behdad Esfahbod 9009b341c4 [aat] Fix some struct sizes
I hate it that with my compiler at least, it doesn't catch totally uncompilable
statements in templates if they are not used...
2018-01-12 12:04:53 +01:00
Behdad Esfahbod 57051b4f67 [aat] Flush rest of buffer if state machine failed 2018-01-12 11:42:25 +01:00