Commit Graph

11934 Commits

Author SHA1 Message Date
Behdad Esfahbod b9314400ec [colr] Hook up color-line variation 2022-12-23 13:37:59 -07:00
Matthias Clasen a935e4b0c2 [paint] Add synthetic slant to root transform 2022-12-23 13:37:59 -07:00
Behdad Esfahbod edf2738263 [colr] Try fixing bot build
I don't get the error. Let's see.

../../src/harfbuzz/src/hb-ot-color-colr-table.hh:574:66: error: incomplete definition of type 'OT::NoVariable<OT::ColorLine<OT::NoVariable>>'
2022-12-23 13:37:59 -07:00
Matthias Clasen 686e627bdf [paint] Set up root transform in one place
Instead of spreading this in all the tables,
make hb_paint_funcs_t provide a push/pop_root_transform
that does all the setup.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod c6dd56cc64 [colr] Simplify color-stop handling 2022-12-23 13:37:59 -07:00
Matthias Clasen 485ba9beb3 [paint] Spell out rectangle in the API
No need to abbreviate this.
2022-12-23 13:37:59 -07:00
Matthias Clasen 37f3f0fcc2 [paint] Change the image callback
Instead of passing the glyph ID, give
it the image blob, a mimetype, and
glyph extents (if available).

Update all callers.
2022-12-23 13:37:59 -07:00
Matthias Clasen ea48d6c292 Move hb_glyph_extents_t definition 2022-12-23 13:37:59 -07:00
Behdad Esfahbod b722039c48 [colr] Simplify 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 452cfb9599 [colr] Simplify loop using iterators
Or complexify?!
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 601a596ca0 [paint] Fix include path 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 8a9069d55f [colr] Fix radial gradient
Broke it when adding variations.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod e799c33bb5 [paint] Fix function prototype 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 1953d26a8a [colr] Limit recursion depth 2022-12-23 13:37:59 -07:00
Matthias Clasen 378bbeea01 Add more docs 2022-12-23 13:37:59 -07:00
Matthias Clasen 6079173a52 Try paint_glyph for more tables
If the COLR table does not paint the glyph,
try SVG, CBDT and sbix too, before giving up
on color.
2022-12-23 13:37:59 -07:00
Matthias Clasen e6c5a616aa SVG Implement paint-glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 23c60fd9b2 sbix: Implement paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 7996ae4c3d CBDT: Implement paint glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 82e23f322a paint: Add a paint-image callback
This will be used for image blobs like pngs and svgs.

FIXME: nail down and document sizing.
2022-12-23 13:37:59 -07:00
Matthias Clasen 56b02b6599 Update the docs
Mention that the color index will always be 0xFFFF
when using hb_paint API with fonts that don't have
color palettes.

And add an outline about which kinds of glyphs
require which callbacks.
2022-12-23 13:37:59 -07:00
Matthias Clasen 9461ab7088 Try paint_glyph for more tables
If the COLR table can't paint the glyph,
try glyf, cff1 and cff2 too.
2022-12-23 13:37:59 -07:00
Matthias Clasen 3e39dd492b cff2: Implement paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen df89b52130 cff1: Implement paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 2edd771cf5 glyf: Implement paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 0b33b35eb0 COLRv1: Return bool from paint_glyph
This will let hb_ot_font_paint_glyph() try
multiple tables in turn.
2022-12-23 13:37:59 -07:00
Matthias Clasen 0d890061d1 Rename 'solid' to 'color'
'solid' does not really describe well what
the function does, and there is no strong
reason to stick 1:1 to the terminology used
in the spec.
2022-12-23 13:37:59 -07:00
Behdad Esfahbod 46286275f7 [colr] More dispatch functionality 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 81f232afb5 [colr] Use dispatch machinery for paint_glyph context 2022-12-23 13:37:59 -07:00
Behdad Esfahbod a96300d42c [colr] Hide internal symbols 2022-12-23 13:37:59 -07:00
Behdad Esfahbod b4cab86d94 Fix autotools build 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 0757519092 [colr] Add variation to rest of the paints 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 5bce005346 [colr] Flesh out variations for a few paints 2022-12-23 13:37:59 -07:00
Behdad Esfahbod 9d3440b742 [colr] Add variation infrastructure to paint_glyph
No paint applies variations yet.
2022-12-23 13:37:59 -07:00
Matthias Clasen 5c6329555e Apply root transform
This commit applies scale, slant is still missing.
2022-12-23 13:37:59 -07:00
Matthias Clasen 5afca91ff2 Add some docs 2022-12-23 13:37:59 -07:00
Matthias Clasen 44c68594f1 Some docs 2022-12-23 13:37:59 -07:00
Matthias Clasen d7c2eacf45 Handle COLRv0 layers in paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 55ca6ed230 minor fixes 2022-12-23 13:37:59 -07:00
Matthias Clasen 1880e54753 Assorted fixes 2022-12-23 13:37:59 -07:00
Matthias Clasen 684df8a82a add some todos 2022-12-23 13:37:59 -07:00
Matthias Clasen a6f813b680 Implement hb_color_line_get_extend 2022-12-23 13:37:59 -07:00
Matthias Clasen 3937d6b0aa Implement hb_color_line_t 2022-12-23 13:37:59 -07:00
Matthias Clasen 64f1b55d01 api fixes: use floats consistently 2022-12-23 13:37:59 -07:00
Matthias Clasen 627c857f8b rename pop_group_and_composite 2022-12-23 13:37:59 -07:00
Matthias Clasen c9350838c7 assorted fixes and changes 2022-12-23 13:37:59 -07:00
Matthias Clasen 42324aef2b hb-paint: annotation fix 2022-12-23 13:37:59 -07:00
Matthias Clasen 8377341b28 wip: implement paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen efe13a191d fix introspection 2022-12-23 13:37:59 -07:00
Matthias Clasen 6a48ac42f4 COLR implementation 2022-12-23 13:37:59 -07:00
Matthias Clasen 71efa0dcf1 wip: hb_font_paint_glyph 2022-12-23 13:37:59 -07:00
Matthias Clasen 83d0a49f71 wip: hb-paint 2022-12-23 13:37:59 -07:00
Matthias Clasen 30c5402e3d Make hb-features.h usable standalone
The intended use for hb-features.h is to
be included standalone, so we can't put
the single-include guards in here.
2022-12-23 12:33:28 -07:00
Behdad Esfahbod d628aff9db [ft] Apply slant in get_glyph_extents 2022-12-22 10:53:37 -07:00
Behdad Esfahbod 9a0ebd2b2a [glyf] Fix slant-scaling in GlyphHeader too 2022-12-22 10:21:50 -07:00
Behdad Esfahbod 392463bff5 [cff] Fix extent rounding
I broke it in b0abbfd868.
2022-12-22 08:34:01 -07:00
Behdad Esfahbod 897c102703 [font] Fix scale_glyph_extents 2022-12-22 08:15:01 -07:00
Behdad Esfahbod 9194e13e25 [font] Apply slant to glyph extents
Fixes https://github.com/harfbuzz/harfbuzz/issues/3952

hb-ft not fixed since doesn't use this code.
2022-12-22 07:32:29 -07:00
Behdad Esfahbod b0abbfd868 [font] Centralize glyph-extents scaling
Needs more testing...

Some rounding was removed, namely in cff1 and cff2.
2022-12-22 07:32:15 -07:00
Behdad Esfahbod 97b8ada865 [varc] Reset component coordinates to that of the font
Fixes https://github.com/harfbuzz/boring-expansion-spec/issues/78
2022-12-21 19:52:20 -07:00
Garret Rieger 40342c9437 [subset] check for addition overflow in hdmx size calculation.
Fixes https://oss-fuzz.com/testcase-detail/4877336988483584.
2022-12-21 16:44:06 -07:00
Garret Rieger d77fca997e [subset] when subsetting preprocessor fails, reference the returned face.
The caller of the method is expected to destroy the returned result.
2022-12-21 15:04:27 -07:00
Behdad Esfahbod 9b5b4da0e4 [varc] Set coordinates as absolute values 2022-12-20 09:58:04 -07:00
Behdad Esfahbod 80e68f09c5 [VarC] Change rotation/skew representation
Fixes https://github.com/harfbuzz/boring-expansion-spec/issues/77
2022-12-19 19:17:04 -07:00
Garret Rieger 1840b02e6a [subset] Don't gate access to the table repacker.
Any table with an object graph should repack correctly.
2022-12-19 17:57:33 -07:00
Behdad Esfahbod 03a1685693 [VarC] Change representation of scale from 4.12 to 6.10
Fixes https://github.com/harfbuzz/boring-expansion-spec/issues/76
2022-12-19 17:12:09 -07:00
Matthias Clasen c292e577ff Fix a typo 2022-12-19 20:04:36 +02:00
Matthias Clasen b795246fff [draw] Clarify the docs
Disambiguate the origin of draw_data and user_data,
this had me confused a few times.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/3955
2022-12-19 20:04:36 +02:00
Matthias Clasen eddb408f9c [draw] Small doc fix 2022-12-19 20:03:57 +02:00
Khaled Hosny bc4c290b75 [doc] Workaround gtk-doc limitation with HB_DEPRECATED_FOR
See https://github.com/harfbuzz/harfbuzz/issues/3957#issuecomment-1356890525
2022-12-19 00:59:50 +02:00
Khaled Hosny f9e1192d58 [ot-tag] Document two deprecated symbols
See https://github.com/harfbuzz/harfbuzz/issues/3957
2022-12-18 23:58:36 +02:00
Khaled Hosny 947e01a7c1 [subset] Suppress gtk-doc warning 2022-12-18 23:40:01 +02:00
Nirbheek Chauhan 7be06f6377 meson: Override dependencies to improve usage as a subproject
With this change, harfbuzz can be consumed as a subproject without
making any changes to the build files of a project. All you need to do
is provide a wrap file with a `[provide]` section:

https://mesonbuild.com/Wrap-dependency-system-manual.html#provide-section

This is also necessary because otherwise projects need to hard-code
the subproject name, which might be `harfbuzz` when using `wrap-git` or
`harfbuzz-6.0.0` when using `wrap-file` (to build from a release
tarball). This can cause conflicts between different subprojects that
consume harfbuzz differently.

Other projects like glib, cairo, pango, etc already do this.
2022-12-18 08:28:55 +02:00
Behdad Esfahbod 206957aee4 [COLR] Change recursion limit back to 128 2022-12-17 08:57:56 -07:00
Khaled Hosny afcae83a06 6.0.0 2022-12-16 23:35:26 +02:00
Matthias Clasen a98c6fdd92 Mark an argument as unused 2022-12-16 13:23:01 -07:00
Matthias Clasen 601d3806c9 COLRv1: Revamp extents variation
Try to do this a cleaner way.
2022-12-16 13:23:01 -07:00
Behdad Esfahbod 51a17201a7 [open-type] In to_float() take offset as float 2022-12-16 12:28:50 -07:00
Behdad Esfahbod f252cf80e1 [open-type] Allow passing an offset to to_float() 2022-12-16 12:03:51 -07:00
Behdad Esfahbod 6ae35365f8 Fix build 2022-12-16 11:43:38 -07:00
Behdad Esfahbod e957391efe [colr] Add NoVariable::varIdxBase 2022-12-16 11:33:04 -07:00
Behdad Esfahbod e06de98c36 [var-common] Make VarInstancer take an offset 2022-12-16 11:31:00 -07:00
Behdad Esfahbod 251f9f6213 [open-type] Add VarIdx::add() 2022-12-16 11:29:51 -07:00
Behdad Esfahbod bf2ae3f0ca [open-type] Add static_assert for NO_VARIATION 2022-12-16 11:26:24 -07:00
Matthias Clasen d4496e6405 COLRv1: Apply variations correctly
The variations are for xMin, yMin, xMAx, yMax.
Apply them before converting to extents..
2022-12-16 11:14:42 -07:00
Matthias Clasen 193e0e3e8e Cosmetic: typo fix 2022-12-14 22:34:06 -07:00
Garret Rieger b5acde43ed [subset] check pending/subsetted tag sets for alloc failure. 2022-12-13 15:31:40 -07:00
Jordan Petridis 79285a9983
VarC: cast ints (#3934)
msvc is rightfully complaining that the types on the sides of
the ternary are not matching:

```
C:\pango\subprojects\harfbuzz\src\OT\glyf\VarCompositeGlyph.hh(317): error C2446: ':': no conversion from 'const OT::HBUINT16' to 'const OT::HBUINT8'
```
2022-12-13 11:14:20 -07:00
Behdad Esfahbod 300d82ce2e Fix compiler warning 2022-12-13 11:01:03 -07:00
Behdad Esfahbod 199345eb29
Merge pull request #3928 from harfbuzz/colrv1-extents
COLRv1: use ClipBoxes for extents
2022-12-12 18:37:10 -07:00
Behdad Esfahbod bd7cb384cf [VarC] Remove unused variable 2022-12-12 14:10:48 -07:00
Behdad Esfahbod 51d3ce39ba
Merge pull request #3933 from googlefonts/cff
[subset] Fix infinite loop when instancing CFF fonts
2022-12-12 14:07:44 -07:00
Behdad Esfahbod 1b278c7658 [VarC] Update for new format
https://github.com/harfbuzz/boring-expansion-spec/issues/71
2022-12-12 13:57:05 -07:00
Garret Rieger 64cbe8b962 [subset] Also note that only full instancing works. 2022-12-12 20:41:40 +00:00
Garret Rieger 0da59f86a8 [subset] note that CFF/CFF2 instancing is not yet supported. 2022-12-12 20:26:11 +00:00
Garret Rieger 38a9628885 [subset] simplify handling of table subsetting depedencies.
Allow the dependency checker to see all tables that will be subset. Use this to fix the HMTX/VMTX dep check against glyf. Don't delay hmtx/vmtx subsetting if no glyf table is present.
2022-12-12 20:13:17 +00:00
Garret Rieger 0853e5d9d7 [subset] if table dependencies can't be resolved fail the subset.
Avoids getting stuck in an infinite loop.
2022-12-12 19:43:31 +00:00
Behdad Esfahbod 6bb478eeeb [VarC] Clamp after addition 2022-12-12 11:39:06 -07:00
Behdad Esfahbod 80a5011eb6 [VarC] Fix coord setting
Those are additive.
2022-12-12 11:37:59 -07:00
Behdad Esfahbod 4e9a6cfb49 [COLR] Use VarStoreInstancer 2022-12-12 10:20:51 -07:00
Behdad Esfahbod a3a3d37b95 [var] Add VarStoreInstancer 2022-12-12 10:17:41 -07:00
Behdad Esfahbod c64661b2f8 [COLR] Fix variation code 2022-12-12 10:11:02 -07:00
Behdad Esfahbod ff332b14ea [COLR] Handle HB_OT_LAYOUT_NO_VARIATIONS_INDEX 2022-12-11 21:05:14 -07:00
Behdad Esfahbod 9a3f0be291 [COLR] Apply variations in get_extent 2022-12-11 13:40:53 -07:00
Behdad Esfahbod 68964efa55 [COLR] Use bsearch in get_extents 2022-12-11 13:21:01 -07:00
Behdad Esfahbod d0ee5a452f [COLR] Return false from get_extents if table version not 1 2022-12-11 13:13:35 -07:00
Behdad Esfahbod b3d6a5ef86 [colr] Minor no behavior change 2022-12-11 13:12:30 -07:00
Matthias Clasen 7a748ad4ac COLRv1: use ClipBoxes for extents
This is a first step; ultimatively, we
should compute the extents is ClipBoxes
are missing.
2022-12-11 13:12:30 -07:00
Behdad Esfahbod d36a0f8c42 [COLR] Add TODO 2022-12-11 13:12:19 -07:00
Behdad Esfahbod a306820681 [colr] Use SortedArray instead of Array 2022-12-11 13:03:55 -07:00
Behdad Esfahbod b9d5e7a8bb [colr] Set HB_COLRV1_MAX_NESTING_LEVEL to 16
Was 100. That seemed excessive.
2022-12-11 12:54:19 -07:00
Behdad Esfahbod c17afa48de [colr] Remove COLRV1_ENABLE_SUBSETTING 2022-12-11 12:53:55 -07:00
Behdad Esfahbod 9ab2c8034e Revert "[glyf] Use component phantom points after transformation"
This reverts commit a756bd1944.

Fixes https://github.com/harfbuzz/harfbuzz/issues/3929
2022-12-11 12:04:29 -07:00
Behdad Esfahbod 7f73b57bc1 [subset] Graduate L1 instancing API from experimental
Fixes https://github.com/harfbuzz/harfbuzz/issues/3926
2022-12-10 17:35:52 -07:00
Khaled Hosny 0f4e38cd86 [subset] Small doc fixes 2022-12-10 16:39:26 +02:00
Behdad Esfahbod bf2e817549 [VarComposites] Support GID24 2022-12-09 23:15:26 -07:00
Behdad Esfahbod 10d38dcdfd [varc] Change format slightly
Fixes https://github.com/harfbuzz/boring-expansion-spec/issues/70
2022-12-09 19:19:57 -07:00
Behdad Esfahbod af450a757d [config] Use HB_EXPERIMENTAL_API instead of adhoc HB_EXPERIMENTAL 2022-12-09 19:05:16 -07:00
Behdad Esfahbod 5cf0b9ae7d [varc] Mark as experimental feature with HB_NO_VAR_COMPOSITES 2022-12-09 18:59:43 -07:00
Behdad Esfahbod 82b4f3791e [coord-setter] Don't modify font coords 2022-12-09 18:46:33 -07:00
Behdad Esfahbod e9e503b80b [Glyph] Pass down coords to get_points 2022-12-09 18:42:46 -07:00
Behdad Esfahbod 8e46870093 [gvar] Take coords in instead of font in apply_deltas_to_points 2022-12-09 18:35:30 -07:00
Behdad Esfahbod 3caa42a4a7 Fix build after rebase 2022-12-09 14:48:41 -07:00
Behdad Esfahbod bbe59e4211 Whitespace 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 13deea7cbd [glyf/VarComposite] Clamp axis coordinates 2022-12-09 14:45:29 -07:00
Behdad Esfahbod a975be4c07 [glyf/VarComposite] Minor rename 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 1e71db2d26 [glyf/VarComposite] Fix transformation 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 1233be61d8 [glyf/VarComposite] Remove unneeded resize 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 1a906162cb [glyf/coord-setter] Fix memory issue 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 7efd68da39 [glyf/VarComposite] Set coordinates
Code is untested but complete!
2022-12-09 14:45:29 -07:00
Behdad Esfahbod 4ec7781497 [glyf] Move coord-setter to its own file 2022-12-09 14:45:29 -07:00
Behdad Esfahbod dadb4ed71d [glyf/VarComposite] More, almost there 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 0a939b48a6 [glyf/VarComposite] Implement more 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 65cc3b5e2b [glyf/VarComposite] More 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 12688ed386 [glyf] Fix distcheck 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 60d959a6e7 [glyf/VarComposite] Add use_my_metrics() 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 575d99406a [glyf] Flesh out VarCompositeGlyph 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 21f671bc45 [glyf] Add stub VarCompositeGlyph 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 435c5eeffe [glyf] Split composite-iter 2022-12-09 14:45:29 -07:00
Behdad Esfahbod 1024a013fd [glyf] Add CoordSetter 2022-12-09 14:45:29 -07:00
Garret Rieger e66d02126e [subset] replace subset-processing.md reference with link to it on github. 2022-12-08 16:32:24 -07:00
Garret Rieger 27201ed32b [subset] fix up hb_subset_preprocess api comment. 2022-12-08 16:32:24 -07:00
Garret Rieger 13b0388351 [subset] link to preprocessing doc from api comment. 2022-12-08 16:32:24 -07:00
Garret Rieger c097abab52 [subset] set no prune unicode ranges flag in preprocessor.
To avoid modifying the original unicode range values in the source font.
2022-12-08 16:32:24 -07:00
Garret Rieger bc87fe952e [subset] add note about memory management with preprocessed faces. 2022-12-08 16:32:24 -07:00
Garret Rieger 5e713e99bf Revert "[map] Speed up is_real()"
This reverts commit f5307c3ba8.

Found to slow down the benchmarks in some cases.
2022-12-08 16:32:24 -07:00
Garret Rieger eda02c2ebd [subset] Move hb_subset_preprocess to be non-experimental. 2022-12-08 16:32:24 -07:00
Garret Rieger 76d5482a7c [subset] always return a valid face from hb_subset_preprocess. 2022-12-08 16:32:24 -07:00
Garret Rieger 35233d2514 [repacker] fix fuzzer reported stack overflow.
Fixes https://oss-fuzz.com/testcase-detail/6014493291577344.
2022-12-07 10:32:56 -07:00
Garret Rieger f1d3489388 [repacker] bail on failure to alloc assigned_bytes set.
Fixes fuzzer issue https://oss-fuzz.com/testcase-detail/5390364397928448.
2022-12-05 14:13:47 -07:00
Garret Rieger 239a5aca02 [repacker] don't allow references to the null object in graph.
Fixes fuzzer issue https://oss-fuzz.com/testcase-detail/6714085985353728
2022-12-05 14:13:47 -07:00
Behdad Esfahbod 4ce0f08897 [coretext] Clamp variation settings to min/max
Like our native implementation does; CoreText doesn't itself.

Also fix leak of CFNumber's.
2022-12-05 13:18:34 -07:00
Behdad Esfahbod 22b0390e2d Revert "[VarData] Don't clear memory we are going to fill in completely"
This reverts commit e28e2dad03.

This made fuzzer unhappy. I'm not sure how.

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54044
2022-12-05 09:43:36 -07:00
Behdad Esfahbod 3c497e2458 [harfbuzz-subset.cc] Revert accidental change
These extra files are unnecessary, but our generator currently
isn't smart enough to know that. Will fix some time.
2022-12-04 15:35:01 -07:00
Behdad Esfahbod aa7f5e3742 [subset] Conditionalize call to hb_font_set_variations 2022-12-04 15:33:18 -07:00
Behdad Esfahbod ad5588e800 [config] If HB_NO_SHAPER then HB_NO_OT_SHAPE 2022-12-04 15:27:59 -07:00
Behdad Esfahbod 1a5c749581 [config] Flesh out HB_NO_SHAPER a bit more 2022-12-04 15:20:51 -07:00
Behdad Esfahbod 2c0abf0258 Revert "[harfbuzz-subset.cc] Trim down!"
This reverts commit a335458d57.

While this can be vastly trimmed down, what I did is not right.
It still depends on hb-face, hb-font, hb-blob, hb-set, and hb-map.
2022-12-04 15:03:36 -07:00
Behdad Esfahbod a335458d57 [harfbuzz-subset.cc] Trim down! 2022-12-04 14:56:20 -07:00
Behdad Esfahbod 765a3551da [face-builder] Minor cast 2022-12-04 14:48:32 -07:00
Behdad Esfahbod 3fff6d9084 [face-builder] Initialize face orders to -1 2022-12-04 14:47:38 -07:00
Behdad Esfahbod 805ce9ad3d [face-builer] Protect against wrong face
In hb_face_builder_sort_tables.
2022-12-04 14:43:17 -07:00
Behdad Esfahbod 0acfd2b714 [indic-machine] Regenerate line numbers 2022-12-04 14:01:05 -07:00
Behdad Esfahbod 9704f8354e Merge branch 'config-header' 2022-12-04 13:58:52 -07:00
Behdad Esfahbod c1aae14a68 [features.h] Fix autotools build rules 2022-12-04 13:58:39 -07:00
Behdad Esfahbod 0545949f01 [gvar] Minor use array get_size() 2022-12-04 12:44:09 -07:00
Behdad Esfahbod 1bd386515c [bit-set] Micro-optimize page_for 2022-12-04 12:30:20 -07:00
Behdad Esfahbod b182e2808a [bit-set] Don't clear pages when copying set 2022-12-04 12:22:17 -07:00
Behdad Esfahbod f5307c3ba8 [map] Speed up is_real() 2022-12-04 11:54:16 -07:00
Behdad Esfahbod 301f6e4b47 [Coverage] Remove TODO 2022-12-04 11:46:10 -07:00
Behdad Esfahbod dbbb8e8006 Revert "[map] Add hb_map_filter_invalid"
This reverts commit 8d7e921117.

Surprisingly this slowed NotoNastaliqUrdu benchmark down by a couple
percent instead of speeding it up.
2022-12-04 11:13:39 -07:00
Behdad Esfahbod 8d7e921117 [map] Add hb_map_filter_invalid
Use it in one place.
2022-12-04 11:02:15 -07:00
David Corbett 260df1fa32 [indic] Support <U+0A02, U+0A40> 2022-12-04 10:46:47 -07:00
Behdad Esfahbod 8b533763c0 Use hb_len() instead of .len() 2022-12-03 15:58:12 -07:00
Behdad Esfahbod e28e2dad03 [VarData] Don't clear memory we are going to fill in completely 2022-12-03 15:56:43 -07:00
Behdad Esfahbod 0e13b4abbc [VarData] Optimize main loop slightly 2022-12-03 15:50:24 -07:00
Behdad Esfahbod ad17c0acce [VarData] Whitespace 2022-12-03 14:56:57 -07:00
Behdad Esfahbod e7eb445d29 [VarData] Optimize longWord calculation 2022-12-03 14:56:00 -07:00
Behdad Esfahbod f2c980be29 [VarData] Optimize wordCount calculation
6% speedup in RobotoFlex-Variable/900 benchmark.
2022-12-03 14:49:38 -07:00
Behdad Esfahbod 3641b0e01e [VarData] Optimize serialize() 2022-12-03 14:26:21 -07:00
Behdad Esfahbod e155f12307 [VarData] Minor save a variable 2022-12-03 14:14:39 -07:00
Behdad Esfahbod 5596a73087 [layout] Speed up ClassDefFormat2 intersects 2022-12-03 13:33:48 -07:00
Behdad Esfahbod 85e7263b38 [VariationStore] Minor access array directly 2022-12-03 13:28:02 -07:00
Behdad Esfahbod 41a8597f38 [layout] Simplify CoverageFormat2 intersects_coverage() 2022-12-03 13:23:26 -07:00
Behdad Esfahbod 1f4d8ccaed [CoverageFormat2] Optimize intersects() 2022-12-03 13:17:15 -07:00
Behdad Esfahbod c482b06108 [gpos] Optimize PairPosFormat1::intersects 2022-12-03 13:14:31 -07:00
Behdad Esfahbod 58e9df132f [Device] Serialize VariationDevice zerocopy 2022-12-03 13:04:00 -07:00
Behdad Esfahbod 071a2bb4f7 [serialize] Support zerocopy while sharing 2022-12-03 13:03:38 -07:00
Behdad Esfahbod 44a5de3a97 [Device] Save a snap/revert 2022-12-03 12:50:32 -07:00
Behdad Esfahbod 93328cedfc [Device] Save a map get() 2022-12-03 12:49:26 -07:00
Behdad Esfahbod 630b874ae6 [gsubgpos] Add a cache to intersected_class_glyphs
30% gain on subset_codepoints/NotoNastaliqUrdu-Regular.ttf/nohinting/1400.
2022-12-03 12:13:15 -07:00
Behdad Esfahbod c044f4af3e [gsubgpos] Remove wrong const 2022-12-03 11:58:04 -07:00
Behdad Esfahbod 2680be1f22 [gsubgpos] Don't set unnecessary funcs 2022-12-03 11:54:52 -07:00
Behdad Esfahbod 023f595dec [cmap] Speed up DefaultUVS::copy even more
Another 14% on SourceHanSerifVF/10 benchmark.
2022-12-03 11:18:05 -07:00
Behdad Esfahbod 4ca6105108 [cmap] Remove double-min 2022-12-03 11:15:06 -07:00
Behdad Esfahbod cd29147e30 [cmap] Minor cast 2022-12-03 10:41:42 -07:00
Behdad Esfahbod 4cdb5cc69b [cmap] Minor change iterator 2022-12-03 10:40:24 -07:00
Behdad Esfahbod 2cdaedaf54 Use hb_enumerate in more places 2022-12-03 10:16:35 -07:00
Behdad Esfahbod 02bc4dd69b Use hb_enumerate instead of hand-coding 2022-12-03 10:10:01 -07:00
Behdad Esfahbod 4d19c724c0 [CoverageFormat1] Speed up intersects()
Speeds up SourceHanSerif/10000 benchmark (not in test suite) by
32%!
2022-12-03 09:57:29 -07:00
Behdad Esfahbod a2d33779e1 Fix arm bot build 2022-12-03 09:49:00 -07:00
Behdad Esfahbod dabbf13d40 [cmap] Speed up DefaultUVS::copy 2022-12-03 09:46:11 -07:00
Qunxin Liu 8eadb83640 [subset] Update hb_subset_input_override_name_table API
Override the name string for the NameRecord identified by name_id,
platform_id, encoding_id and language_ids specified by the user.
If a record with specified name_id does not exist, this API will create
a new NameRecord with provided info and insert it to the name table.
2022-12-02 18:05:53 -07:00
Behdad Esfahbod ddeac3658b [test-multimap] More tests 2022-12-02 16:51:07 -07:00
Behdad Esfahbod ff419789ef [subset-plan] Sort unicode_to_new_gid_list when needed 2022-12-02 16:43:33 -07:00
Behdad Esfahbod 1a40da4ad1 [subset-plan] Use add_array instead of add_sorted_array
That vector is not declared as sorted.
2022-12-02 16:13:37 -07:00
Behdad Esfahbod 32e049a315 [subset-plan] Use gid-to-unicodes multimap
One test fails. Need investigation.
2022-12-02 16:09:10 -07:00
Behdad Esfahbod da7961b2e8 . 2022-12-02 16:08:40 -07:00
Behdad Esfahbod 7d6893a803 [subset-accelerator] Cache gid-to-unicodes 2022-12-02 15:50:52 -07:00
Behdad Esfahbod 10c8fc5553 [multimap] Add a multimap datastructure 2022-12-02 15:50:49 -07:00
Behdad Esfahbod a42fc8ec4a [subset-accelerator] Adjust in_error() 2022-12-02 15:41:18 -07:00
Behdad Esfahbod 65d9630312 [subset-cff2] Whitespace 2022-12-02 14:59:26 -07:00
Behdad Esfahbod b33297ee26 [cff2] Remove unused typedef 2022-12-02 14:43:37 -07:00
Behdad Esfahbod 3ade2ffaa5 [serialize] Adjust pop_discard for zerocopy 2022-12-02 14:26:36 -07:00
Behdad Esfahbod 043eeb29a3 [subset-cff] Optimize encode_subrs
Don't loop over all original subrs. Just walk over closure subrs.
2022-12-02 13:58:36 -07:00
Behdad Esfahbod 0ad5977cd6 [subset-cff] Simplify hinting processing
We already have drop_hints in the params.
2022-12-02 13:41:36 -07:00
Behdad Esfahbod 16cbe41bca
Merge pull request #3910 from googlefonts/repacker_fuzz
[repacker] Add a fuzzer for the hb-subset-repacker api.
2022-12-02 12:43:13 -07:00
Behdad Esfahbod 2a7a1d5a73 [Coverage] Avoid timeout on broken ranges
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53929
2022-12-02 12:33:24 -07:00
Behdad Esfahbod c947652768 [subset-cff] Micro-optimize 2022-12-02 12:01:35 -07:00
Behdad Esfahbod a24d4e9261 [array] Oops. Fix memcpy copy()! 2022-12-02 12:01:35 -07:00
Behdad Esfahbod 5e41766bb9 [array] Fix hb_bytes_t memcpy copy
Wasn't being used!
2022-12-02 12:01:35 -07:00
Behdad Esfahbod a5616227ca [subset-cff] Fix buffer size calculation 2022-12-02 12:01:35 -07:00
Behdad Esfahbod 015af5a8e5 [subset-cff] Write a couple loops as range-based for 2022-12-02 12:01:35 -07:00
Behdad Esfahbod bfbbd4af25 [subset-cff] Copy str for call ops 2022-12-02 12:01:35 -07:00
Behdad Esfahbod c755b3884f [subset-cff] Pre-alloc enough for check-less copy 2022-12-02 12:01:35 -07:00
Behdad Esfahbod 062e59ae67 [subset-cff] Optimize vector allocation for preprocessed input 2022-12-02 12:01:35 -07:00
Behdad Esfahbod 8e9e94dba9 Revert "[vector] Optimize grow_vector() for size"
This reverts commit 1dd9396c7a.

Is faster indeed.

15% on SourceHanSans/10000 benchmark.
2022-12-02 12:01:35 -07:00
Behdad Esfahbod 2644540a74 [subset-cff] Compact parsed strings if using accelerator
Saves 32% on SourceHanSans/10000 benchmark!

Also, use memcmp now for writing out strings since now that our
ops are not super short, that's faster.

This makes cff-japanese test takes super long though; that needs
inspection.
2022-12-02 12:01:35 -07:00
Behdad Esfahbod 6012d3b228 [subset-cff] Write out charstrings zerocopy to serializer 2022-12-01 17:33:53 -07:00
Behdad Esfahbod 36e1a6339c [cff] Add total_size to INDEX 2022-12-01 17:00:03 -07:00
Behdad Esfahbod 3843000660 [serialize] Add start_zerocopy() 2022-12-01 16:48:22 -07:00
Garret Rieger de5a621322 [repacker] enforce root node having no incoming edges. 2022-12-01 23:37:16 +00:00
Behdad Esfahbod a2681c37c1 [cff-subset] Simplify INDEX serialize() more 2022-12-01 16:15:23 -07:00
Behdad Esfahbod c4b05878cb [subset-cff] Remove INDEX unused serialize() methods 2022-12-01 15:56:37 -07:00
Behdad Esfahbod b3ad4d72cc [cff] Another no-memset in INDEX 2022-12-01 15:46:00 -07:00
Behdad Esfahbod 5fd2f255fc [open-type] Don't memset 0 in serialize for ArrayOf family
Not necessary.
2022-12-01 15:18:59 -07:00
Garret Rieger 30e405e470 [repacker] ensure link obj indices are valid. 2022-12-01 22:12:59 +00:00
Behdad Esfahbod 70ac6dfb28 [subset-cff] Don't memset 0 INDEX and other serialize methods
Not necessary.
2022-12-01 14:58:25 -07:00
Garret Rieger 554ed06fac [repacker] add cycle detection to the graph sort.
This allows us to bail early if the graph is not acyclic.
2022-12-01 21:52:37 +00:00
Behdad Esfahbod a66de336fb [vector] Minor use get_size() in as_bytes() 2022-12-01 14:32:13 -07:00
Behdad Esfahbod 0b826368fd [serializer] Don't memset memory in embed
Not necessary.
2022-12-01 14:23:25 -07:00
Behdad Esfahbod 3b68c7146f [array] Don't clear serializer buffer when copying out
Not needed.
2022-12-01 14:19:27 -07:00
Behdad Esfahbod 57808609c9 [VarData] Move an unlikely 2022-12-01 14:03:56 -07:00
Garret Rieger 9e99d08470 [repacker] validate link widths during repacker setup. 2022-12-01 20:17:41 +00:00
Garret Rieger edf7a29595 [repacker] Validate link positions before running the repacker. 2022-12-01 20:17:41 +00:00
Garret Rieger deca30b268 [repacker] get repacker fuzzer working.
Additionally add helper method that allows a graph to be saved as a fuzzer seed.
2022-12-01 20:17:40 +00:00
Garret Rieger 985b19f678 [repacker] begin implementing a fuzzer for the repacker api. 2022-12-01 20:17:39 +00:00
Matthias Clasen c6d616cc41 Generate and install hb-features.h
This header has defines for all the optional
dependendencies that come with their own Harfbuzz
headers, so you can do:

  #include <hb-features.h>
  #ifdef HB_HAS_DIRECTWRITE
  #include <hb-directwrite.h>
  #endif
2022-12-01 18:16:55 +08:00
Behdad Esfahbod 8805a866b5 [ClassDef2] Write a few loops as range-based for 2022-11-30 17:18:04 -07:00
Behdad Esfahbod ac8b232a2d [gsub] Cache intersects_class results for closure
Benchmark                                                                                 Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
BM_subset/subset_codepoints/NotoNastaliqUrdu-Regular.ttf/nohinting/10                  +0.0246         +0.0240             0             0             0             0
BM_subset/subset_codepoints/NotoNastaliqUrdu-Regular.ttf/nohinting/64                  -0.5541         -0.5544             4             2             4             2
BM_subset/subset_codepoints/NotoNastaliqUrdu-Regular.ttf/nohinting/512                 -0.1120         -0.1123            43            38            43            38
BM_subset/subset_codepoints/NotoNastaliqUrdu-Regular.ttf/nohinting/1400                -0.1154         -0.1159            43            38            43            38
2022-11-30 17:09:04 -07:00