Commit Graph

206 Commits

Author SHA1 Message Date
Ebrahim Byagowi 758fda728b
[glyf] Don't accept gids higher than maxp's glyphs number
This specially becomes concerning on sub-components where a gvar table
that is sanitized using maxp's glyphs number overflows when a high gid
accepted here goes to it, maybe an additional check can be put there
also, this however feels to be enough.

Fixes https://crbug.com/oss-fuzz/20944
2020-02-28 23:19:06 +03:30
Evgeniy Reizner f44e1dc07d Fix spelling. 2020-02-27 13:33:56 +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 4cdaa9d1f4 [glyf] Simplify contour end logic
So no need for infinite loop here
2020-02-26 16:29:14 +03:30
Ebrahim Byagowi 073d4954e0 [draw] Port glyf path extract to draw_helper_t 2020-02-26 15:40:40 +03:30
Ebrahim Byagowi b59eb54f70 [glyf] Refactor, move get_points inside Glyph 2020-02-25 12:56:32 +03:30
Ebrahim Byagowi da37880e17 [draw] Add a private bit field instead null-checking quad-to callback
This doesn't imply the the design is good or stable just is better
to not fail due to null quad-to callback so as our quad-cubic curves
translation is currently table limited which can be revisited anytime.
2020-02-20 19:04:20 +03:30
Qunxin Liu 493e40ff78 [subset] add one empty byte to glyf table
if it's going to end up empty after subsetting
This will make OTS happy and match what fontTools is doing now.
2020-02-19 12:24:38 +03:30
Ebrahim Byagowi a7dec0cb51 [glyf] Tweak path_builder_t 2020-02-18 16:22:12 +03:30
Ebrahim Byagowi d52ea2a42c [glyf] minor 2020-02-18 15:46:02 +03:30
Ebrahim Byagowi 3b0c58f811 [glyf] minor, use private font coords to simplify 2020-02-18 15:43:25 +03:30
Ebrahim Byagowi dcd2729e71 [glyf] Move contour_bounds_t into scope it is actually used 2020-02-18 15:38:57 +03:30
Ebrahim Byagowi 8bb47fa17d [glyf] minor, spacing 2020-02-18 15:06:58 +03:30
Ebrahim Byagowi 21a5fe4f09 [glyf] Make returning phantoms to not require another vector 2020-02-18 14:38:55 +03:30
Ebrahim Byagowi 5c03fbe7e0 [glyf] do a phantom only iteration when possible 2020-02-18 14:08:37 +03:30
Ebrahim Byagowi 11f3fca01d [glyf/gvar] Remove need of passing end points vector around 2020-02-18 14:08:37 +03:30
Ebrahim Byagowi 0f2c2d989b [glyf] Push consumer machine one more level further 2020-02-18 14:08:37 +03:30
Ebrahim Byagowi 11f5f7c59c [glyf] Adopt a state machine like style for the path builder
Toward making glyf path reader alloc free at least on gvar absence.
2020-02-18 00:49:09 +03:30
Ebrahim Byagowi 60f8f384f9 [glyf] Switch to ttf-parser's glyf to path algorithm
It consumes each point at a time and doesn't need to know contour size before hand
2020-02-18 00:49:09 +03:30
ariza 9c6499d9f4 rewrite read_points() to take lambda & consts args
replacing awkward x/y_setter_t structs
2020-02-16 00:56:31 -08:00
Ebrahim Byagowi 3a98c7fae1 [glyf] Skip empty contours
As https://savannah.nongnu.org/bugs/index.php?57701
2020-02-06 11:35:48 +03:30
Ebrahim Byagowi 7f9b2228a6 [glyf] minor
Improve using https://developer.blender.org/diffusion/B/browse/master/source/blender/blenlib/intern/freetypefont.c$572
2020-02-04 23:05:49 +03:30
Qunxin Liu 0216a96b0f [subset] Fix simple glyph trim_padding in glyf table
Detail: when numOfContours = 1 and flag = 0x31
xCoordinates and yCoordinates would be empty
2020-01-31 10:49:44 -08:00
Ebrahim Byagowi d106900bfd [draw][glyf] Implement quadratic to cubic call translation 2020-01-28 15:27:27 +03:30
Ebrahim Byagowi 74fdcdcac8 [draw] Rename conic_to to quadratic_to 2020-01-28 13:45:22 +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 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 42f4f1ea50 [ot-glyph] Add tests for hb_ot_glyph_decompose 2020-01-11 00:33:31 +03:30
Ebrahim Byagowi 6118523502 [ot-glyph] move glyph decompose logic of glyf to itself
One less vector allocation yet isn't zero alloc yet
which needs more work.
2020-01-10 21:08:26 +03:30
Ebrahim Byagowi fddf79fc37 [glyf] minor 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 b8b3ff1a02 [glyph] Don't copy, write directly into result 2020-01-10 14:25:07 +03:30
Ebrahim Byagowi f883c31cce Implement glyph outline path API
Got help from https://github.com/opentypejs/opentype.js/blob/4e0bb99/src/tables/glyf.js#L222
2020-01-10 14:25:06 +03:30
Ebrahim Byagowi 57b1534198
[glyf] minor, fix unlikely statements 2020-01-06 12:46:50 +03:30
Ebrahim Byagowi d67ba649a3 Rename hb_array_t::in_range to hb_array_t::check_range 2019-12-06 02:27:23 +00:00
Ebrahim Byagowi 3958f6fb23 Add in_range in hb_bytes_t to merge range_checker_t with it 2019-10-29 23:16:05 +03:30
Ebrahim Byagowi aa3831e295 [glyf] Use contour_bounds_t::empty to simplify get_extents logic 2019-10-29 22:34:14 +03:30
Ebrahim Byagowi d59ae5836d [glyf] Refactor contour_bounds_t use to make its fields protected 2019-10-29 22:34:14 +03:30
Ebrahim Byagowi 0efbda7a40 Remove contour_point_t so we won't need to zero its unused var 2019-10-29 21:03:26 +03:30
Ebrahim Byagowi b0b8551afc [glyf] Use range_checker_t in composite_iter_t 2019-10-13 07:17:03 +03:30
Ebrahim Byagowi 06e35ce052 [glyf] minor 2019-10-13 07:17:03 +03:30
Ebrahim Byagowi d13bb4bd94 [glyf] other cleanups 2019-10-13 07:17:03 +03:30
Ebrahim Byagowi e7aa8c5d22 [glyf] Introduce glyf::Glyph, a hb_bytes_t/GlyphHeader pair 2019-10-13 07:17:03 +03:30
Ebrahim Byagowi 546ffc9faf [glyf] minor 2019-10-13 07:17:03 +03:30
Ebrahim Byagowi 4299ea266e [glyf] Move get_contour_points to GlyphHeader 2019-10-13 07:17:03 +03:30
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 6961766db2 [glyf] fix scaling direction 2019-10-08 16:26:48 +03:30
Ebrahim Byagowi b2628f1a3e [glyf] Move glyph bytes drop hints logic to GlyphHeader 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi 1fb9c3b646 [glyf] Implement depth limit for add_gid_and_children 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi be0eddd418 [glyf] Move add_gid_and_children to glyf table 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi ad86806dcb [glyf] Move subset related methods inside GlyphHeader 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi 7839e23558 [glyf] minor 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi cbefbb2439 [glyf] Move padding removal logic to GlyphHeader 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi 1ab8f9aa7a [glyf] minor 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi 13fb5612ad [glyf] Aggregate get_offsets uses 2019-10-08 15:40:29 +03:30
Ebrahim Byagowi d73cdcf361 [ot-font] Apply font scaling before turning to int 2019-10-08 11:11:18 +03:30
Ebrahim Byagowi f2339964b7 [glyf] minor, remove GlyphHeader::simple_* helpers 2019-10-06 16:58:38 +03:30
Ebrahim Byagowi 2d7ca6a76a [glyf] Move get_instruction_length inside GlyphHeader struct 2019-10-06 16:58:38 +03:30
Ebrahim Byagowi 50aef4d7f8 [glyf] cleanup 2019-10-06 16:58:38 +03:30
Ebrahim Byagowi ee3f4630d7 [glyf] Remove get_composite_iter and refactor bytes_for_glyph for shape uses 2019-10-06 16:58:38 +03:30
Ebrahim Byagowi 8378ab96e2
[glyf] Rewrite composite iterator to new iterators convention 2019-10-06 13:49:45 +03:30
Ebrahim Byagowi 5752863640 [glyf][gvar] Make HB_NO_VAR buildable 2019-10-06 08:59:12 +03:30
Ebrahim Byagowi b3afa81644 [glyf] Use common convention of other tables access, format 2019-10-06 08:59:12 +03:30
Ebrahim Byagowi 88bd342c0f [glyf] minor 2019-10-06 08:59:12 +03:30
Michiharu Ariza b9ff43c162 Implement gvar table and variable glyf
Split from Ariza's "[subset] TrueType/CFF2 variable font" work on #1594
2019-10-06 08:58:40 +03:30
Ebrahim Byagowi cbc0646a6c Minor, normalize for each calls 2019-09-24 12:09:20 +03:30
Ebrahim Byagowi 6e42a418c8 Minor, turn more of hb_apply to for each 2019-09-21 17:52:01 +04:30
Ebrahim Byagowi d512087e4d Rename GlyphID to HBGlyphID
Avoid collision with macOS's ATSUnicodeTypes.h GlyphID
2019-09-14 11:55:53 +04:30
Ebrahim Byagowi dce42cef2b [glyf] Move GlyphHeader::from_bytes to hb_bytes_t, introduce .as<T> () 2019-08-27 17:38:09 +04:30
Ebrahim Byagowi 6e82d59b4f
[glyf] Revert the way indexToLocFormat is set 2019-08-27 12:33:42 +04:30
Ebrahim Byagowi 2f8e823331
[glyf] minor 2019-08-25 12:37:40 +04:30
Ebrahim Byagowi 07e467a30e [glyf] Move GlyphHeader size checking to a static method 2019-08-25 01:10:37 +04:30
Ebrahim Byagowi 139d14dc89 [glyf] Move GlyphHeader related logics to its, making its fields protected 2019-08-24 17:50:25 +04:30
Ebrahim Byagowi d57819cbdb [glyf] format source 2019-08-24 17:00:54 +04:30
Ebrahim Byagowi 2aef3013f3 [subset] Consider instruction length place itself
Now fixes https://crbug.com/oss-fuzz/16639 completely
2019-08-24 16:11:21 +04:30
Ebrahim Byagowi 385e436692 Minor, fix gcc maybe-uninitialized complain
I guess all of its field will be initialized anyway here but lets make it more defensive
2019-06-07 10:49:57 -07:00
rsheeter 49879adbfc [subset] Correct calculation of max offset; fixes bug where loca would erroneously be short 2019-05-31 19:43:30 -07:00
Rod Sheeter 1197bef26c [subset] Per code review, use hb_array to avoid duplicated type name 2019-05-24 10:52:49 -07:00
Rod Sheeter 13b3cd307e [subset] Address @behdad review feedback 2019-05-24 10:10:12 -07:00
Rod Sheeter 58ce477ac1 [subset] Report failure more often 2019-05-21 20:22:40 -07:00
Rod Sheeter 14e3b0cf41 [subset] Code review feedback 2019-05-21 20:09:36 -07:00
Rod Sheeter 349d692b0e [subset] Iter in and out for loca 2019-05-21 12:38:53 -07:00
Rod Sheeter 95445d79be [subset] Write loca using more idiomatic harfbuzzese 2019-05-21 11:14:31 -07:00
Rod Sheeter 3a43603ece [subset] Fix memory leak caused by failure to cleanup glyf accelerator 2019-05-20 21:25:42 -07:00
Rod Sheeter 5cedda5e4a [subset] Fix null pointer deref, tidy up a bit 2019-05-20 21:25:42 -07:00
Rod Sheeter 8a84b540c7 [subset] Tests passing using iterator based glyf 2019-05-20 21:25:42 -07:00
rsheeter 9d09ac13a1 [subset] Tweak hint stripping 2019-05-20 21:25:42 -07:00
rsheeter 3a4c928fcf [subset] Fix glyf tests except hint stripping & local test asan 2019-05-20 21:25:42 -07:00
Rod Sheeter b77dde8f13 [subset] Destroy blob 2019-05-20 21:25:35 -07:00
Rod Sheeter 14db6512f8 [subset] Correct flipped use short computation 2019-05-20 21:25:29 -07:00
Rod Sheeter ab3fe5de2b [subset] Glyf by iter now runs but fails tests 2019-05-20 21:25:16 -07:00
rsheeter 0d7fef2d50 [subset] Dinner time, checkpoint 2019-05-20 21:25:11 -07:00
rsheeter 240bc86e3a [subset] Remove subset-glyf; want everything to point to new iter-based edition. Some of the code will resurface as impl builds out. 2019-05-20 21:25:05 -07:00
rsheeter 02d4d4f3e6 [subset] Starting to sketch glyf as iter 2019-05-20 21:24:59 -07:00
Behdad Esfahbod 750d5af48e Make compiler happy with -Og 2019-05-08 12:10:00 -07:00
Behdad Esfahbod 41248cce0e Remove MIN/MAX in favor of hb_min/hb_max 2019-05-07 20:54:31 -07:00
Behdad Esfahbod b986c6a321 [C++11] Remove IntType::set() in favor of operator= 2019-03-29 20:21:21 -07:00