Commit Graph

277 Commits

Author SHA1 Message Date
Qunxin Liu b92e4cc009 Avoid use values () in hb-hashmap if value_t has an overriden operator & 2022-11-14 13:19:55 -07:00
Behdad Esfahbod 630f09c8b6 Another hb_memcpy instead of strncpy use 2022-11-09 11:32:30 -07:00
Qunxin Liu 6314aa7da4 [subset] add an experimental API that can override name strings for specified name_id 2022-11-08 14:10:25 -07:00
Garret Rieger 515863e57c [subset] Remove add accelerator flag, replace with new api method.
Adds hb_subset_preprocess() which preprocesses the face and attaches accelerator data.
2022-10-13 23:42:00 +00:00
Garret Rieger 01481db582 [subset] use accelerator unicode to gid map if available. 2022-10-13 21:12:22 +00:00
Qunxin Liu f4813e3b7f [instance] update collect_lookups/prune_features()/closure_features() with variations
Some features will be substituted with variations, so we do not collect
lookups from the original feature tables.
2022-09-29 12:14:43 -06:00
Qunxin Liu 64e2f2fc58 [instance] store active featurevariation record/condition idxes in the plan 2022-09-29 12:14:43 -06:00
Qunxin Liu 0a6c16a313 [instance] instantiate fvar table
Added an old->new axes_indices mapping in the subset plan
2022-09-29 12:14:43 -06:00
Khaled Hosny d827a5ee40 [subset] Skip glyph closure for any dropped table
If COLR or MATH tables are being dropped, there is no point in closing
glyphs over them, just like it is done for GSUB.
2022-09-19 13:49:42 -06:00
Qunxin Liu 2b766e8ade [subset] No need to collect_features twice 2022-09-06 13:41:51 -06:00
Qunxin Liu a3e6dbbb43 [subset] skip the script if it's not included in the final subset 2022-09-06 11:29:34 -06:00
Qunxin Liu 7d7b492344 [instance] move _normalize_axes_location to the beginning of
subset_plan_create

pinned_at_default flag decides whether delta will be collected as well
when collecting layout variation indices
2022-09-01 09:44:28 -07:00
Qunxin Liu b72995ff16 [instance] GDEF table: collect both varidxes and deltas 2022-09-01 09:33:02 -07:00
Qunxin Liu e03043bd0b [subset] don't let VariationStore subset() produce inner_maps
Make it a subset-planning object so VariationStore can subset to
specified inner_maps.

Also add a layout_variation_idx_delta_map in subset_plan
2022-09-01 09:32:41 -07:00
Qunxin Liu ac0e22fa8e [instance] update glyf/hmtx/vmtx tables 2022-08-22 09:29:37 -07:00
Garret Rieger 37d61afd5e [subset] add destructor to subset plan.
This ensures that it's members get destructed before the plan itself is destructed, as hb_object_destroy calls the destructor for plan.
2022-08-18 16:09:36 -06:00
Qunxin Liu 0f80076937 [subset] Do not repeat COLR table closure 2022-07-20 19:17:34 -06:00
Behdad Esfahbod e1b5f2f806 [object] Call destructor in hb_object_destroy() 2022-07-20 15:07:55 -06:00
Qunxin Liu 712bfa8872 build fix for HB_NO_VAR 2022-07-19 15:16:37 -06:00
Qunxin Liu be8e8e8c80 [instance] prune name tables after axes pinned at fixed locations
Restricting axes to ranges is not supported yet.
2022-07-18 14:59:07 -06:00
Qunxin Liu df55f840cb [instance] instantiate STAT table when axes are pinned at fixed locations
restricting ranges is not supported yet.
2022-07-18 14:59:07 -06:00
Qunxin Liu 2a4773e43d add option "--instance", store axes_location in subset_plan and drop all
variation tables when all axes are pinned at default
2022-07-18 14:59:07 -06:00
Behdad Esfahbod 09de94788b [>64k:glyf] Hid composite glyphIndex 2022-07-12 13:42:52 -06:00
Behdad Esfahbod 04c5cd4085 [subset/layout] Move find_duplicate_features to subset from layout 2022-07-12 13:42:52 -06:00
Garret Rieger 29f149c16c [subset] cache sanitized tables in subset plan to avoid sanitizing tables multiple times. 2022-07-08 13:42:38 -06:00
Behdad Esfahbod 386e1bbad8
Merge pull request #3699 from googlefonts/filter_scripts
[subset] Add support for --layout-scripts
2022-07-05 12:46:05 -06:00
Garret Rieger 30309ec8d3 [subset] add null element in _filter_tag_list. 2022-07-05 18:33:19 +00:00
Garret Rieger 216cf5946b [subset] Allocate space for null entry in script/feature list. 2022-07-05 17:49:12 +00:00
Garret Rieger dbfd2bf327 minor. 2022-06-30 23:04:35 +00:00
Garret Rieger 5fdae68481 [reorg] Move GSUB.hh up one level and change GSUB namespace to GSUB_impl. 2022-06-30 15:33:20 -06:00
Garret Rieger 70e32a662f [subset] Add layout_scripts to subset input. 2022-06-30 21:00:48 +00:00
Garret Rieger 41d2c335bc [subset] Apply script list filter when doing layout collection. 2022-06-30 20:24:42 +00:00
Garret Rieger e5c8a2f4e1 [subset] Pass plan through to collect methods.
Allows to more easily access the filtering sets as they are added and enables propagating errors to the plan.
2022-06-30 20:14:29 +00:00
Garret Rieger 1bf051ef3b [subset] refactor feature tag filtering so it can be used for scripts as well. 2022-06-30 20:03:33 +00:00
Khaled Hosny 98e90cc67c [docs] Reduce warnings
Use markdown syntax for inline code blocks instead of %true, %false, and
%NULL.
2022-06-30 08:44:40 +02:00
Garret Rieger 3fbf2dece7 [reorg] Move OT::Layout::GPOS_impl::GPOS to OT::Layout::GPOS. 2022-06-28 18:47:50 -06:00
Garret Rieger 88ef3c5a9a [reorg] Change OT::Layout::GPOS to OT::Layout::GPOS_impl. 2022-06-28 18:47:50 -06:00
Garret Rieger 74f45f7c2a [reorg] Move remaining GPOS lookup types to new directory. 2022-06-28 18:47:50 -06:00
Behdad Esfahbod db039d97ff [glyf/Composite] Make glyphIndex public 2022-06-26 13:08:37 -06:00
Behdad Esfahbod b4a0c30d98 [glyf] Remove hardcoded HB_MAX_COMPOSITE_OPERATIONS 2022-06-25 17:01:11 -06:00
Behdad Esfahbod 36373ee15c [glyf] Move add_gid_and_children to subset-plan where it belongs 2022-06-25 16:55:26 -06:00
Behdad Esfahbod 100576b7b7 [glyf] Start splitting file 2022-06-25 14:38:43 -06:00
Behdad Esfahbod f13a79548f [subset] Convert another use of hashmap to unique_ptr 2022-06-03 01:17:20 -06:00
Garret Rieger adae2f2272 [subset-perf] Cache a glyph map for gsub.
This allows us in some cases to avoid using glyph_set_gsub as a filter.
2022-05-18 18:25:36 -06:00
Behdad Esfahbod ce60462173 [subset-plan] Pre-size maps in _create_old_gid_to_new_gid_map() 2022-05-18 12:34:27 -06:00
Behdad Esfahbod 8bfeea4828 [subset] Compute set max using previous() 2022-05-05 11:13:57 -06:00
Behdad Esfahbod 00cb8c629d [subset] Don't go into glyf table if it's empty 2022-05-05 11:13:57 -06:00
Behdad Esfahbod 4fe69bc413 [subset] Use del_range in _remove_invalid_gids 2022-05-05 11:13:57 -06:00
Behdad Esfahbod 2a42edccbe [subset] Cosmetic; use set bulk array population instead of for loop 2022-05-05 10:35:54 -06:00
Behdad Esfahbod 43938ecdc2 [subset] Remove outdated comment
I tried something like that. It was slower because of the allocations.
2022-05-04 16:59:28 -06:00
Behdad Esfahbod 50db78ba83 [subset] In cmap planning, remove a qsort() 2022-05-04 16:18:27 -06:00
Garret Rieger 7cb36e4222 [subset] Re-introduce size threshold in choosing unicode collection method.
Threshold is needed since the unicodes set might be an inverted set.
2022-05-04 21:22:26 +00:00
Garret Rieger 42c54eba83 [subset] Presize unicode to gid list to unicodes + glyphs size. 2022-05-04 20:21:43 +00:00
Garret Rieger 7c7c01d28c [subset] Remove switch to alternate unicode collection at large subset sizes.
Benchmarks show that the first path is always faster even at large subset sizes:

BM_subset_codepoints/subset_roboto/10_median                              +0.0324         +0.0325             0             0             0             0
BM_subset_codepoints/subset_roboto/64_median                              +0.0253         +0.0255             0             1             0             1
BM_subset_codepoints/subset_roboto/512_median                             +0.0126         +0.0128             1             1             1             1
BM_subset_codepoints/subset_roboto/4000_median                            +0.0500         +0.0491             6             7             6             7
BM_subset_codepoints/subset_amiri/10_median                               +0.0338         +0.0332             1             1             1             1
BM_subset_codepoints/subset_amiri/64_median                               +0.0238         +0.0234             1             1             1             1
BM_subset_codepoints/subset_amiri/512_median                              +0.0066         +0.0063             8             8             8             8
BM_subset_codepoints/subset_amiri/4000_median                             -0.0011         -0.0012            13            13            13            13
BM_subset_codepoints/subset_noto_nastaliq_urdu/10_median                  +0.0226         +0.0226             0             0             0             0
BM_subset_codepoints/subset_noto_nastaliq_urdu/64_median                  +0.0047         +0.0044            20            20            20            20
BM_subset_codepoints/subset_noto_nastaliq_urdu/512_median                 +0.0022         +0.0021           165           166           165           166
BM_subset_codepoints/subset_noto_nastaliq_urdu/1000_median                -0.0021         -0.0023           166           166           166           165
BM_subset_codepoints/subset_noto_devangari/10_median                      +0.0054         +0.0054             0             0             0             0
BM_subset_codepoints/subset_noto_devangari/64_median                      +0.0024         +0.0019             0             0             0             0
BM_subset_codepoints/subset_noto_devangari/512_median                     +0.0089         +0.0090             5             5             5             5
BM_subset_codepoints/subset_noto_devangari/1000_median                    -0.0028         -0.0019             5             5             5             5
BM_subset_codepoints/subset_mplus1p/10_median                             +0.0001         +0.0002             0             0             0             0
BM_subset_codepoints/subset_mplus1p/64_median                             +0.0073         +0.0075             1             1             1             1
BM_subset_codepoints/subset_mplus1p/512_median                            +0.0034         +0.0034             1             1             1             1
BM_subset_codepoints/subset_mplus1p/4096_median                           -0.1248         -0.1248             7             6             7             6
BM_subset_codepoints/subset_mplus1p/10000_median                          -0.0885         -0.0885            13            12            13            12
BM_subset_codepoints/subset_notocjk/10_median                             +0.0031         +0.0032             2             2             2             2
BM_subset_codepoints/subset_notocjk/64_median                             -0.0010         -0.0010             2             2             2             2
BM_subset_codepoints/subset_notocjk/512_median                            -0.0023         -0.0023             9             9             9             9
BM_subset_codepoints/subset_notocjk/4096_median                           -0.1725         -0.1726            28            23            28            23
BM_subset_codepoints/subset_notocjk/32768_median                          -0.0277         -0.0287           140           137           140           136
BM_subset_codepoints/subset_notocjk/100000_median                         -0.0929         -0.0926           162           147           162           147
2022-05-03 22:45:39 +00:00
Garret Rieger f0c04114bc [subset] Embed unicode to gid list vector in subset plan. 2022-05-03 22:02:59 +00:00
Garret Rieger 85ec5cbcef [subset] In _populate_unicodes_to_retain populate unicodes in order.
Allows the set insert to take advantage of page lookup cache.
2022-05-02 22:29:43 +00:00
Garret Rieger 088133d939 [subset] cache cp to new gid list in subset plan.
This avoids having to recompute the ordered list multiple times during cmap generation.
2022-05-02 21:29:16 +00:00
Garret Rieger b342adeb96 [reorg] Move GSUB into OT::Layout::GSUB namespace. 2022-03-23 18:05:24 -06:00
Khaled Hosny 8d1b000a3e 4.0.0 2022-03-01 21:27:32 +02:00
Khaled Hosny 6e466256e4 [doc] Typo 2022-03-01 12:01:18 +02:00
Garret Rieger f6071c16b0
[subset] Rename codepoint -> unicode in subset plan api 2022-02-28 23:45:40 +02:00
Khaled Hosny 1b5a2e0809 [doc] Various fixes to newly added documentation 2022-02-28 10:11:42 -07:00
Garret Rieger fc1548cf71 [subset] document return values. 2022-02-17 17:16:31 -08:00
Garret Rieger 27a6c895ba [subset] Fix memory leak in plan creation. 2022-02-11 16:19:43 -08:00
Garret Rieger 670ef070bd [subset] Change subset plan create to be or_fail. 2022-02-11 16:01:33 -08:00
Garret Rieger ae8d373bcf [subset] add subset plan reference, set/get user data functions. 2022-02-11 14:54:23 -08:00
Garret Rieger b65e48a786 [subset] Add subset plan to public API.
Add the ability to create a subset plan which an be used to gather info on things like glyph mappings in the final subset. The plan can then be passed on to perform the subsetting operation.
2022-02-11 14:37:21 -08:00
Behdad Esfahbod ae9fc7f533 Clean accelerators a bit more 2022-01-20 12:37:21 -07:00
Behdad Esfahbod ac1bb3e39e [machinery] Move accelerators to constructor/destructor 2022-01-20 12:10:05 -07:00
Behdad Esfahbod e062376ef1 [machinery] Make accelerator lazy-loader call Xinit/Xfini
Instead of init/fini. To isolate those functions. To be turned into
constructor/destructors, ideally one per commit (after some SFINAE
foo.)
2022-01-19 17:09:34 -07:00
Qunxin Liu 51655a078e [subset] COLR : only include glyphs after COLR closure 2021-12-06 13:29:21 -07:00
Qunxin Liu 903a6baece [subset] layout_features filtering fix
we should not use get_size (), which returns length * item_size
2021-11-25 11:24:41 -07:00
Behdad Esfahbod 394f772937 [map] Allow storing classes in the hashmap
Fixes https://github.com/harfbuzz/harfbuzz/issues/3293

The trick was to change the type of the invalid key/value to be non-class.
2021-11-19 11:49:23 -07:00
Qunxin Liu 8c583db9b5 [subset] COLRv1: update subset() method for new strutc ClipList and VarIdxMap
Also fix issues in struct PaintTransform definition
2021-10-23 11:22:39 -07:00
Qunxin Liu ca7b9daef0 [subset] subset MATH table 2021-09-22 18:08:30 -04:00
Garret Rieger 3844e58e14 [subset] remove helper functions for accessing subset input sets. 2021-08-30 11:16:51 -07:00
Garret Rieger 05204d7586 [subset] implement hb_subset_input_set (...).
Switch to storing the sets keyed by enum internally.
2021-08-27 10:36:36 -07:00
Behdad Esfahbod 1620698bd5 [subset-input] Minor format 2021-08-25 16:26:58 -06:00
Garret Rieger cd07070e41 [subset] Move plan unicodes and gids population to end of _populate_unicodes... 2021-08-25 14:42:00 -07:00
Garret Rieger 8f4f47df7c [subset] use inverted set for all unicodes.
Modify the code that handles input->unicodes to be safe with possibly inverted sets. Also adds --unicodes-= and --unicodes+= flags.
2021-08-25 13:34:05 -07:00
Behdad Esfahbod e9e6d66cd6 [subset] Minor internal parameter rename 2021-08-24 23:22:49 -06:00
Garret Rieger 59deb754b3 [subset] rename _collect_subset_layout to _collect_layout_indices.
Better describes what the function does.
2021-08-24 18:17:07 -06:00
Garret Rieger f2441a4b65 [subset] Remove retain all layout features flag.
Instead use inverted sets to handle requesting all features. Modifies feature collection in subset plan to intersect the set of requested features against the features in the font. This prevents iterating a fully filled feature tag set.
2021-08-24 18:17:07 -06:00
Garret Rieger 46d4a5e673 [subset] Convert subset plan to use a flags bit set. 2021-07-29 18:02:34 -07:00
Garret Rieger 3d534b146c [subset] convert subset input flags into bit flags.
Store the flags in a bit set. Updates the public api to work with the bit set directly.
2021-07-29 18:02:34 -07:00
Behdad Esfahbod 4762fcb415
Merge pull request #3067 from googlefonts/glyph_names
[subset] support option --glyph-names
2021-07-26 11:48:55 -07:00
Khaled Hosny acc7100a3f [docs] Improve subset documentation 2021-07-26 02:18:23 +02:00
Qunxin Liu 71b5509c19 [subset] support option --glyph-names 2021-07-23 13:57:39 -07:00
Garret Rieger 2b9cb29923 [subset] cleanup no_subset_tables on destruction. 2021-07-22 13:26:03 -07:00
Garret Rieger 1b6c1aa684 [subset] add hb-subset api to documentation generator.
Standardize subset_input parameter to be input.
2021-07-22 12:15:45 -07:00
Garret Rieger a6c6cda486 [subset] Add no subset tables and passthrough unrecognized tables to the subset api.
Matches fontTools options.
2021-07-22 12:12:37 -07:00
Garret Rieger 8bf5d4d4f7 [subset] Remove hb_subset_input_get/set_drop_hints. 2021-07-22 12:12:36 -07:00
Garret Rieger 9fb3a25633 [subset] Use hb_set_copy in subset input. 2021-07-22 12:12:36 -07:00
Garret Rieger edb57a8d9a Make subset input const in the subsetting operation. Don't modify the subset input's sets. 2021-07-22 12:11:43 -07:00
Garret Rieger 9aa0ecef3f [subset] de-duplicate the logic that finds unicodes corresponding to requested glyphs.
Move the logic into subset planning and then re-use the results in cmap and OS2 subsetting. Removes depedency on cmap from os2.
2021-07-14 17:31:47 -07:00
Behdad Esfahbod 2337f0d047 Internally use hb_malloc/.../hb_free instead of malloc/.../free
Redefining those stock names as macros was conflicting with gcc 10
headers.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3044
2021-07-08 10:54:09 -07:00
Qunxin Liu eee7b459ee [subset] add option --no-prune-unicode-ranges 2021-06-24 11:44:20 -07:00
Garret Rieger 26c80adb61 [subset] do colrv1 glyph closure before glyf composite closure. 2021-06-18 22:34:00 -07:00
Qunxin Liu d07f789ae3 [subset] support option "--notdef-outline" 2021-06-18 15:35:02 -07:00
Behdad Esfahbod bc33b87f5e [set] Use references, not pointers, in internal C++ API 2021-06-09 11:54:12 -06:00