Commit Graph

5167 Commits

Author SHA1 Message Date
Michiharu Ariza f2c4720ae6 Merge branch 'master' into cff-subset 2018-09-13 12:44:00 -07:00
Behdad Esfahbod ca746f261e [dfont] Also check dataLen range in sanitize
Just to disagree with myself re being done with this code...
2018-09-13 20:35:21 +02:00
Behdad Esfahbod 3789c557ca [dfont] Solve the mystery +2 offset thing!
Previously, ResourceForkHeader was defined as 30 bytes, having the typeCountM1 as last member.
There was a mysterious offset-by-2 in the code, derived from FontTools and JDK code this was
ported from.

In testing, I observed that typeListZ offset is actually 28.  Suggesting that the typeCountM1
does NOT actually belong to ResourceForkHeader, but belongs to the array itself.  Adjusting for
that resolves the mystery +2 offset hack, so everything is clean and good now.

This, concludes my dfont hacking.  The code looks great now, and I'm happy to leave it.
Fuzzers might disagree though, we will see!
2018-09-13 20:32:13 +02:00
Behdad Esfahbod effc7ced72 Rename HeadlessArrayOf::len to lenP1
So it doesn't accidentally match our templates, etc.
2018-09-13 20:21:54 +02:00
Michiharu Ariza 1234a81368 add head table to CFF/CFF2 2018-09-13 10:55:56 -07:00
Behdad Esfahbod 180a88a96c [dfont] Some more 2018-09-13 19:26:44 +02:00
Behdad Esfahbod 0ab0f1e5ac [dfont] Push methods further down 2018-09-13 19:13:01 +02:00
Behdad Esfahbod 8c9bdcc1fe [dfont] Minor 2018-09-13 19:08:22 +02:00
Behdad Esfahbod 4479d3a2ed [dfon]t Sanitize OpenTypeFontFace 2018-09-13 19:06:50 +02:00
Behdad Esfahbod 3fba41906f [dfont] Minor 2018-09-13 18:49:16 +02:00
Behdad Esfahbod bf852f0e62 [dfont] Make test pass
Offset 0 is not null in this context.
2018-09-13 18:47:53 +02:00
Behdad Esfahbod 29faebe911 Allow Offset<>'s that have no 0==null 2018-09-13 18:47:25 +02:00
Behdad Esfahbod 82f4d776c2 [dfont] Minor 2018-09-13 18:27:20 +02:00
Behdad Esfahbod 07e0ca930c [bytes] Rename content to arrayZ 2018-09-13 17:39:51 +02:00
Behdad Esfahbod dbb764dceb [dfont] Clean up sanitize()
I don't think I broke anything.  Fuzzers will let me know..
2018-09-13 17:21:00 +02:00
Behdad Esfahbod 361fc26861 Fix OffsetTo::sanitize() after reshuffling 2018-09-13 16:47:33 +02:00
Behdad Esfahbod 4c6b0fb5f6 OffsetTo::sanitize() Add version with three user_data 2018-09-13 16:39:30 +02:00
Behdad Esfahbod a73bea69c5 OffsetTo::sanitize() more shuffling 2018-09-13 16:31:31 +02:00
Behdad Esfahbod b482e5231c OffsetTo::sanitize() reshuffling 2018-09-13 16:29:49 +02:00
Michiharu Ariza 3cae9c7515 fixed hb_plan_subset_cff_fdselect
FDSelect3/4 sentinel size wasn't taken into account
2018-09-12 17:23:08 -07:00
Michiharu Ariza 0f159a38a6 fixed serialize_fdselect_3_4 2018-09-12 16:08:54 -07:00
Michiharu Ariza 1608481d88 fixed bugs in Charset serialization
also some code cleanup
2018-09-12 13:22:19 -07:00
Michiharu Ariza f45ac6296a fixed name mixup in Remap::reset
it was causing inconsistent Strings Index subset results
2018-09-11 22:41:50 -07:00
Michiharu Ariza 497e7fb264 misc bug fixes
Added OpCode_FontMatrix to TopDictOpSet (yet to parse values)
fixed a wrong assert in encode_int
2018-09-11 16:47:55 -07:00
Michiharu Ariza 5b453f77f8 fixed off-by-one error with offSize 2018-09-11 16:20:39 -07:00
Michiharu Ariza 1499029a96 fixed a bug 2018-09-11 13:56:52 -07:00
Michiharu Ariza 0bd5912a08 make parse_bcd locale free 2018-09-11 13:24:27 -07:00
Michiharu Ariza bb38d0f663 Implement parse_bcd 2018-09-11 10:43:15 -07:00
Michiharu Ariza 45e564a519 Merge branch 'master' into cff-subset 2018-09-11 09:46:37 -07:00
Behdad Esfahbod bd75fd45cd [dfont] Some renaming, plus add link to reference doc 2018-09-11 18:32:25 +02:00
Behdad Esfahbod 4134ec1307 [dfont] Sanitize only sfnt resources as OpenTypeFontFile 2018-09-11 17:56:03 +02:00
Behdad Esfahbod 6b5e4d07ad [dfont] Minor 2018-09-11 17:26:24 +02:00
Behdad Esfahbod d5c509272f [dfont] Fix test expecatation and minor touch up
I have no way to authoritatively know, but looks like test font only has one
face.  So, adjust test expectation instead.
2018-09-11 17:18:21 +02:00
Behdad Esfahbod 9479ffefbf [dfont] Re-enable and fix offset handling
Fixes https://github.com/harfbuzz/harfbuzz/pull/1085
2018-09-11 16:41:26 +02:00
Behdad Esfahbod a1814e2bec Whitespace 2018-09-11 14:45:23 +02:00
Behdad Esfahbod 383060cc33 [ft] Invalidate advance cache if font size changed 2018-09-11 14:41:19 +02:00
Behdad Esfahbod 54998befc4 [ft] Cache advances
I decided to always use the cache, instead of my previous sketch direction
that was to only allocate and use cache if fast advances are not available.
The cache is a mere 1kb, so just use it...

TODO: Invalidate cache on font size change.

Fixes https://github.com/harfbuzz/harfbuzz/issues/651
Fixes https://github.com/harfbuzz/harfbuzz/pull/1082
2018-09-11 14:36:14 +02:00
Behdad Esfahbod 047a84c5dd [ft] Towards caching slow get_h_advance results
Related to https://github.com/harfbuzz/harfbuzz/pull/1082
2018-09-11 14:05:16 +02:00
Behdad Esfahbod 237f215378 [ft] Add advances() callback 2018-09-11 13:05:47 +02:00
Behdad Esfahbod cbea7d49ab [ot-font] Rename 2018-09-11 12:57:41 +02:00
Behdad Esfahbod d8a67dac2a [ot-font] Add advances() callbacks 2018-09-11 12:55:54 +02:00
Behdad Esfahbod 0ea42e117b [cache] Minor 2018-09-11 12:22:42 +02:00
Behdad Esfahbod 0f520adaac Revert "Remove unused hb_cache_t"
This reverts commit 473b17af4d.

Updates to recent changes.
2018-09-11 12:07:39 +02:00
Behdad Esfahbod cfdea88475 [random] Switch to 32bit RNG 2018-09-11 10:57:48 +02:00
Behdad Esfahbod 08260c708a [random] Shuffle 2018-09-11 10:51:19 +02:00
Behdad Esfahbod 71c9f84e7c Make --features rand=1 available to the user
Use rand=255 to mean "randomize".

Part of https://github.com/harfbuzz/harfbuzz/pull/803
2018-09-11 10:47:59 +02:00
Behdad Esfahbod cc1c4fdf88 Respect user's wish if they set rand feature manually
Except if the set it to 1, which would mean "randomize"... Ugly.
2018-09-11 10:47:59 +02:00
Behdad Esfahbod 80de4bcd26 Minor clean up of 'rand' patchset 2018-09-11 10:47:59 +02:00
David Corbett b545e27d88 Don't seed the RNG from the contents of the buffer 2018-09-11 10:47:59 +02:00
David Corbett f05df643b4 Allow requesting a specific glyph for 'rand'
Randomization only happens by default. If the user specifies a value for
'rand', that value is respected.
2018-09-11 10:47:59 +02:00