Commit Graph

6782 Commits

Author SHA1 Message Date
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
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
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
Ebrahim Byagowi 2b2ed1e536 [dfont] Add test 2018-09-11 16:47: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 f90bab8560 [util] Add --ft-load-flags
Useful for performance testing.

Not hooked to cairo yet.  Just changes shaping, not rasterization.
2018-09-11 14:23:35 +02:00
Behdad Esfahbod 93f7596254 [util] Add -n shorthand for --num-iterations
Meh.
2018-09-11 14:11:10 +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 2de96e8468 Test 'rand' 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
David Corbett c2a75e07e5 Implement 'rand' 2018-09-11 10:47:59 +02:00
Behdad Esfahbod 96471fe859 [uniscribe] Fix build 2018-09-11 01:39:23 +02:00
Behdad Esfahbod becd84aa2f Add HB_FEATURE_GLOBAL_START/END
Fixes https://github.com/harfbuzz/harfbuzz/issues/1141

New API:
HB_FEATURE_GLOBAL_START
HB_FEATURE_GLOBAL_END
2018-09-11 01:27:25 +02:00
Behdad Esfahbod 13a8786c7c Add (unused) hb_array_t<> 2018-09-11 01:09:07 +02:00
Behdad Esfahbod bccf3e1827 Minor 2018-09-11 01:04:50 +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 bc485a9812 Port some VAR arrays to UnsizedArrayOf<>
Fix avar sanitize().
2018-09-10 23:08:18 +02:00
Behdad Esfahbod 1bc7a8d6c4 [indic] Cache hb_options().uniscribe_bug_compatible on indic_plan 2018-09-10 22:51:26 +02:00