Commit Graph

4202 Commits

Author SHA1 Message Date
Behdad Esfahbod d5f0d7c9fb Merge pull request #167 from KonstantinRitt/unicode_cp_opt
Micro optimizations to UTF-16 and UTF-32 codecs
2015-11-07 07:50:58 -08:00
Behdad Esfahbod 04ff23e73d [arabic] Improve stretch length calculation
Err on the side of being too short, than too wide.  Reduces chance
of overlaps with neighboring glyphs.
2015-11-06 16:29:44 -08:00
Behdad Esfahbod 59821ab8b4 [arabic] Don't stretch over cased letters
Addresses
6e6f82b6f3 (commitcomment-14248516)
2015-11-06 16:27:44 -08:00
Behdad Esfahbod 5337db29af Revert "Don't process lookups if buffer is in error"
This reverts commit f92bd86cc8.

We don't want to be like cairo, where as soon as there's an error,
nothing works anymore.  So, lets process lookups as long as there's
no new memory needed.  That's also a model that hides fewer bugs.
2015-11-06 16:18:09 -08:00
Konstantin Ritt 529a933128 Micro optimization to hb_utf16_t and hb_utf32_t ::prev()
Implement reverse lookup instead of re-using next()
2015-11-07 02:00:04 +04:00
Konstantin Ritt 44ae9be7a2 Nano optimization to hb_utf16_t and hb_utf32_t ::next() 2015-11-07 01:58:38 +04:00
Behdad Esfahbod a6d7668a95 [fuzzing] Cap max buffer len at 128 2015-11-06 09:46:54 -08:00
Behdad Esfahbod f1c4adbcd3 Fix typo 2015-11-06 09:46:05 -08:00
Behdad Esfahbod 68b507a3c3 Make sure we make progress in OOM situations 2015-11-06 00:09:26 -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 f0599db761 Fix hang in OOM situations
Fixes https://github.com/behdad/harfbuzz/issues/161
2015-11-05 23:55:51 -08:00
Behdad Esfahbod f92bd86cc8 Don't process lookups if buffer is in error 2015-11-05 23:52:29 -08:00
Behdad Esfahbod 4301703bdd Limit buffer max size growth
https://github.com/behdad/harfbuzz/issues/161
2015-11-05 23:44:59 -08:00
Behdad Esfahbod 19300183a6 [fuzzing] Add build system 2015-11-05 23:08:50 -08:00
Behdad Esfahbod 9c9ad214af [fuzzer] Add README
https://github.com/behdad/harfbuzz/issues/139#issuecomment-154202645
2015-11-05 22:50:52 -08:00
Behdad Esfahbod 6e6f82b6f3 Implement SYRIAC ABBREVIATION MARK with 'stch' feature
The feature is enabled for any character in the Arabic shaper.
We should experiment with using it for Arabic subtending marks.
Though, that has a directionality problem as well, since those
are used with digits...

Fixes https://github.com/behdad/harfbuzz/issues/141
2015-11-05 17:46:34 -08:00
Behdad Esfahbod c743ec5886 [ft] Fix extents with negative scales
Fixes https://github.com/behdad/harfbuzz/issues/162
2015-11-05 17:38:27 -08:00
Behdad Esfahbod 73fec3992a Reserve a few scratch-flags bits for complex shapers 2015-11-05 15:22:18 -08:00
Behdad Esfahbod 136863371c Add new shaper method postprocess_glyphs()
Unused currently.  To be used for Syriac stretch implementation.

https://github.com/behdad/harfbuzz/issues/141
2015-11-05 13:24:15 -08:00
Behdad Esfahbod 6c0ebd02c9 [util] If font has color, generate PNG with color 2015-11-05 11:37:48 -08:00
Behdad Esfahbod e95eb23a4e Don't try zeroing marks by GDEF if there are no non-ASCII
This one is a hack, but should be ok.
2015-11-04 22:59:28 -08:00
Behdad Esfahbod 7fa54ed75a Don't try zeroing mark attachments by Unicode if there's no non-ASCII 2015-11-04 22:59:24 -08: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 0f407325f6 Minor 2015-11-04 22:28:44 -08:00
Behdad Esfahbod 497a6c2071 Skip forming clusters if text is all ASCII 2015-11-04 22:24:19 -08:00
Behdad Esfahbod 28de104f15 Move variable-sized struct member to end
Hopefully makes clang build happy
2015-11-04 22:03:09 -08:00
Behdad Esfahbod 5bc28b5f68 Optimize positioning for when h_origin is nil 2015-11-04 21:53:16 -08:00
Behdad Esfahbod 762770c964 Add font->has_...() to check for individual nil font funcs
Hopefully this wouldn't break any compiler.  There was some magic
moments to getting this to compile...
2015-11-04 21:49:19 -08:00
Behdad Esfahbod 88e9a9bcae Minor reshaping of hb_font_funcs_t implementation
In anticipation of further changes.  No functional changes.
2015-11-04 21:16:26 -08:00
Behdad Esfahbod a6a7715bac Comments 2015-11-04 20:51:21 -08:00
Behdad Esfahbod 6c48ec830f [ot] Remove font funcs that do nothing 2015-11-04 20:47:42 -08:00
Behdad Esfahbod 75ea2daa1d [ot] Port ot font funcs to allocated object 2015-11-04 20:43:59 -08:00
Behdad Esfahbod 44f8275080 [ft] Remove font funcs that do nothing 2015-11-04 20:43:43 -08:00
Behdad Esfahbod 7918c261ef [ft] Port ft font funcs to allocated object 2015-11-04 20:37:49 -08:00
Behdad Esfahbod da29b43794 Separate nil font-funcs from parent-peeking font-funcs
API change: all fonts created with hb_font_create() now inherit from
(ie have parent) hb_font_get_empty().
2015-11-04 20:22:44 -08:00
Behdad Esfahbod bee901b38e Optimize positioning direction calculations
It makes the binary smaller AND faster.  Yumm!
2015-11-04 19:28:17 -08:00
Behdad Esfahbod e3e4bb011a Don't do fractions if buffer is ASCII-only 2015-11-04 18:58:02 -08:00
Behdad Esfahbod 6986208ba3 Optimize runs without Default_Ignorable's
Now that we have a buffer-wide scratch flags facility, use it to
optimize away a few passes.
2015-11-04 18:46:41 -08:00
Behdad Esfahbod 14c2de3218 Limit max edits during sanitize to 8
Used to be 100.  If a tabe needs more than one or two edits, it's
probably completely bogus...

Might help with speeding up fuzzing for
https://github.com/behdad/harfbuzz/issues/157
2015-11-04 18:00:57 -08:00
Behdad Esfahbod 9cbc39aef9 Minor 2015-11-04 18:00:53 -08:00
Behdad Esfahbod 52e6c4e158 If font doesn't support U+2011, fall back to U+2010
Test passes now.
2015-11-04 17:45:56 -08:00
Behdad Esfahbod 75483aafa6 Untangle if/else waterfall 2015-11-04 17:43:36 -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 550417117d [test] Drop hintings when subsetting fonts to record 2015-11-04 17:37:30 -08:00
Behdad Esfahbod 49ef630936 Adjust the width of various spaces if font does not cover them
See discussion here:
81ef4f407d

There's no way to disable this fallback, but I don't think it would
be needed.  Let's hope for the best!

Fixes https://github.com/behdad/harfbuzz/issues/153
2015-11-04 17:27:07 -08:00
Behdad Esfahbod aa7044de0c Generalize flags types 2015-11-04 16:25:57 -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 8b3c7f9ede [test] Support recording multiple lines of text in record-test.sh 2015-11-04 15:48:51 -08:00
Behdad Esfahbod 8565839480 Protect against possible invalid-memory access after OOM 2015-11-04 14:46:52 -08:00