Commit Graph

11495 Commits

Author SHA1 Message Date
Behdad Esfahbod 6af4985bf9 [subset-cff] No need for bitflag here anymore 2022-11-26 18:20:20 -07:00
Behdad Esfahbod 69ce606d14 [subset-cff] Immediately drop subr numbers instead of marking for skip
Seems to work and saves ~2% time.
2022-11-26 18:18:35 -07:00
Behdad Esfahbod 1cf4f3e083 [subset-cff] More comment 2022-11-26 18:15:28 -07:00
Behdad Esfahbod f68221ff43 [subset-cff] Add comment 2022-11-26 18:12:14 -07:00
Behdad Esfahbod 048ab8a066 [subset-cff] Remove unused bits 2022-11-26 18:00:43 -07:00
Behdad Esfahbod 37cbfc0c7e [subset-cff] Remove unneeded member 2022-11-26 17:57:44 -07:00
Behdad Esfahbod 46ab15137b [subset-cff] Add has_calls to parsed charstrings
Optimize closure based on it.
2022-11-26 17:49:21 -07:00
Behdad Esfahbod 6d53074e63 [subset-cff] Drop another unused parameter 2022-11-26 17:23:09 -07:00
Behdad Esfahbod 42615561b5 Optimize a couple array references 2022-11-26 17:13:20 -07:00
Behdad Esfahbod 04d23b7ca8 [subset-cff] Micro-optimize collect_subr_refs_in_str 2022-11-26 17:08:00 -07:00
Behdad Esfahbod 9d18180c3c [array] Use hb_hash instead of handrolling 2022-11-26 15:38:21 -07:00
Behdad Esfahbod e302b9d5da Fix build 2022-11-26 15:18:16 -07:00
Behdad Esfahbod 70d97d079b [subset-cff] Remove unused argument 2022-11-26 15:16:11 -07:00
Behdad Esfahbod 4167e93a15 [subset-cff2] Micro-optimize blend operator 2022-11-26 15:14:52 -07:00
Behdad Esfahbod f159bf075b [cff2] Micro-optimize blend operator 2022-11-26 15:11:32 -07:00
Behdad Esfahbod a331e913dc [bit-page] Hand-code equality
Faster than memcmp() because of alignment.
2022-11-26 14:59:37 -07:00
Behdad Esfahbod 9df06a2695 [bit-set] Fix is_subset() short-circut criteria
Ouch!
2022-11-26 14:56:45 -07:00
Behdad Esfahbod 915c1a00cf [vector] Add remove_unordered
Saves 5% in NotoNastaliq/1000 subset benchmark.
2022-11-26 14:48:57 -07:00
Behdad Esfahbod 4b8d8fbee4 [ot-map] Micro-optimize for size 2022-11-26 14:31:15 -07:00
Behdad Esfahbod 93f3a9dbc6 [ot-map] Micro-optimize more
Another 500 bytes.
2022-11-26 14:25:21 -07:00
Behdad Esfahbod f39f049870 [ot-map] Micro-optimize
Weird that shrinks size by 500 bytes.
2022-11-26 14:16:15 -07:00
Behdad Esfahbod 60bb32c454 [ot-map] Minor refactor 2022-11-26 14:12:57 -07:00
Behdad Esfahbod e3cc61838f [PairPos] Adjust kerning buffer messages 2022-11-26 13:58:04 -07:00
Behdad Esfahbod a81dd1053d [layout] Adjust printing feature tags
For required-feature, print spaces, not nul bytes.
2022-11-26 13:43:36 -07:00
Behdad Esfahbod 56e3868b52 [layout/buffer-message] Print feature name in lookup buffer messages 2022-11-26 13:14:23 -07:00
Garret Rieger a5d35fd80a [subset] use charstrings directly from accelerator cache if mutability isn't needed. 2022-11-25 16:50:55 -07:00
Behdad Esfahbod 026b64ef76 [subset-cff] Avoid set mallocation in hb_plan_subset_cff_fdselect 2022-11-25 14:57:40 -07:00
Behdad Esfahbod 74acf52f33 [subset-cff] Micro-optimize copy_str more 2022-11-25 14:43:44 -07:00
Behdad Esfahbod d2f3cde7ef [subset-cff] Micro-optimize copy_str 2022-11-25 14:38:30 -07:00
Behdad Esfahbod e333223f26 [array] Optimize serializing copy() 2022-11-25 14:26:02 -07:00
Behdad Esfahbod 22990fca1d
Merge pull request #3894 from googlefonts/cff_accel
[subset] Cache parsed char strings in CFF accelerator
2022-11-25 14:12:58 -07:00
Garret Rieger 8d5c899b0f [subset] In cff accelerator hold reference to CFF table instead of the whole font. 2022-11-25 20:53:20 +00:00
Behdad Esfahbod 7b197446ac [vector] Adjust for HB_OPTIMIZE_SIZE 2022-11-25 13:28:53 -07:00
Garret Rieger 75a99f28ab [subset] destruct cff accelerator if present. 2022-11-25 20:24:05 +00:00
Behdad Esfahbod 1d474194f0 [subset-cff] Micro-optimize encode_str 2022-11-25 13:21:35 -07:00
Behdad Esfahbod 3c4a610b59 [subset-cff] Micro-optimize copy_str some more 2022-11-25 13:16:30 -07:00
Behdad Esfahbod 535aadb309 [subset-cff] Micro-optimize collect_subr_refs_in_str more 2022-11-25 13:07:42 -07:00
Behdad Esfahbod 00a9df3a43 [subset-cff] Micro-optimize collect_subr_refs_in_str 2022-11-25 13:05:05 -07:00
Behdad Esfahbod d2a2f5bf4e [vector] Handroll copy 2022-11-25 12:44:02 -07:00
Behdad Esfahbod 1fed366d5b [serialize] Shut compiler warning off 2022-11-25 12:37:24 -07:00
Behdad Esfahbod f2297e6978 [buffer] Documentation
Fixes https://github.com/harfbuzz/harfbuzz/issues/3889
2022-11-25 11:33:00 -07:00
Garret Rieger 71c23c1c07 [subset] don't copy the entire global/loca subr lists from the accelerator.
Instead run a closure on the retained charstrings and copy only the referenced subrs. This significantly speeds up cases with small character sets.
2022-11-25 18:05:39 +00:00
Garret Rieger 4ff09274a8 [subset] In CFF accelerator keep a reference to original face.
The charstring objects reference memory from the original face so we need to maintain a reference to prevent it from being destroyed.
2022-11-24 22:47:29 +00:00
Behdad Esfahbod 6aaa16627c [Coverage] Comment 2022-11-24 14:58:42 -07:00
Behdad Esfahbod 06e2147a48 More call set->next() directly 2022-11-24 14:56:04 -07:00
Behdad Esfahbod 196c9db06f Call ->next() directly 2022-11-24 14:51:52 -07:00
Behdad Esfahbod 03d64b7469 [bit-set] Remove TODO that would never happen 2022-11-24 14:33:18 -07:00
Behdad Esfahbod 690df8a369 [bit-set] Micro-optimize prev() 2022-11-24 14:32:51 -07:00
Behdad Esfahbod fe5d9176ae [bit-set] Micro-optimize size
It's silly that this saves size at all. :(
2022-11-24 14:30:18 -07:00
Behdad Esfahbod cf9b9929df [bit-set] Micro-optimize process() 2022-11-24 14:26:28 -07:00
Behdad Esfahbod d77903db7b [bit-set] Micro-optimize 2022-11-24 14:22:32 -07:00
Behdad Esfahbod 13dd4b464b [bit-set] Micro-optimize access 2022-11-24 14:20:42 -07:00
Garret Rieger a3afa61ce8 [subset] use cached parsed char strings if available. 2022-11-24 21:14:00 +00:00
Garret Rieger 47c125845c [subset] Cache parsed charstrings in the cff accelerator. 2022-11-24 21:14:00 +00:00
Garret Rieger 48b6837074 [subset] add a CFF specific accelerator object.
This allows CFF specific accelerator structures to be isolated to the CFF code.
2022-11-24 21:13:59 +00:00
Behdad Esfahbod d77f346d1a [subset-cff] Minor rename 2022-11-24 14:02:46 -07:00
Behdad Esfahbod 29a0fa089a [subset-cff] Micro-optimize 2022-11-24 14:00:59 -07:00
Behdad Esfahbod d480ae1fac [cff] Remove unused function 2022-11-24 13:53:43 -07:00
Behdad Esfahbod 73046d53e5 [shaper] Disable dumber shaper if no AAT 2022-11-24 13:49:29 -07:00
Behdad Esfahbod e9f964c01a [ot-face] Declare more tables as core 2022-11-24 13:38:53 -07:00
Behdad Esfahbod 5bc27a128d [machinery] Comment 2022-11-24 13:30:12 -07:00
Behdad Esfahbod d21bfb0861 [normalize] Remove an unlikely
Keep unlikely for truely unlikely scenarios.
2022-11-24 13:14:05 -07:00
Behdad Esfahbod 9e1239f443 [config] Define HB_NO_VERTICAL in HB_LEAN and as such in HB_TINY 2022-11-24 13:00:47 -07:00
Behdad Esfahbod 6f133ccfde [glyf] Fix build with HB_NO_VERTICAL 2022-11-24 12:59:55 -07:00
Behdad Esfahbod 76420ef769 [machine.rl] Remove unlikely from what happens 1/16 of the time 2022-11-24 12:52:15 -07:00
Behdad Esfahbod 1248574454 [config] Disable Zawgyi shaper in HB_MINI/HB_TINY 2022-11-24 12:46:04 -07:00
Behdad Esfahbod 05aa084e67 [PairPos] Another attempt at fixing unsafe-to-break with ValueFormat2
Fixes https://github.com/harfbuzz/harfbuzz/issues/3888#issuecomment-1326781116

Test:
$ hb-shape XBRoya34.ttf  ' الأ' --show-flags --script=arab
2022-11-24 12:14:09 -07:00
Behdad Esfahbod 54ae3345b2 [buffer] Improve documentation of hb_buffer_add_codepoints()
Fixes https://github.com/harfbuzz/harfbuzz/issues/3889
2022-11-24 12:00:36 -07:00
Behdad Esfahbod a4a4078632
Merge pull request #3893 from googlefonts/preprocess_test
[subset] Fix testing of preprocess
2022-11-24 11:56:58 -07:00
Behdad Esfahbod 0c70bc7f32 [skippy-iter] Fix two logic errors
First, a signed underflow.

Second, a wrong condition.

Both were introduced in 42681bdb55
2022-11-24 11:48:48 -07:00
Behdad Esfahbod 3b43096ef3 [buffer] Whitespace 2022-11-23 22:04:02 -07:00
Behdad Esfahbod 094f80738a [buffer] Handle null buffer in set_message_func 2022-11-23 22:03:26 -07:00
Behdad Esfahbod 1fa64c0c23 [gsubgpos] Conditionalize skippy on unsafe-to-concat 2022-11-23 21:38:51 -07:00
Behdad Esfahbod 42681bdb55 [gsubgpos] No logic-change minor rewrite 2022-11-23 21:36:43 -07:00
Behdad Esfahbod c15efdec49 [gsubgpos] Comment 2022-11-23 21:14:28 -07:00
Behdad Esfahbod 7ec1c41a55 [gsubgpos] Skippy-iter: Prefer correctness to performance
Prefer unsafe-to-concat correctness, over performance.
2022-11-23 21:12:41 -07:00
Behdad Esfahbod dce3502e10 [array] Add commented-out static asserts
They don't work.
2022-11-23 18:34:54 -07:00
Behdad Esfahbod a7fee43cef [priority-queue] Minor micro-optimize 2022-11-23 17:46:32 -07:00
Garret Rieger ff3cac0ccd [subset] Fix unecessary trailing 0 bytes left by ContextFormat2 pruning.
Uneeded rules where beind removed from the count by the bytes for them was being left in the font.
2022-11-23 23:50:49 +00:00
Behdad Esfahbod f2851e4157 [test-map] Test has() getter with unique-ptr 2022-11-23 16:50:30 -07:00
Behdad Esfahbod 5f3a780614 [font] Protect against div-by-zero 2022-11-23 16:45:46 -07:00
Behdad Esfahbod 060ecac949 [font] Respect subfont slant setting in hb-draw
Fixes https://github.com/harfbuzz/harfbuzz/issues/3890
2022-11-23 16:31:37 -07:00
Garret Rieger 51028e63e6 [subset] Retain all glyphs in preprocessed face. 2022-11-23 22:51:16 +00:00
Behdad Esfahbod 404cb99d86 [buffer-diff] Fix check for glyph flag equality
I'm not sure if the old behavior was intentional, but it was checking
that the glyph flags were a subset of the reference buffer's glyph
flags.  I don't see why that is useful.  Fix that.

Then make the buffer-verify code ignore flag differences when verifying
buffers, since our unsafe-to-concat flag at least, is conservative and
not guaranteed to be produced the same in fragments.  See:

https://github.com/harfbuzz/harfbuzz/issues/3888
2022-11-23 15:37:03 -07:00
Garret Rieger 4c49daf7cd [subset] actually use the preprocessed face in hb-subset.
Tests weren't actually using the preprocessed face due to this typo in util/hb-subset.
2022-11-23 22:33:57 +00:00
Garret Rieger 2c0afde737 [subset] add an inprogress accelerator to plan.
This allows subset code to cache information into the accelerator during preprocess subset. Previously the accelerator was created at the end of subsetting.
2022-11-23 13:41:52 -07:00
Garret Rieger 81640fdffe [subset] fix leaked font in glyf::subset(...) 2022-11-23 13:41:52 -07:00
Behdad Esfahbod dcce53ddcb [cff] Micro-optimize fetch_op 2022-11-23 13:20:48 -07:00
Behdad Esfahbod 0bf7d9eb4d [subset-cff] Micro-optimize encode_byte 2022-11-23 13:20:48 -07:00
Behdad Esfahbod a23f820427 [subset-cff] Micro-optimize array access 2022-11-23 13:20:48 -07:00
Behdad Esfahbod 1e8f1ac677 [subset-glyf] Micro-optimize array access 2022-11-23 13:20:48 -07:00
Behdad Esfahbod 356d135ed6 [subset-glyf] Reduce roundf calls
Saves 7% on MPLUS1-Variable/6000 benchmark.
2022-11-23 13:20:48 -07:00
Garret Rieger 463ae07e99 [subset] In the preprocess subset call always use long loca.
Long loca is needed so that we can store the trimmed glyph bytes to allow us to safely skip trimming in the later subset.
2022-11-23 12:52:55 -07:00
Behdad Esfahbod 299ec902eb [glyf] Move instanciation to serialize() 2022-11-22 16:03:02 -07:00
Behdad Esfahbod d8d881f22d [subset-glyf] Don't create a second glyf accelerator 2022-11-22 15:24:16 -07:00
Behdad Esfahbod 7560930070 [glyf] Add _create_font_for_instancing 2022-11-22 15:22:25 -07:00
Behdad Esfahbod 40634ceeb0 [glyf] Adjust data types 2022-11-22 15:07:16 -07:00
Behdad Esfahbod ba0d28ea36 [glyf] Fix font error check 2022-11-22 15:01:48 -07:00
Behdad Esfahbod 04c525019c [glyf] Use a malloc instead of calloc 2022-11-22 14:54:55 -07:00
Behdad Esfahbod 024aa81805 [glyf] Micro-optimize encode_coord 2022-11-22 14:51:42 -07:00