Garret Rieger
823f32a0e2
[subset] Fix potential out of bounds write setting overlap flag on composite glyphs.
2022-06-16 12:30:59 -06:00
Behdad Esfahbod
00cb8c629d
[subset] Don't go into glyf table if it's empty
2022-05-05 11:13:57 -06:00
Behdad Esfahbod
a02fb4a0dc
[glyf] Don't bail rendering glyf even if gvar failed
...
Part of https://github.com/harfbuzz/harfbuzz/issues/3506
2022-03-25 13:25:28 -06:00
Behdad Esfahbod
d2998faad3
Merge pull request #3410 from harfbuzz/boring-expansion
...
[Boring Expansion] >64k loca & hmtx tables
This does two things:
The num-glyphs reported by the face now is the maximum reported by the maxp and that deduced from the length of the loca table; I think this is the right thing to do anyway; According to OpenType such loca tables are invalid.
The interpretation hmtx tables that have excessive bytes at the end, again, invalid according to OpenType, has changed. Previously we were interpreting those excessive bytes as extra lsb values. Now we interpret them as extra advance values, the last of which is repeated for all missing glyphs. Again, these are tables that are invalid according to OpenType, and the advances are for glyph indices beyond maxp table's num-glyphs.
The combined effect is that the font can have shapes and advances for gid's beyond the maxp limit of 64k. In fact, maxp table becomes optional.
2022-02-16 14:37:09 -06:00
Behdad Esfahbod
c8fd8c1337
[ot-face] Use core tables
2022-02-15 18:13:44 -06:00
Ebrahim Byagowi
d4588204e5
[draw/glyf] Emit empty contours
...
This makes it actually match freetype behaviour even though rasterizer
should filter such contours specially for stroking.
See https://github.com/harfbuzz/harfbuzz/pull/3411#discussion_r802283827 for the context.
2022-02-13 23:50:53 +03:30
Behdad Esfahbod
0858463ac3
[draw/glyf] Don't skip empty contours of size 2
...
See:
https://github.com/harfbuzz/harfbuzz/pull/3411#discussion_r804988217
2022-02-13 13:21:15 -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
Behdad Esfahbod
e59da2871a
[glyf] Don't store face in accelerator
2022-02-01 16:32:39 -06: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
Garret Rieger
94ba4d5a44
[subset] Fix bound check when setting overlap bit.
...
length() shouldn't be used again as the end of instruction offset is already included in flags_offset.
2022-01-18 19:16:37 -08:00
Behdad Esfahbod
6ed22de127
[CONFIG] Fix HB_NO_VERTICAL build without HB_TINY
2021-12-08 10:40:40 -08:00
Behdad Esfahbod
53eebc7cd2
[CONFIG] Add HB_NO_VERTICAL
2021-12-08 08:34:20 -08:00
Garret Rieger
599143824c
[subset] Don't pad glyphs when using long loca.
2021-11-26 18:01:04 -07:00
Garret Rieger
a52c6df38a
[subset] Fix bug in composite operation counting.
...
Adding the result of add_gid_and_children to operation count over counts the number of operations.
2021-09-27 14:18:36 -06:00
Behdad Esfahbod
c852b86841
Rename HBGlyphID to HBGlyphID16
2021-09-19 16:30:12 -04:00
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