Commit Graph

14607 Commits

Author SHA1 Message Date
Behdad Esfahbod 0ad5977cd6 [subset-cff] Simplify hinting processing
We already have drop_hints in the params.
2022-12-02 13:41:36 -07:00
Behdad Esfahbod 16cbe41bca
Merge pull request #3910 from googlefonts/repacker_fuzz
[repacker] Add a fuzzer for the hb-subset-repacker api.
2022-12-02 12:43:13 -07:00
Behdad Esfahbod 2a7a1d5a73 [Coverage] Avoid timeout on broken ranges
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53929
2022-12-02 12:33:24 -07:00
Behdad Esfahbod c947652768 [subset-cff] Micro-optimize 2022-12-02 12:01:35 -07:00
Behdad Esfahbod a24d4e9261 [array] Oops. Fix memcpy copy()! 2022-12-02 12:01:35 -07:00
Behdad Esfahbod 5e41766bb9 [array] Fix hb_bytes_t memcpy copy
Wasn't being used!
2022-12-02 12:01:35 -07:00
Behdad Esfahbod a5616227ca [subset-cff] Fix buffer size calculation 2022-12-02 12:01:35 -07:00
Behdad Esfahbod 015af5a8e5 [subset-cff] Write a couple loops as range-based for 2022-12-02 12:01:35 -07:00
Behdad Esfahbod bfbbd4af25 [subset-cff] Copy str for call ops 2022-12-02 12:01:35 -07:00
Behdad Esfahbod c755b3884f [subset-cff] Pre-alloc enough for check-less copy 2022-12-02 12:01:35 -07:00
Behdad Esfahbod 062e59ae67 [subset-cff] Optimize vector allocation for preprocessed input 2022-12-02 12:01:35 -07:00
Behdad Esfahbod 8e9e94dba9 Revert "[vector] Optimize grow_vector() for size"
This reverts commit 1dd9396c7a.

Is faster indeed.

15% on SourceHanSans/10000 benchmark.
2022-12-02 12:01:35 -07:00
Behdad Esfahbod 2644540a74 [subset-cff] Compact parsed strings if using accelerator
Saves 32% on SourceHanSans/10000 benchmark!

Also, use memcmp now for writing out strings since now that our
ops are not super short, that's faster.

This makes cff-japanese test takes super long though; that needs
inspection.
2022-12-02 12:01:35 -07:00
Behdad Esfahbod 6012d3b228 [subset-cff] Write out charstrings zerocopy to serializer 2022-12-01 17:33:53 -07:00
Garret Rieger 16f61a1c87 [repacker] only build repacker fuzzer when experimental api is enabled. 2022-12-02 00:02:14 +00:00
Behdad Esfahbod 36e1a6339c [cff] Add total_size to INDEX 2022-12-01 17:00:03 -07:00
Behdad Esfahbod 3843000660 [serialize] Add start_zerocopy() 2022-12-01 16:48:22 -07:00
Garret Rieger de5a621322 [repacker] enforce root node having no incoming edges. 2022-12-01 23:37:16 +00:00
Behdad Esfahbod a2681c37c1 [cff-subset] Simplify INDEX serialize() more 2022-12-01 16:15:23 -07:00
Behdad Esfahbod c4b05878cb [subset-cff] Remove INDEX unused serialize() methods 2022-12-01 15:56:37 -07:00
Behdad Esfahbod b3ad4d72cc [cff] Another no-memset in INDEX 2022-12-01 15:46:00 -07:00
Behdad Esfahbod 5fd2f255fc [open-type] Don't memset 0 in serialize for ArrayOf family
Not necessary.
2022-12-01 15:18:59 -07:00
Garret Rieger 30e405e470 [repacker] ensure link obj indices are valid. 2022-12-01 22:12:59 +00:00
Behdad Esfahbod 70ac6dfb28 [subset-cff] Don't memset 0 INDEX and other serialize methods
Not necessary.
2022-12-01 14:58:25 -07:00
Garret Rieger 554ed06fac [repacker] add cycle detection to the graph sort.
This allows us to bail early if the graph is not acyclic.
2022-12-01 21:52:37 +00:00
Behdad Esfahbod a66de336fb [vector] Minor use get_size() in as_bytes() 2022-12-01 14:32:13 -07:00
Behdad Esfahbod 0b826368fd [serializer] Don't memset memory in embed
Not necessary.
2022-12-01 14:23:25 -07:00
Behdad Esfahbod 3b68c7146f [array] Don't clear serializer buffer when copying out
Not needed.
2022-12-01 14:19:27 -07:00
Behdad Esfahbod 57808609c9 [VarData] Move an unlikely 2022-12-01 14:03:56 -07:00
Garret Rieger 9e99d08470 [repacker] validate link widths during repacker setup. 2022-12-01 20:17:41 +00:00
Garret Rieger edf7a29595 [repacker] Validate link positions before running the repacker. 2022-12-01 20:17:41 +00:00
Garret Rieger 88d437525f [repacker] add test for repacker fuzzer. 2022-12-01 20:17:40 +00:00
Garret Rieger 6627a1ab45 [repacker] Add a initial seed for the fuzzer repacker. 2022-12-01 20:17:40 +00:00
Garret Rieger deca30b268 [repacker] get repacker fuzzer working.
Additionally add helper method that allows a graph to be saved as a fuzzer seed.
2022-12-01 20:17:40 +00:00
Garret Rieger 261a605f9c [repacker] verify graph is a dag before using the fuzzer input. 2022-12-01 20:17:40 +00:00
Garret Rieger 985b19f678 [repacker] begin implementing a fuzzer for the repacker api. 2022-12-01 20:17:39 +00:00
Matthias Clasen c6d616cc41 Generate and install hb-features.h
This header has defines for all the optional
dependendencies that come with their own Harfbuzz
headers, so you can do:

  #include <hb-features.h>
  #ifdef HB_HAS_DIRECTWRITE
  #include <hb-directwrite.h>
  #endif
2022-12-01 18:16:55 +08:00
Behdad Esfahbod 8805a866b5 [ClassDef2] Write a few loops as range-based for 2022-11-30 17:18:04 -07:00
Behdad Esfahbod ac8b232a2d [gsub] Cache intersects_class results for closure
Benchmark                                                                                 Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
BM_subset/subset_codepoints/NotoNastaliqUrdu-Regular.ttf/nohinting/10                  +0.0246         +0.0240             0             0             0             0
BM_subset/subset_codepoints/NotoNastaliqUrdu-Regular.ttf/nohinting/64                  -0.5541         -0.5544             4             2             4             2
BM_subset/subset_codepoints/NotoNastaliqUrdu-Regular.ttf/nohinting/512                 -0.1120         -0.1123            43            38            43            38
BM_subset/subset_codepoints/NotoNastaliqUrdu-Regular.ttf/nohinting/1400                -0.1154         -0.1159            43            38            43            38
2022-11-30 17:09:04 -07:00
Behdad Esfahbod 20a0a46729 [perf] Remove stale run.sh 2022-11-30 15:59:54 -07:00
Behdad Esfahbod 38e7bc345c [benchmark-subset] Support testing arbitrary fonts from cmdline 2022-11-30 15:02:42 -07:00
Behdad Esfahbod c6a4b60116 [gsubgpos] Add an unlikely 2022-11-30 15:02:42 -07:00
Behdad Esfahbod d4dec54c3a [ci] Switch configs build to Ubuntu 20.04
https://github.com/actions/runner-images/issues/6002
2022-11-30 14:14:54 -07:00
Behdad Esfahbod 52d8346d99 [ci] Change Linux runner to Ubuntu 20.04
https://github.com/actions/runner-images/issues/6002
2022-11-30 14:14:54 -07:00
Behdad Esfahbod 32dd9810cf [subset-cff1] Cache glyph-to-sid-map in the accelerator
Benchmark                                                                                      Time             CPU      Time Old      Time New       CPU Old       CPU New
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/nohinting/10                   -0.0841         -0.0843             0             0             0             0
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/nohinting/64                   -0.1305         -0.1305             0             0             0             0
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/nohinting/512                  -0.1398         -0.1401             1             1             1             1
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/nohinting/4096                 +0.0382         +0.0380             9             9             9             9
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/nohinting/10000                +0.0213         +0.0211            11            11            11            11
2022-11-30 14:00:33 -07:00
Behdad Esfahbod 72fabef0a4 [SingleSubstFormat2] Speed up closure 2022-11-30 11:37:49 -07:00
Behdad Esfahbod 2dc2e016d4 [cff] Enable an unlikely 2022-11-30 11:25:50 -07:00
Behdad Esfahbod 582a87ef0a [cff] Speed up FDSelect0 sanitize 2022-11-30 11:20:19 -07:00
Garret Rieger 2658370f00 [subset] make the cmap cache in accelerator const. 2022-11-29 22:04:10 -07:00
Garret Rieger 7551a668e3 [subset] Make cff_accelerator const.
This gives more confidence that it won't be accidentally modified by the subset operation using it.
2022-11-29 22:04:10 -07:00