Commit Graph

51 Commits

Author SHA1 Message Date
Behdad Esfahbod 65d3db375c [subset-plan] Simplify user_axes_location allocation 2023-01-11 12:36:54 -07:00
Behdad Esfahbod 2eacc37e08 [vector] Add internal API for exact-size allocation
Use it from a couple of places.
2022-12-31 12:30:31 -07:00
Behdad Esfahbod f3985d9482 [paint] Fix drawing non-color glyphs 2022-12-23 13:37:59 -07:00
Matthias Clasen c221933977 [paint] Preserve foreground information 2022-12-23 13:37:59 -07:00
Matthias Clasen 6387004cad [paint] Simplify api
Drop the hb_paint_context_t struct from the API, and
only pass the font where we need it.
2022-12-23 13:37:59 -07:00
Matthias Clasen 71bd5a0dfc [paint] Resolve colors
We don't need to pass the index/alpha pairs to
client callbacks, and can just resolve the colors
internally.

Update test results.
2022-12-23 13:37:59 -07:00
Matthias Clasen 9be01b6bff [paint] Pass hb_paint_context_t along
Replace the font argument with a hb_paint_context_t
that carries the font, the palette index and the
foreground color.

The hb_font_paint_glyph() api now takes the palette
index and the foreground color as extra arguments.

Update all callers and regenerate test results.
2022-12-23 13:37:59 -07:00
Matthias Clasen 97224f3b63 [paint] Pass font to all callbacks
This will lead to easier implementations.

At the same time, we change the push_clip_glyph
callback to use the font as-is, no unscaling needed.

Update all callers and expected test results.
2022-12-23 13:37:59 -07:00
Matthias Clasen 686e627bdf [paint] Set up root transform in one place
Instead of spreading this in all the tables,
make hb_paint_funcs_t provide a push/pop_root_transform
that does all the setup.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 601a596ca0 [paint] Fix include path 2022-12-23 13:37:59 -07:00
Matthias Clasen 2edd771cf5 glyf: Implement paint_glyph 2022-12-23 13:37:59 -07:00
Behdad Esfahbod b0abbfd868 [font] Centralize glyph-extents scaling
Needs more testing...

Some rounding was removed, namely in cff1 and cff2.
2022-12-22 07:32:15 -07:00
Behdad Esfahbod aa7f5e3742 [subset] Conditionalize call to hb_font_set_variations 2022-12-04 15:33:18 -07:00
Garret Rieger 81640fdffe [subset] fix leaked font in glyf::subset(...) 2022-11-23 13:41:52 -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 ba0d28ea36 [glyf] Fix font error check 2022-11-22 15:01:48 -07:00
Behdad Esfahbod b567ce51d3 [subset] Don't trim glyf's again if preprocessed
Speeds up M1/10000 benchmark by 30%!
2022-11-22 10:55:08 -07:00
Garret Rieger 8f1bf23cc9 [subset] optimize glyf subsetting w/ retain gids.
When retain gids is enabled the subset plan may require the output of many empty glyphs. This change optimizes the glyf subsetting code when the number of retained glyphs << number of output glyphs. Unnessecary lookups to the glyph map are reduced by iterating through the glyph map instead of the output glyph set.
2022-09-29 15:44:49 -06:00
Qunxin Liu e94fe2adf3 [instance] minor optimizations to glyf instancing 2022-09-29 12:14:43 -06:00
Qunxin Liu b90ce34a25 [instance] fix for non-empty .notdef glyph metrics update
we need pass in source glyph's outline data to calculate boundaries, and
then drop the outline data if notdef-outline is specified.

Also disable shifting points for instancing in get_points () API
2022-09-29 12:14:43 -06:00
Qunxin Liu 8f84c58a34 [instance] don't copy phantom points from component
No need to consider USE_MY_METRICS for instancing
2022-09-01 09:44:28 -07:00
Qunxin Liu ac0e22fa8e [instance] update glyf/hmtx/vmtx tables 2022-08-22 09:29:37 -07:00
Behdad Esfahbod b0cb9a1a63 Make get_leading_bearing return bool
Fixes https://github.com/harfbuzz/harfbuzz/issues/3496

Part of supporting >64k glyphs correctly.
2022-07-03 15:32:32 -06:00
Behdad Esfahbod 115e1a03e7 [glyf] Relax condition for matching number of coords 2022-07-03 14:45:12 -06:00
Behdad Esfahbod 800760c5bd [glyf] Rename get_extents functions for clarity 2022-07-03 13:21:06 -06:00
Behdad Esfahbod ab327f93b7 [glyf] Fix another bug with scaling
Of advances this time.

That codepath is never exercised though, if font has HVAR table.
2022-07-03 13:17:03 -06:00
Behdad Esfahbod f46ddeba48 [hmtx/glyf] Rename side-bearing functions for clarity 2022-07-03 13:12:49 -06:00
Behdad Esfahbod b2d60cbd6e [glyf] Rename advance functions for clarity 2022-07-03 12:56:48 -06:00
Behdad Esfahbod 35c00c1216 [hmtx] Rename advance functions for clarity 2022-07-03 12:54:17 -06:00
Behdad Esfahbod 6b82d4faa1 [glyf] Make an optional argument non-optional 2022-07-03 12:45:27 -06:00
Behdad Esfahbod 3ef590808f [glyf] Internal flip a variable 2022-07-03 12:44:24 -06:00
Behdad Esfahbod 78b4f39821 [glyf] Fix confusion between scaled vs unscaled lsb
Was always broken.
2022-07-03 12:39:55 -06:00
Behdad Esfahbod 6665881c7d [glyf] Change side-bearing rounding 2022-07-03 12:39:55 -06:00
Behdad Esfahbod 34e3f561b5 [glyf] Fix a bug I introduced recently
Pass gid to Glyph in trim_padding codepath.
2022-06-27 12:39:35 -06:00
Behdad Esfahbod 19cbfb9ce9 [glyf] Relax a condition that font num_coords be equal to gvar's
gvar itself still checks the same.
2022-06-27 12:32:18 -06:00
Behdad Esfahbod 8d242aaa8b [glyf] Rewrite a loop harmlessly
I hope...
2022-06-26 16:36:08 -06:00
Behdad Esfahbod 11d2670676 [glyf] Split off glyf-helpers.hh 2022-06-25 18:19:09 -06:00
Behdad Esfahbod 499c637922 [glyf] Split off path-builder.hh 2022-06-25 18:07:49 -06:00
Behdad Esfahbod 81315a3016 [glyf] Namespace implementation in glyf_impl
Part of https://github.com/harfbuzz/harfbuzz/issues/3677
2022-06-25 17:50:44 -06:00
Behdad Esfahbod ef250eea7e [glyf] Move a few structs out of Glyph{} 2022-06-25 17:37:59 -06:00
Behdad Esfahbod ae75f066b5 [glyf] Split SubsetGlyph 2022-06-25 17:12:10 -06:00
Behdad Esfahbod 0031069f47 [glyf] Fix includes 2022-06-25 17:05:18 -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 ba1c9eda38 [glyf] Use a range for loop 2022-06-25 16:51:33 -06:00
Behdad Esfahbod e4f2bc9342 [glyf] Split Glyph.hh 2022-06-25 16:47:06 -06:00
Behdad Esfahbod 3f9c6bf3fc [glyf] Minor in _write_loca() 2022-06-25 14:46:26 -06:00
Behdad Esfahbod 852985da0f [glyf] Split loca.hh 2022-06-25 14:41:51 -06:00