Commit Graph

66 Commits

Author SHA1 Message Date
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
Matthias Clasen df89b52130 cff1: Implement paint_glyph 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 392463bff5 [cff] Fix extent rounding
I broke it in b0abbfd868.
2022-12-22 08:34:01 -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 bff78e6515 [cff] Convert interpretation environment to use constructor 2022-05-10 16:50:38 -06:00
Behdad Esfahbod 54544f2a57 [cff] Convert cff1_extents_param_t to use constructor 2022-05-10 16:17:20 -06:00
Behdad Esfahbod 377befd0c7 [cff] Convert get_seac_param_t to use constructor 2022-05-10 16:17:20 -06:00
Behdad Esfahbod 8aa54aaca2 [cff] Replace byte_str_t with hb_bytes_t use 2022-05-09 17:34:58 -06:00
Behdad Esfahbod 370bec938b [draw] Rename internal draw_session_t to hb_draw_session_t 2022-02-13 13:21:14 -06:00
Behdad Esfahbod c681331c3f [draw] Rename internal draw_helper_t to draw_session_t 2022-02-13 13:21:14 -06:00
Behdad Esfahbod a9dd9f0bae [draw] Add public move_to/line_to/... API that take a draw-state 2022-02-13 13:21:14 -06:00
Behdad Esfahbod 35190dc961 [draw] Convert API to float instead of hb_position_t 2022-02-13 13:21:14 -06:00
Behdad Esfahbod dd7b6e2c3f [draw] Remove EXPERIMENTAL_API tag 2022-02-13 13:21:14 -06:00
justvanrossum 79e4f436e7 Apply rounding correctly when calculating glyph extents for CFF and CFF2; adjust expected test results 2021-02-19 16:53:21 -07:00
Ebrahim Byagowi 0133cb55e2 Minor, use hb_sorted_array::bsearch where possible 2020-04-19 23:18:36 +04:30
ariza 22f7c61acf implement SID to glyph ID mapping with predefined Charset
Also fixes oss-fuzz 21769
2020-04-18 15:42:30 +04:30
Ebrahim Byagowi 755a77d660 Move outline draw API behind HB_EXPERIMENTAL_API directive 2020-03-13 08:25:53 +03:30
Ebrahim Byagowi 05a25c1a5b
[cff] minor, remove unused fields 2020-02-26 19:35:27 +03:30
Ebrahim Byagowi 9fe0dc3464 [draw] Pass draw_helper_t itself around instead recreating it
Specially helpful if we want to change the design
2020-02-26 17:40:46 +03:30
Ebrahim Byagowi 0ebf3a4e62 [draw] Move common CFF path building logic to draw_helper_t 2020-02-26 15:15:22 +03:30
Ebrahim Byagowi 2f97aa65e5 [cff] Make sure previous is ended on processing a seac 2020-02-25 18:07:44 +03:30
Ebrahim Byagowi acc2d4738e [cff] Make path extract easier to read and more defensive 2020-02-25 18:05:48 +03:30
Ebrahim Byagowi 0cf050a7b1 [draw] Merge consequent move-to commands of CFF/CFF2 2020-02-23 23:23:50 +03:30
Ebrahim Byagowi 86bd5a0ba1 [draw] End CFF paths with a line-to
Issue a line-to command when start and end point of a path isn't same, matches freetype also.
2020-02-23 23:23:50 +03:30
Ebrahim Byagowi ac81e94016 Rename hb_outline_decompose to hb_font_draw_glyph and hb_outline_decompose_funcs_t to hb_draw_funcs_t 2020-01-28 13:24:49 +03:30
Ebrahim Byagowi 981125aa2a Rename hb_ot_glyph_* to hb_outline_* 2020-01-27 23:43:54 +03:30
Ebrahim Byagowi 02f324c949 [ot-glyph] remove open callback
Apparently it wasn't requested actually and can be detected easily
as paths are opened usually when move command is issued anyway.
2020-01-23 15:12:15 +03:30
Ebrahim Byagowi 684ff3e0cd [ot-glyph] noop->nil, fix close path 2020-01-23 14:48:59 +03:30
Ebrahim Byagowi 79fed9a1e4 [ot-glyph] Add open/close callbacks 2020-01-14 17:34:59 +03:30
Ebrahim Byagowi ec1fba1388 [ot-glyph] make hb_ot_glyph_decompose_funcs_t struct opaque 2020-01-14 15:55:23 +03:30
Ebrahim Byagowi 06a1fcb3b4 [ot-glyphs] fix the tests 2020-01-10 23:12:30 +03:30
Ebrahim Byagowi 084a8182fb [ot-glyphs] Move CFF glyph decompose logic to their tables
Thus making path decompose zero alloc on CFF/CFF2
2020-01-10 22:56:43 +03:30
Ebrahim Byagowi af08f388ab [ot-glyph] Support CFF1's seac 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi 04ac7fb1c9 [ot-glyph] Add cff2 support 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi 5cc09c462b [ot-glyph] Initial cff1 support 2020-01-10 14:25:07 +03:30
blueshade7 ff87465b40 add get_glyph_from_name & test. use hb_string_array 2019-11-26 18:34:06 +00:00
blueshade7 7b49042ef4 add cff1::get_glyph_name 2019-11-26 18:34:06 +00:00
jfkthame dd8a846037
Use proper y-scale factor for height value 2019-10-29 09:20:41 +00:00
Ebrahim Byagowi dc45f22521 [ot-metrics] Don't use mixed scaled and not scaled for generating extents 2019-10-08 23:27:39 +03:30
Ebrahim Byagowi d73cdcf361 [ot-font] Apply font scaling before turning to int 2019-10-08 11:11:18 +03:30
Ebrahim Byagowi 0558413f27 Minor, tweak spaces 2019-10-01 13:50:11 +03:30
Behdad Esfahbod 7ca54811f4 [amalgam] Fix CFF
Part of https://github.com/harfbuzz/harfbuzz/issues/1809
2019-07-02 16:00:58 -07:00
Behdad Esfahbod 737436d3f8 Streamline HB_NO_CFF 2019-06-18 13:07:44 -07:00
Behdad Esfahbod 7f6fca4ef7 Force-disable CFF code under disabling conditions
Subsetter size goes down from 190kb to 119kb.  Main library about 7kb.

Part of https://github.com/harfbuzz/harfbuzz/issues/1652
2019-05-12 10:29:47 -07:00