Garret Rieger
c0f3af91b8
[subset] speed up add_gid_and_children and adjust op limit.
...
Fix for fuzzer timeout: https://oss-fuzz.com/testcase-detail/5001604901240832 .
- Operation limit is per glyph, so 100,000 should still be far more than needed.
- Switches from for(...) to while(...) loop for iteration. for(...) calls it.end() which in this case triggers a complete iteration.
- Cache CompositeGlyph size in the iterator to avoid needing to recalculate it.
2021-08-12 14:50:42 -06:00
Garret Rieger
e39c3bde7b
[subset] fix bug in parsing glyf flags.
...
the bytes of the flag stream were being treated as signed integers instead of unsigned as specified in the spec.
2021-08-10 12:57:07 -06:00
Garret Rieger
46d4a5e673
[subset] Convert subset plan to use a flags bit set.
2021-07-29 18:02:34 -07:00
Garret Rieger
09474d8d7b
[subset] Fix fuzzer timeout in add_gid_and_children.
...
The composite glyph graph isn't check for max operations by sanitize so track an operations count during the graph traversal.
2021-07-27 13:30:06 -06:00
Behdad Esfahbod
2337f0d047
Internally use hb_malloc/.../hb_free instead of malloc/.../free
...
Redefining those stock names as macros was conflicting with gcc 10
headers.
Fixes https://github.com/harfbuzz/harfbuzz/issues/3044
2021-07-08 10:54:09 -07:00
Behdad Esfahbod
bb48bf52a4
Rename misc uses of "free"
...
In preparation for fixing https://github.com/harfbuzz/harfbuzz/issues/3044
2021-07-08 10:54:09 -07:00
Qunxin Liu
d07f789ae3
[subset] support option "--notdef-outline"
2021-06-18 15:35:02 -07:00
Garret Rieger
73ff04a324
[subset] add option to have the subsetter set the mac overlaps flag on each glyph.
2021-05-26 16:04:56 -06:00
justvanrossum
d01ebeae21
calculate extents based on scaled then rounded values; undo two of the earlier test result adjustments
2021-02-19 16:53:21 -07:00
Behdad Esfahbod
d7e2a51de2
[minor] Add unlikely() when checking for error
2021-02-11 10:55:03 -07:00
ebraminio
d03eecb4d6
[glyf] minor
...
style improvement
2020-08-11 16:40:40 +04:30
ebraminio
0c1561894a
[glyf] minor
2020-08-10 08:52:01 +04:30
Ebrahim Byagowi
f06d7331e8
[glyf] minor
2020-08-10 08:43:54 +04:30
Ebrahim Byagowi
db96c7f67a
[glyf] protect CompositeGlyph fields
...
Introduce methods instead
2020-08-10 08:43:54 +04:30
ebraminio
e5fe363aa5
[glyf] Minor, don't pass accelerator_t to points_aggregator_t
...
No need to pass it to aggregator itself
2020-08-10 07:39:36 +04:30
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