Commit Graph

158 Commits

Author SHA1 Message Date
Ebrahim Byagowi eaf649450a Resolve clang's conditional-uninitialize warnings 2018-04-23 11:38:45 -07:00
Ebrahim Byagowi a02c3ee70f Add or update tables specifications links 2018-04-12 13:44:32 +04:30
Behdad Esfahbod e347fb908b Minor 2018-02-26 01:08:50 -08:00
Behdad Esfahbod 1c50a88623 Readjust mark attachment heuristic a bit more
Previously adjusted logic could fail if nothing around was ligated,
and something moved.  This should take care of that.

CC https://github.com/harfbuzz/harfbuzz/issues/740
2018-02-18 15:58:09 -08:00
Behdad Esfahbod 978ace6fbb Improve _hb_popcount()
Support 128bit type.
2018-02-16 16:08:45 -08:00
Behdad Esfahbod 9b5af3ec7f [gpos] Adjust mark attachment heuristic
Hopefully it...
fixes https://github.com/harfbuzz/harfbuzz/issues/740
2018-02-10 21:50:44 -06: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 188ee6e5ee Calculate anchor positions in float, then round
Hoping to reduce rounding error, to make tests happier...
No luck.
2018-01-10 05:13:47 +01:00
Behdad Esfahbod 7cdd6ab068 Round, instead of floor, when applying variations
Hoping this would fix remaining text-rendering-tests failures,
but so far no luck.
2018-01-10 04:44:33 +01:00
Behdad Esfahbod 6b19178ee3 Prefix int types with HB
Such a headache that Windows defines UINT8, ...; Just prefix it.
2018-01-10 03:07:30 +01:00
Behdad Esfahbod 71e6adf1e2 [collect_glyphs] handle ClassDef better 2017-12-16 11:07:37 -05:00
Behdad Esfahbod 87cc5a65cb [collect_glyphs] In PairPosFornat2 do not collect classDef1
The coverage already covered that.
2017-12-16 06:18:07 -08:00
Behdad Esfahbod 81f27df4d9 More work towards improving collect_glyphs() against bad input
The three "XXXXX"'s should be switched to false.  Doing that separately for ease
of bisecting...
2017-12-16 06:12:06 -08:00
Behdad Esfahbod 5d02572034 [set] Add add_sorted_array()
Not optimized to use sortedness yet.  Also start putting in place infra
to faster reject bad data.

A version of Chandas.ttf found on some Chrome bots has 660kb of GPOS,
mostly junk.  That is causing 48 million of set->add() calls in
collect_glyphs(), which is insane.

In the upcoming commits, I'll be speeding that up by optimizing
add_sorted_array(), while also reducing work by rejecting out-of-sort
arrays quickly and propagate the rejection.

Part of https://bugs.chromium.org/p/chromium/issues/detail?id=794896
2017-12-14 19:35:47 -08:00
Behdad Esfahbod 6f335ed1e5 Replace USHORT/SHORT/ULONG/etc with UINT16/INT16/UINT32/etc 2017-11-14 21:06:07 -08:00
Behdad Esfahbod 5d98de1f38 Tweak mark-base attachment
Apparently a base glyph can also become an attached component of a
ligature if the ligature-forming lookup used IgnoreBase.  This was
being confused with a non-first component of a MultipleSubst and
hence not matched for mark-attachment.  Tweak test to fix.

Fixes https://github.com/behdad/harfbuzz/issues/543
2017-10-03 13:49:40 +02:00
Behdad Esfahbod b65aa1cd47 [unsafe-to-break] Flag during mark attachment 2017-08-10 20:32:02 -07:00
Behdad Esfahbod 882ebdadd6 [unsafe-to-break] Flag during cursive positioning 2017-08-10 20:23:17 -07:00
Behdad Esfahbod 2d158ca376 [unsafe-to-break] Flag during kerning 2017-08-10 20:20:30 -07:00
Volker H. Simonis ad273881c5 Minor fixes to pacify Coverity code scan
Fixes https://github.com/behdad/harfbuzz/pull/377
2016-12-18 00:14:06 -06:00
Behdad Esfahbod 59055b5494 [GX] Implement Feature Variations
Not hooked up to shaper yet.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod cf3de4d8f7 [GX] Rename VarStore to VariationStore 2016-12-16 19:06:26 -06:00
Behdad Esfahbod 1124d2ece5 [GX] Fix thinko 2016-12-16 19:06:26 -06:00
Behdad Esfahbod 151d93de8a [GX] Hook up GPOS to Variation Store stored in GDEF
Untested.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod 49cb87850c [GX] Pass apply-context down to get_anchor()
Needed to access GDEF for varStore.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod dc9f229799 [GX] Port variation stuff to Variation Store design
Not hooked up to GDEF yet.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod ca28670316 [GX] Towards anisotropic interpolation
Also hookup to ValueRecord and Anchors.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod ebd7431f82 Partially revert 86c68c7a2c
That commit moved the advance adjustment for mark positioning to
be applied immediately, instead of doing late before.  This breaks
if mark advances are zeroed late, like in Arabic.  Also, easier to
hit it in RTL scripts since a single mark with non-zero advance is
enough to hit the bug, whereas in LTR, at least two marks are needed.

This reopens https://github.com/behdad/harfbuzz/issues/211
The cursive+mark interaction is broken again.  To be fixed in a
different way.
2016-02-24 15:53:40 +09: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 6ab920224c [GPOS] Minor
No effect.
2016-02-11 16:57:52 +07:00
Behdad Esfahbod cbc3a76c5a [GPOS] Merge fixing of offsets for cursive and mark attachments
Part of fixing https://github.com/behdad/harfbuzz/issues/211
2016-02-11 16:48:13 +07:00
Behdad Esfahbod 7d8d58ac81 [GPOS] Divide position_finish() into two phases, for advances and offsets
Right now the position_finish_advances() is empty.  To be used for
spacing attachments proposal later.
2016-02-11 16:34:28 +07:00
Behdad Esfahbod 8474231567 [ot] Minor shuffling code around 2016-02-11 16:27:41 +07:00
Behdad Esfahbod b0b11614e9 [GPOS] Add harmless recursion in fix_mark_attachment()
Will do nothing.  Just useful for merging two functions.
2016-02-11 15:28:55 +07:00
Behdad Esfahbod 686567baab [GPOS] Merge attach_chain() and cursive_chain()
Differentiate, using new attach_type().
2016-02-11 15:25:28 +07:00
Behdad Esfahbod 806ad8dc65 [GPOS] Minor shuffling 2016-02-11 14:53:11 +07:00
Behdad Esfahbod 0f6278d1fb [GPOS] Negate sign of attach_lookback(), and rename it to attach_chain()
No behavior change.  Preparing to unify how cursive and mark attachments
work.
2016-02-11 14:49:10 +07:00
Behdad Esfahbod fc38e6034c [layout] Collect coverage glyphs in PairPos
Apparently class=0 is used for ClassDef1.  See:
https://github.com/adobe-type-tools/afdko/issues/90
2015-12-23 14:50:53 +01:00
Behdad Esfahbod 550bd14d2b Actually commit changes for previous commit 2015-11-04 22:58:58 -08:00
Behdad Esfahbod ff31b3c1b8 Skip GPOS cursive / attachment adjustmnent if none happened
I'm starting to really like how free these new scratch_flags are.
2015-11-04 22:47:30 -08:00
Behdad Esfahbod f966649747 Fix another memory access issue discovered by libFuzzer
Fixes https://github.com/behdad/harfbuzz/issues/139#issuecomment-146984679
2015-10-13 00:30:50 -04:00
Behdad Esfahbod f396fbb000 Fix return value of sanitize when subformat is not readable
This is a fix on top of the previous issue fixed in
c917965b9e.

This was caught by "libFuzzer" testing.
2015-10-09 12:25:55 -04:00
Behdad Esfahbod b47159011c Define return_trace()
Not functional change (expected!).
2015-09-29 14:57:02 +01:00
Behdad Esfahbod c917965b9e Add missing returns
Fixes possible invalid read of two bytes.

Reported by Behzad Najjarpour Jabbari, Secunia Research.
2015-09-29 14:45:35 +01:00
Behdad Esfahbod 6578575cc8 [GPOS] Fix cursive connection with mix of RTL and non-RTL lookups
See thread "Issue with cursive attachment" started by Khaled.
Turned out fixing this wasn't as bad as I had assumed.  I like the
new code better; we now have a theoretical model of cursive
connections that is easier to reason about.
2015-08-25 20:29:36 +01:00
Behdad Esfahbod 58f2a73fb9 [GPOS] Rewrite cursive attachment slightly differently
In anticipation for upcoming fix for bug reported by
Khaled in thread "Issue with cursive attachment".
2015-08-25 18:58:24 +01:00
Behdad Esfahbod 2c8b3b2e53 [debug] Print lookup index in debug-apply output 2015-08-18 14:36:43 +01:00
Behdad Esfahbod fc3c59a1d7 Fix unused var warnings 2015-04-08 13:04:29 -07:00
Behdad Esfahbod bd047d3b7f [layout] Minor 2015-02-25 15:43:31 -08:00
Behdad Esfahbod 1a2322134a [layout] Don't check glyph props against lookup flags when recursing
Shouldn't be needed.  I have a hard time imagining this breaking any
legitimate use case.
2015-02-25 15:43:30 -08:00