Commit Graph

169 Commits

Author SHA1 Message Date
ebraminio 2b9927f7e1
[glyf] minor
No need to pass glyph_for_gid as a lambda now that we are passing the accelerator itself
2020-08-10 06:26:21 +04:30
Ebrahim Byagowi ffe06c8f04 [glyf] Guard all the public APIs against null pool runs
Fixes https://crbug.com/oss-fuzz/24575 and https://crbug.com/oss-fuzz/24737
2020-08-08 13:43:49 +04:30
Ebrahim Byagowi 1f519c2567
[glyf] Optimize retrieval of hmtx/vmtx/gvar
This should make glyf/gvar faster as makes it to invoke less table wrapper atomic operations and things.

$ meson build -Dexperimental_api=true --buildtype=release && ninja -Cbuild && build/perf/perf "--benchmark_filter=glyf.*- ot -"

Before:
extents/glyf - ot - SourceSerifVariable         46091 ns      46036 ns      16173
extents/glyf/vf - ot - SourceSerifVariable    4160142 ns    4154913 ns        174
extents/glyf - ot - Comfortaa                   25754 ns      25726 ns      27030
extents/glyf/vf - ot - Comfortaa              2627804 ns    2624596 ns        265
extents/glyf - ot - Roboto                      33556 ns      33540 ns      18513
draw/glyf - ot - SourceSerifVariable          2716848 ns    2715438 ns        256
draw/glyf/vf - ot - SourceSerifVariable       4602379 ns    4598907 ns        151
draw/glyf - ot - Comfortaa                    1659364 ns    1658142 ns        417
draw/glyf/vf - ot - Comfortaa                 2845100 ns    2842549 ns        246
draw/glyf - ot - Roboto                       1571509 ns    1570060 ns        442

After:
extents/glyf - ot - SourceSerifVariable         34738 ns      34713 ns      21332
extents/glyf/vf - ot - SourceSerifVariable    3700510 ns    3698104 ns        187
extents/glyf - ot - Comfortaa                   21604 ns      21595 ns      31907
extents/glyf/vf - ot - Comfortaa              2324787 ns    2323440 ns        296
extents/glyf - ot - Roboto                      31259 ns      31246 ns      21814
draw/glyf - ot - SourceSerifVariable          2689230 ns    2687589 ns        260
draw/glyf/vf - ot - SourceSerifVariable       4625135 ns    4622036 ns        131
draw/glyf - ot - Comfortaa                    1690336 ns    1689454 ns        402
draw/glyf/vf - ot - Comfortaa                 2898748 ns    2897074 ns        241
draw/glyf - ot - Roboto                       1570911 ns    1570138 ns        440
2020-08-07 01:21:19 +04:30
Ebrahim Byagowi 55c41f219f
[glyf] Clamp advance value result
Fixes a sanitizer complain https://circleci.com/gh/harfbuzz/harfbuzz/150247 revealed by 02d1ec1
2020-08-06 23:37:43 +04:30
Ebrahim Byagowi ec17b62457
[var] Apply variations on empty glyphs
It was ignoring empty glyphs for no good reason, this fixes it.

Fixes #2618
2020-08-06 20:16:11 +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
Behdad Esfahbod 6f6e78a26e Fix float-to-double warnings
./hb-ot-glyf-table.hh:978:37: warning: implicit conversion increases floating-point precision: 'float' to 'double' [-Wdouble-promotion]
2020-04-18 16:12:18 -07:00
Behdad Esfahbod c37100e7d9 Clean up math.h and float.h includes 2020-04-18 16:02:55 -07:00
Ebrahim Byagowi 755a77d660 Move outline draw API behind HB_EXPERIMENTAL_API directive 2020-03-13 08:25:53 +03:30
Ebrahim Byagowi b7617f6b3c [glyf] Update to latests of ttf-parser 2020-03-05 15:08:06 +03:30
Ebrahim Byagowi 9004848560 [gvar] Make sure font's num_coords matches with gvar.axisCount 2020-03-04 12:43:26 +03:30
Ebrahim Byagowi 60262e4ca9 [var] Build end-points array on gvar itself 2020-02-29 22:57:59 +03:30
Ebrahim Byagowi 44169f3396
[draw] Fix invalid rendering of some glyph on Estedad-VF
Basically reverts 11f3fca so I can do the same tested and better later

Fixes #2215
2020-02-29 16:04:03 +03:30
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