Commit Graph

201 Commits

Author SHA1 Message Date
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 0fe62c1f33 [set] Add add_array()
To be used to optimize adding a whole bunch of (sorted) items at the same time,
as in CoverageFormat1.
2017-12-14 10:39:00 -08:00
Behdad Esfahbod c6173a392c Add Offset16 and Offset32 2017-11-14 21:09:03 -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 40ec3bbb55 Consolidate debug stuff into hb-debug.hh
Part of fixing https://github.com/behdad/harfbuzz/pull/605
2017-11-03 17:18:17 -04:00
Behdad Esfahbod dbdbfe3d7b Use nullptr instead of NULL 2017-10-15 12:11:08 +02:00
Behdad Esfahbod c3448e8d21 Use static_assert instead of custom ASSERT_STATIC 2017-10-15 12:02:00 +02:00
Behdad Esfahbod 8820ba29df Fix warning about "may be used uninitialized" 2017-08-15 17:12:21 -07:00
Behdad Esfahbod a4fca9f005 [var] Implement DeltaSetIndexMap and advance delta fetching
Not hooked up to hb-ot-font yet.
2017-01-23 12:25:40 -08:00
Behdad Esfahbod b732c53eb5 Add LArrayOf<> 2017-01-22 20:31:53 -08:00
Behdad Esfahbod 5e156fa5ed Add LOffsetTo<> 2017-01-22 20:28:56 -08:00
Behdad Esfahbod eab418c5e6 Avoid infinite loop in CoverageFormat2 iteration with bad fonts
Fixes https://github.com/behdad/harfbuzz/issues/363
2016-12-21 15:51:28 -06:00
Behdad Esfahbod 219cb29c5d Fix build after rebasing opentype-gx branch on top of MATH table 2016-12-16 19:06:26 -06:00
Behdad Esfahbod 4ebbeb7c50 [GX] Make FeatureVariations actually work
Yay!!!!
2016-12-16 19:06:26 -06:00
Behdad Esfahbod ec87ba9ba3 [GX] Add hb_ot_layout_feature_with_variations_get_lookups() 2016-12-16 19:06:26 -06:00
Behdad Esfahbod 30c42b644e [GX] Add hb_ot_layout_table_find_feature_variations() 2016-12-16 19:06:26 -06:00
Behdad Esfahbod 26648cebcd [GX] Remove (partial) support for anisotropic variations
It doesn't always work, not part of FreeType, and we were not going
to expose it in the API anyway.  Can always be added later.
2016-12-16 19:06:26 -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 85ec494434 [GX] Fix another x/y thinko
Thanks Werner!
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 1f6ed356e0 [GX] Fix build with some compilers
Eg. https://ci.appveyor.com/project/behdad/harfbuzz/build/1.0.48/job/o9mnd33kcdeeg30r

hb-open-type-private.hh:103:29: error: static data member 'OT::Device::<anonymous union>::<anonymous struct>::static_size' in unnamed class [-fpermissive]
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 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 8dddc231cf [GX] Revert "[GX] Add VariationAlternates, to allow conditional lookups in GSUB/GPOS"
This reverts commit 2859f1c7174d6f7ae5dcf0db5411bc0182b21594.
We are going in a different direction.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod baa329c6a1 [GX] Add compact VariationDevice implementation
Add compact format that uses signed bytes instead of shorts.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod 71b06fd392 [GX] Add VariationAlternates, to allow conditional lookups in GSUB/GPOS
Not hooked up to runtime yet.
2016-12-16 19:06:26 -06:00
Behdad Esfahbod 976eeb8e02 [GX] Minor 2016-12-16 19:06:26 -06:00
Behdad Esfahbod ed8a9067ca [GX] Minor 2016-12-16 19:06:26 -06:00
Behdad Esfahbod 15c5ee6747 [GX] Minor rename 2016-12-16 19:06:26 -06:00
Behdad Esfahbod 4c535a822f [GX] Hookup VariationDevice to Device table implementation 2016-12-16 19:06:26 -06:00
Behdad Esfahbod a0c2366075 [GX] Break out early if factor is zero
Also disable sanity-checking of variation records.
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 6d9d3c55bb [GX] Add data types for encoding numerical variations 2016-12-16 19:06:26 -06:00
Behdad Esfahbod 851b0db36d Minor. We should never get to this branch, but fix it anyway. 2016-04-08 23:46:55 -07:00
Behdad Esfahbod d163dc18e6 Minor 2016-01-12 13:05:01 +00:00
Behdad Esfahbod da2fcfdc51 Don't count fixing-up FeatureParams offset as error
The font Garamond Premier Pro Caption (and possibly many other
Adobe fonts), have many FeatureParamsSize tables with the old
wrong offset.  We handle fixing those up, but they were still
contributing to edit_count, and when I reduced HB_SANITIZE_MAX_EDIT
from 100 to 8 in 14c2de3218, these
fonts were now getting GPOS dropped and hence kerning disabled.

Fix, by not counting edits made towareds offset fix-up.  I'll
also increase edit count again, in the next commit.
2016-01-05 13:23:45 +00:00
Chun-wei Fan 167c327177 Fix build on MSVC >= 2012
Use the DEFINE_ENUM_FLAG_OPERATORS macro in winnt.h on Visual Studio,
which defines the bitwise operators for the enumerations that we want to
mark as hb_mark_as_flags_t, which will take care of the situation on newer
Visual Studio (>= 2012), where the build breaks with C2057 errors as the
underlying types of the enumerations is not clear to the compiler when we
do a bitwise op within the declaration of the enumerations themselves.

Also disable the C4200 (nonstandard extension used : zero-sized array in
struct/union) and C4800 ('type' : forcing value to bool 'true' or 'false'
(performance warning)) warnings as the C4200 is the intended scenario and
C4800 is harmless but is so far an unavoidable side effect of using
DEFINE_ENUM_FLAG_OPERATORS.
2015-11-17 12:19:22 +08:00
Behdad Esfahbod aa7044de0c Generalize flags types 2015-11-04 16:25:57 -08:00
Behdad Esfahbod 5ba450407b Make max context-length and max nesting level configurable
...at compile time.
2015-11-02 15:43:39 -08:00
Behdad Esfahbod 613e630617 Reduce max nesting level from 8 to 6
We probably should implement better system to catch cyclic lookups.
But for now, this speeds up worst case behavior with broken fonts
considerably without compromising legitimate usecases.

https://github.com/behdad/harfbuzz/issues/139#issuecomment-147788447
2015-10-13 23:33:28 -03:00
Behdad Esfahbod b47159011c Define return_trace()
Not functional change (expected!).
2015-09-29 14:57:02 +01:00
Behdad Esfahbod ef79bdf73b Minor 2015-02-25 15:43:35 -08:00
Behdad Esfahbod 8e3d4bae03 Minor 2015-02-25 15:43:33 -08:00
Behdad Esfahbod 40c58923cb [layout] Refactor Lookup::dispatch() 2015-02-25 15:43:30 -08:00
Behdad Esfahbod 70366f5d19 [layout] Refactor get_subtable() 2015-02-25 15:43:29 -08:00
Behdad Esfahbod de2118ed7a Make sanitize() a const method
This makes a lot of code safer.  We only try modifying the object in one
place, after making sure it's safe to do so.  So, do a const_cast<> in
that one place...
2015-02-25 15:43:28 -08:00
Behdad Esfahbod 7627100f42 Mark unsigned integer literals with the u suffix
Simplifies hb_in_range() calls as the type can be inferred.
The rest is obsessiveness, I admit.
2014-07-11 16:22:13 -04:00
Behdad Esfahbod 7d4ada66c9 Mark unsed members with a "Z" suffix
There may be more.  There are members that are by definition
redundant or reserved and not needed, NOT what we *currently*
don't use.

I'm sure there's more...
2014-06-27 17:32:56 -04:00
Behdad Esfahbod 586b60622c Minor: final bits of cleanup 2014-06-27 15:39:47 -04:00