Commit Graph

131 Commits

Author SHA1 Message Date
Behdad Esfahbod 7c74fc9631 [CFF] Remove unused member single_val 2023-02-19 14:43:31 -07:00
Behdad Esfahbod 64ed03c9be [cff1] Return no name for out-of-range glyph IDs
Was returning .notdef before.
2023-01-24 18:33:34 -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 df89b52130 cff1: Implement paint_glyph 2022-12-23 13:37:59 -07:00
Behdad Esfahbod a2681c37c1 [cff-subset] Simplify INDEX serialize() more 2022-12-01 16:15:23 -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 59c45f6deb Use hb_memcpy instead of memcpy consistently 2022-11-22 12:54:50 -07:00
Behdad Esfahbod 7a39464b18 [cff] Hide members of byte_str_ref_t 2022-11-21 09:48:54 -07:00
Behdad Esfahbod 86d1e22d4f [atomic-ptr] Rename get 2022-08-03 13:01:04 -06:00
Behdad Esfahbod b59e25f25e [cff] Try fixing Heap-buffer-overflow in CFF::Charset::collect_glyph_to_sid_map
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47790
2022-06-07 09:27:44 -06:00
Garret Rieger 98aaecd397 [subset] fix data race touching Crap() in cff subsetting. 2022-06-01 22:50:35 +01:00
Behdad Esfahbod 0919eaa6e8 [ot-font] Remove lock around cache
Not needed.
2022-05-26 05:02:50 -06:00
Behdad Esfahbod 3b28cff9c0 [cff1] Fix null dereference on memory alloc failure 2022-05-26 04:42:17 -06:00
Behdad Esfahbod a4d98b63ea [subset/cff1] Collect glyph-to-sid map to avoid an O(n^2) algorithm
Saves 13 for largest benchmark:

BM_subset/subset_glyphs/SourceHanSans-Regular_subset.otf/10000                    -0.1313         -0.1308            75            65            75            65

BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/4096                 -0.1009         -0.1004            54            48            54            48
BM_subset/subset_codepoints/SourceHanSans-Regular_subset.otf/10000                -0.1067         -0.1066            70            62            69            62
2022-05-16 17:38:18 -06:00
Behdad Esfahbod b87f48e948 [cff1] get_sid() move bounds check into each implementation 2022-05-16 17:38:18 -06:00
Behdad Esfahbod 3fbac0942d [cff1] Lazy-load & sort glyph names
Improves subset benchmarks by up to 70% for small CFF1 subset of
non-CID fonts!

BM_subset/subset_glyphs/SourceSansPro-Regular.otf/10                              -0.7067         -0.7071             1             0             1             0
BM_subset/subset_glyphs/SourceSansPro-Regular.otf/64                              -0.4817         -0.4824             1             0             1             0
BM_subset/subset_glyphs/SourceSansPro-Regular.otf/512                             -0.1948         -0.1956             2             2             2             2
BM_subset/subset_glyphs/SourceSansPro-Regular.otf/2000                            -0.0767         -0.0761             6             6             6             6
2022-05-16 16:36:28 -06:00
Behdad Esfahbod b46c7faa9c [cff] Check buf_len, not buf
Ouch!
2022-05-13 14:02:54 -06:00
Garret Rieger 19a8db8545 [subset] fix potential integer overflow in gname_t::cmp. 2022-05-13 13:55:39 -06:00
Behdad Esfahbod a2f132f1fc [cff] Check glyph-name's length, not arrayZ
As the latter can be non-null while still zero-length.
2022-05-13 13:49:39 -06:00
Behdad Esfahbod bff78e6515 [cff] Convert interpretation environment to use constructor 2022-05-10 16:50:38 -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 fe1d85a55a [cff] Remove custom byte_str_t impl 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 dd7b6e2c3f [draw] Remove EXPERIMENTAL_API tag 2022-02-13 13:21:14 -06:00
Behdad Esfahbod a8b7f18804 [cff] Initialize accelerator members 2022-01-21 07:38:33 -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
Behdad Esfahbod 4eb6e6ea16 [cff] Remove some more fini_deep() 2022-01-18 12:07:05 -07:00
Behdad Esfahbod f0a1892ff9 [serialize] Remove unnecessary pointer indirection 2021-07-28 17:36:22 -06:00
Garret Rieger deee24fbef [subset] Add missing FontName op code in top dict parsing.
Fix for #3058
2021-07-14 16:01:18 -06:00
Behdad Esfahbod c539afb08b [CFF] Use NNOffsetTo<> instead of OffsetTo<>
I'm pretty sure that's what is intended.
2021-03-31 13:28:25 -06:00
Garret Rieger d307c24abf [ENOMEM] check resize() return.
Fixes https://oss-fuzz.com/testcase-detail/5641892164009984.
2020-07-30 00:08:08 +04:30
Ebrahim Byagowi 2be859d289 minor, replace nullptr checks with implicit ones 2020-04-21 00:30:34 +04:30
Ebrahim Byagowi 2dda6dd744 minor, tweak spacing
turn 8 spaces to tab, add space before Null/Crap
2020-04-20 16:18:29 +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
ariza 0b29053864 removed unused code 2020-03-05 10:11:23 +03:30
ariza e8f010d793 removed unused code & data; rename 2020-03-05 10:11:23 +03:30
ariza c05458ec7f update cff & cff2 subsetters 2020-03-05 01:22:51 +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 8c652f72fc Minor, switch to https links where possible 2020-02-19 16:32:44 +03:30
Ebrahim Byagowi 25707e37e3 [cff] minor 2020-02-05 00:27:28 +03:30
ckitagawa 0d61926ca7 [subset] Keep head when no glyf table 2020-02-04 23:31:33 +03:30
ariza 2792fb8ba1 first rewrite of cff/cff2 _subset with _subset2 2020-02-04 21:20:43 +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 ec1fba1388 [ot-glyph] make hb_ot_glyph_decompose_funcs_t struct opaque 2020-01-14 15:55:23 +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 5cc09c462b [ot-glyph] Initial cff1 support 2020-01-10 14:25:07 +03:30