Behdad Esfahbod
6fe0d7d6e8
[GSUB] If MultipleSubst is applied to a ligature-component, preserve lig-id
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/3069
2021-07-28 12:06:49 -06:00
Behdad Esfahbod
b926fb9bb0
Whitespace
2021-07-28 11:58:10 -06:00
Behdad Esfahbod
cc3a7ceea3
Fix macro-in-macro invocation
...
../src/hb-ot-color-colr-table.hh:980:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive]
\#if COLRV1_ENABLE_SUBSETTING == 1
2021-07-28 11:53:06 -06:00
Behdad Esfahbod
087e2705de
Fix signed-ness error in 0ded6a70c8
2021-07-28 11:42:48 -06:00
Garret Rieger
f3e031539f
Revert "[ci] Bin FontTools version due to recent COLRv1 changes"
...
This reverts commit 163748b505
.
2021-07-28 11:36:34 -06:00
Garret Rieger
acbd8b27dc
[subset] temporarily disable COLRv1 subsetting.
...
Currently COLRv1 spec is being changed so the subsetting implementation is out of sync. Disable subsetting by failing sanitization for COLRv1 tables and disable all colrv1 tests.
2021-07-28 11:36:34 -06:00
Behdad Esfahbod
0ded6a70c8
[subset] Fix another fuzzer issue
...
Addition could overflow on 32bit arch.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36636
Fixes https://oss-fuzz.com/testcase-detail/5072358514753536
2021-07-28 11:35:27 -06: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
c68a00b92e
[subset] Fix possible overflows in VarRegionList serialize
...
Fixes https://oss-fuzz.com/testcase-detail/5362189182566400
2021-07-27 13:28:09 -06:00
Behdad Esfahbod
7b8464b655
[serialize] Check for overflow in allocate_size()
...
If size was > INT_MAX, then the out-of-room check was failing to perform
as intended.
Part of fixing https://oss-fuzz.com/testcase-detail/5362189182566400
2021-07-27 13:26:00 -06:00
Behdad Esfahbod
bf2c87bfe6
Add hb_memcpy() that does len=0 check
2021-07-27 13:26:00 -06:00
Khaled Hosny
5f801da945
[hb-ms-features] Move code out of header file
2021-07-27 21:07:32 +02:00
Khaled Hosny
990c15dbe5
[hb-ms-features] Rename types to be less general
2021-07-27 21:07:32 +02:00
Khaled Hosny
69199211b7
[uniscribe/directwrite] Move feature setup to shared file
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/3070
2021-07-27 21:07:32 +02:00
Garret Rieger
fc7f778120
[subset] add a note to hb-subset on what is and isn't supported ( #3076 )
2021-07-27 11:21:19 -07:00
Khaled Hosny
791a1bf3a4
Don’t disable getenv on Windows
...
The condition is inverted, regression from
40ec187dec
.
2021-07-27 15:22:13 +02:00
Behdad Esfahbod
4762fcb415
Merge pull request #3067 from googlefonts/glyph_names
...
[subset] support option --glyph-names
2021-07-26 11:48:55 -07:00
Behdad Esfahbod
aeec278453
Merge pull request #3068 from harfbuzz/hoi
...
[variations] Support multiple axes with same tag, aka HOI
2021-07-26 11:31:54 -07:00
Khaled Hosny
ec99fdb7e8
[sebset] Use [s|g]et_flag for retain_all_layout_features
...
Looks like this was missed when adding hb_subset_input_[s|g]et_flag()
2021-07-26 19:32:28 +02:00
Khaled Hosny
acc7100a3f
[docs] Improve subset documentation
2021-07-26 02:18:23 +02:00
Khaled Hosny
3e2734cf91
[docs] Don’t use GTK-Doc syntax for internal functions
...
We don’t generate docs for them, reduces the number of warnings.
2021-07-26 02:18:18 +02:00
Qunxin Liu
71b5509c19
[subset] support option --glyph-names
2021-07-23 13:57:39 -07:00
Behdad Esfahbod
b235511ed8
Merge pull request #3021 from googlefonts/stable_api
...
[subset] update hb_subset api with final changes before going stable.
2021-07-23 12:15:15 -07:00
Behdad Esfahbod
a9a607d360
[variations] Support multiple axes with same tag, aka HOI
...
The axes in fvar are in arbitrary order, NOT sorted. Hence have to
lsearch all entries.
Fixes https://github.com/harfbuzz/harfbuzz/issues/1673
Fixes https://github.com/harfbuzz/harfbuzz/issues/2743
Test from https://github.com/ctrlcctrlv/FontForge-Higher-Order-Interpolation
2021-07-23 11:58:58 -07:00
Garret Rieger
1fde80ad28
[subset] update comments referencing hb_subset_input_t parameter.
2021-07-22 16:45:48 -07:00
Garret Rieger
c581d11eba
[set] in hb_set_set() avoid calling memcpy on nullptr.
2021-07-22 14:04:39 -07:00
Garret Rieger
2b9cb29923
[subset] cleanup no_subset_tables on destruction.
2021-07-22 13:26:03 -07:00
Garret Rieger
89fc399eba
[subset] Add hb-subset section documentation.
2021-07-22 13:00:34 -07:00
Garret Rieger
792e2ed61c
[subset] convert no get/set prune unicode ranges to enum.
2021-07-22 12:41:48 -07:00
Behdad Esfahbod
0a44feaeda
[fvar] Make find_axis_index() return a range, not individual value
2021-07-22 12:18:48 -07:00
Garret Rieger
1b6c1aa684
[subset] add hb-subset api to documentation generator.
...
Standardize subset_input parameter to be input.
2021-07-22 12:15:45 -07:00
Garret Rieger
8ce9683412
[subset] add documentation for all hb-subset.h methods.
2021-07-22 12:14:53 -07:00
Garret Rieger
9ab751ac9f
[subset] Remove hb_subset(). Leaving just hb_subset_or_fail().
2021-07-22 12:14:47 -07:00
Garret Rieger
e5c887fc0f
[subset] add documentation for subset input flag enums.
2021-07-22 12:14:09 -07:00
Garret Rieger
372722ceee
[subset] move notdef_outline to the subset input property enum.
2021-07-22 12:14:03 -07:00
Garret Rieger
a6c6cda486
[subset] Add no subset tables and passthrough unrecognized tables to the subset api.
...
Matches fontTools options.
2021-07-22 12:12:37 -07:00
Garret Rieger
668f2bd93e
[subset] Add hb_subset_or_fail () to public subset api.
2021-07-22 12:12:36 -07:00
Garret Rieger
aba2e13141
[subset] Remove hb_subset_input_get/set_overlaps_flag ().
2021-07-22 12:12:36 -07:00
Garret Rieger
7d82191f61
[subset] Remove hb_subset_input_get/set_name_legacy ().
2021-07-22 12:12:36 -07:00
Garret Rieger
942636ae13
[subset] Remove hb_subset_input_get/set_retain_gids.
2021-07-22 12:12:36 -07:00
Garret Rieger
77b4a1cd96
[subset] Remove hb_subset_input_get/set_desubroutinize.
2021-07-22 12:12:36 -07:00
Garret Rieger
8bf5d4d4f7
[subset] Remove hb_subset_input_get/set_drop_hints.
2021-07-22 12:12:36 -07:00
Garret Rieger
9fb3a25633
[subset] Use hb_set_copy in subset input.
2021-07-22 12:12:36 -07:00
Garret Rieger
38de3491a0
[subset] add implementation for get/set flag on subset input.
2021-07-22 12:12:36 -07:00
Garret Rieger
83727837ef
[subset] add proposed enum property get/set method.
2021-07-22 12:12:36 -07:00
Garret Rieger
b38e49dcfa
[subset] add get/set user data methods to subset input.
2021-07-22 12:12:30 -07:00
Garret Rieger
edb57a8d9a
Make subset input const in the subsetting operation. Don't modify the subset input's sets.
2021-07-22 12:11:43 -07:00
Behdad Esfahbod
233c29b302
[font] Call fvar.find_axis_index instead of find_axis_info in set_variations()
2021-07-22 12:00:24 -07:00
Behdad Esfahbod
89018068cd
[fvar] Centralize axis finding logic
...
Part of fixing https://github.com/harfbuzz/harfbuzz/issues/1673
2021-07-22 11:59:23 -07:00
Behdad Esfahbod
0b2280af90
[font] Call fvar table directly, instead of calling public get_axis_info
...
To lighten it up in next commit.
2021-07-22 11:58:14 -07:00
Behdad Esfahbod
b86a45ca55
[fvar] Add TODO
...
Fixing https://github.com/harfbuzz/harfbuzz/issues/1673
2021-07-22 11:46:44 -07:00
Behdad Esfahbod
ba6db26b65
Tolerate unsorted OT table entries for small number of entries
...
See comment.
Fixes https://github.com/harfbuzz/harfbuzz/issues/3065
2021-07-22 11:38:27 -07:00
Behdad Esfahbod
03cd9c5cba
Align lfind() API to match bfind()
2021-07-22 11:38:27 -07:00
Behdad Esfahbod
f54f5c1b16
Fix debug printer of bool
2021-07-22 11:38:27 -07:00
Garret Rieger
6269866bdd
[subset] Keep bimap consistent if only one of the internal maps is in error.
2021-07-19 13:42:00 -06:00
Garret Rieger
48edbef96f
[subset] bail if region_map is in error.
...
Fixes fuzzer case https://oss-fuzz.com/testcase-detail/5499162606043136 .
2021-07-19 13:42:00 -06:00
Behdad Esfahbod
79e8b30609
[ot-shape] Fix application of kern table if GPOS kern is missing
...
Was broken sometime after we implemented kerx and tweaking it.
Fixes https://github.com/harfbuzz/harfbuzz/issues/3043
2021-07-16 16:29:44 -06:00
Behdad Esfahbod
1060b04938
Merge pull request #3060 from googlefonts/unicode_collect
...
[subset] de-duplicate the logic that finds unicodes corresponding to …
2021-07-14 17:50:46 -07:00
Garret Rieger
9aa0ecef3f
[subset] de-duplicate the logic that finds unicodes corresponding to requested glyphs.
...
Move the logic into subset planning and then re-use the results in cmap and OS2 subsetting. Removes depedency on cmap from os2.
2021-07-14 17:31:47 -07:00
Garret Rieger
deee24fbef
[subset] Add missing FontName op code in top dict parsing.
...
Fix for #3058
2021-07-14 16:01:18 -06:00
Behdad Esfahbod
9985ca6491
Merge pull request #3057 from harfbuzz/ci-coverage-macos
...
[ci] Add macOS GitHub workflow
2021-07-13 13:42:09 -07:00
Behdad Esfahbod
95b04f7409
[buffer] Remove unnecessary have_separate_output()
2021-07-12 17:36:38 -06:00
Behdad Esfahbod
3e266e5f64
[buffer] Update comments
2021-07-12 17:36:36 -06:00
Behdad Esfahbod
3807061d63
[ot-layout] Don't remove_output() before reverse substitution
...
No need anymore, because of new swap_buffers() semantics.
Just assert instead.
2021-07-12 17:36:22 -06:00
Behdad Esfahbod
10a9960f0a
[buffer] Restructure swap_buffers()
...
Is more of a "commit" operation now. Will rename when ready.
2021-07-12 17:36:22 -06:00
Khaled Hosny
d56afb750a
[tests] Ignore more symbols
...
These seem to be exported when building with code coverage on macOS.
2021-07-13 01:12:34 +02:00
Behdad Esfahbod
a7f4c985a8
[ot-layout] Always swap_buffers() even if no substitutions happened
2021-07-12 17:00:46 -06:00
Behdad Esfahbod
62b441e6ff
[layout] Use Proxy::inplace instead of table index check
...
Equivalent.
2021-07-12 16:59:34 -06:00
Behdad Esfahbod
431f164003
[layout] Don't call clear_output() before pause-func
2021-07-12 16:57:25 -06:00
Behdad Esfahbod
a623446a34
[shape] Remove stray clear_output() call in hb_shape()
2021-07-12 16:55:54 -06:00
Behdad Esfahbod
05c17787c4
[buffer] Rewind cursor in clear_output()
2021-07-12 16:55:08 -06:00
Behdad Esfahbod
1cb0ca1f2c
Whitespace
2021-07-12 16:52:51 -06:00
Behdad Esfahbod
69310f14a6
[buffer] Change nil buffer have_output to false
...
Seems like a historical artefact that it was true.
2021-07-09 16:45:55 -07:00
Behdad Esfahbod
40884af17e
[ot-layout] Narrow down random feature logic vs safe-to-break
2021-07-09 16:34:08 -07:00
Behdad Esfahbod
33b579d0ad
[ot-layout] Clear random flag for subsequent flags
...
Ouch!
2021-07-09 16:34:08 -07:00
Behdad Esfahbod
29c9833e57
Remove Offset::serialize()
...
Finishing https://github.com/harfbuzz/harfbuzz/pull/2355
2021-07-09 11:58:36 -06:00
Khaled Hosny
63e15eac4f
2.8.2
2021-07-08 23:02:49 +02: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
7416faceeb
[subset] fuzzer fix: https://oss-fuzz.com/testcase-detail/5715464591376384
2021-07-08 09:09:30 -07:00
Garret Rieger
0da9158f62
[subset] Remove OffsetTo::serialize().
...
Convert remaining uses of it to serialize_serialize() which correctly uses the object packer.
2021-06-30 14:05:48 -07:00
Behdad Esfahbod
0969614865
[ot-shape] Rewrite loop without foreach_grapheme()
...
We were not using the graphemes, and that's costlier than just for().
2021-06-26 08:52:53 -06:00
Qunxin Liu
eee7b459ee
[subset] add option --no-prune-unicode-ranges
2021-06-24 11:44:20 -07:00
Khaled Hosny
c3be28ea26
[ot-shape] Numeric runs native direction is LTR
...
See inline comments. Slightly modified version of the code from Jonathan
Kew on the linked issue.
Fixes https://github.com/harfbuzz/harfbuzz/issues/501
2021-06-23 13:11:27 -07:00
Behdad Esfahbod
cc9bb29491
[blob] Fix-up recent mistake in hb_blob_create() destroy(user_data)
...
https://github.com/harfbuzz/harfbuzz/pull/3026#discussion_r653437491
2021-06-20 18:47:03 -06:00
Garret Rieger
bc06af977f
[subset] speed up feature collection when tags are specified.
...
Precompute a feature index filter to avoid needing to iterate the feature tag list for each encountered feature index. For this particular fuzzer case speeds up feature collection from 50s to 2s.
2021-06-20 17:45:19 -07:00
Khaled Hosny
14f220b761
[directwrite] Support feature ranges
...
Code copied from hb-uniscribe.cc and adapted to use DirectWrite types.
May be there is a better way to de-duplicate the code, though I'm not
exactly sure how or if it is worth it.
2021-06-20 17:22:27 -07:00
Garret Rieger
26c80adb61
[subset] do colrv1 glyph closure before glyf composite closure.
2021-06-18 22:34:00 -07:00
Qunxin Liu
d07f789ae3
[subset] support option "--notdef-outline"
2021-06-18 15:35:02 -07:00
Garret Rieger
10ad185932
[subset] add comment to copy_bytes().
2021-06-16 17:35:39 -06:00
Garret Rieger
675ebbeb3a
[subset] don't alloc zero bytes.
...
It will be leaked later since hb_blob_create() won't set up the blob to cleanup since it has length zero.
2021-06-16 17:35:39 -06:00
Behdad Esfahbod
93e6a9bc4e
Revert "Remove unneeded buffer clear_output / remove_output calls"
...
This reverts commit 06175b7143
.
One of the sanitizers is failing. Pushing again as PR to debug.
I have suspicions.
2021-06-15 15:38:49 -06:00
Behdad Esfahbod
06175b7143
Remove unneeded buffer clear_output / remove_output calls
...
Made sure clear_output is always paired with swap_buffers.
Trying to see if we can move towards RAII-like buffer iterators
instead of the buffer keeping an iterator internally.
2021-06-15 14:33:27 -06:00
Behdad Esfahbod
bdfed8f113
[blob] Add failing versions of create API
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/2567
New API:
+hb_blob_create_or_fail()
+hb_blob_create_from_file_or_fail()
Use these in util/ to distinguish empty file from not-found file.
Only err on the latter.
2021-06-15 13:56:30 -06:00
Behdad Esfahbod
2fc8d0e6f0
Merge pull request #3020 from googlefonts/serialize_serialize
...
[subset] Always serialize objects point to by OffsetTo to a new serializer object.
2021-06-15 12:56:17 -07:00
Garret Rieger
085aa65e09
[subset] Convert offset serialization in gsubgpos and gdef to serialize_serialize().
2021-06-14 16:47:45 -07:00
Garret Rieger
cc96c4e87e
[shaping] Update shaping substituion lookup serialization to use serializer pop()/pack().
2021-06-14 16:43:23 -07:00
Behdad Esfahbod
d3dd936309
[coretext] Round position info
...
Test:
Before:
$ ./hb-shape /System/Library/Fonts/ヒラギノ丸ゴ\ ProN\ W4.ttc 1 --features="+palt" --shaper=coretext
[gid781=0@-78,0+841]
$ ./hb-shape /System/Library/Fonts/ヒラギノ丸ゴ\ ProN\ W4.ttc 1 --features="+palt" --shaper=ot
[gid781=0@-78,0+842]
After:
$ ./hb-shape /System/Library/Fonts/ヒラギノ丸ゴ\ ProN\ W4.ttc 1 --features="+palt" --shaper=coretext
[gid781=0@-78,0+842]
$ ./hb-shape /System/Library/Fonts/ヒラギノ丸ゴ\ ProN\ W4.ttc 1 --features="+palt" --shaper=ot
[gid781=0@-78,0+842]
I've verified in the font that 842 is correct.
2021-06-14 13:24:23 -07:00
Garret Rieger
8443cc85cb
[subset] Correct OffsetTo serialization in GPOS to use serialize_serialize ().
2021-06-14 12:18:06 -07:00
Garret Rieger
5ba46ed067
[subset] Correct OffsetTo serialization in GSUB to use serialize_serialize ().
2021-06-14 12:18:06 -07:00
Garret Rieger
35458b6b66
[subset] Add serialize_serialize to OffsetTo.
...
Similar to serialize_subset() this will serialize the new object and then link it to the offset.
2021-06-14 12:18:06 -07:00
Behdad Esfahbod
2b0ced28b6
Cluster Regional_Indicator pairs (aka emoji flags)
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/2265
2021-06-14 06:34:58 -07:00
Behdad Esfahbod
4e72d5e35d
[src/check-static-init] Ignore objdump "file format not recognized" error
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/3019
2021-06-13 05:46:17 -06:00
Behdad Esfahbod
5bc05ba155
Prefer GPOS over kerx, if GSUB was applied
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/3008
2021-06-13 05:28:20 -06:00
Behdad Esfahbod
13c6ad980f
[src/check-*] Pickup $(NM), $(OBJDUMP), $(LDD), $(OTOOL)
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/3019
2021-06-12 10:13:49 -07:00
Behdad Esfahbod
c61ce962cf
[buffer] In hb_buffer_get_positions(), return NULL if inside message callback
...
As discussed in https://github.com/harfbuzz/harfbuzz/issues/2468#issuecomment-645666066
Part of fixing https://github.com/harfbuzz/harfbuzz/issues/2468
2021-06-10 17:36:38 -06:00
Behdad Esfahbod
855a3f478e
[emoji] Fix emoji table generation
...
Previously, the last of each range having Extended_Pictograph property
was not processed as so. Ouch!
Test:
$ echo x > null; hb-shape null -u U+1f43b,U+200d,U+2744,U+fe0f
Before:
[gid0=0+1000|gid0=2+1000]
After:
[gid0=0+1000|gid0=0+1000]
Caught by https://github.com/harfbuzz/harfbuzz/issues/3017
2021-06-09 15:10:52 -06:00
Behdad Esfahbod
bd5502f09f
[set] Oops. Fix compile
2021-06-09 14:03:25 -06:00
Behdad Esfahbod
3962225a72
[set] Add hb_set_copy()
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/3016
2021-06-09 14:02:31 -06:00
Behdad Esfahbod
bc33b87f5e
[set] Use references, not pointers, in internal C++ API
2021-06-09 11:54:12 -06:00
Behdad Esfahbod
9cfac093aa
[set] Add copy constructor/assignment
2021-06-09 11:43:35 -06:00
Behdad Esfahbod
a83b9b0fec
Merge pull request #3011 from harfbuzz/directwrite-cleanup
...
Some directwrite cleanups
2021-06-07 16:41:27 -07:00
Khaled Hosny
4811e8f5d7
Trigger doc rebuild
2021-06-07 10:54:36 +02:00
David Corbett
5585ea02eb
[syllabic] Set position of dotted circle for Indic
2021-06-06 10:35:59 -07:00
Khaled Hosny
a9fb6a0c3c
[aat] Add start table/end table to buffer messages
...
Related to https://github.com/harfbuzz/harfbuzz/issues/3008
2021-06-06 10:35:28 -07:00
Behdad Esfahbod
cf9538e808
Removal remaining uses of "blacklist" terminology
2021-06-04 22:33:16 -06:00
Khaled Hosny
6119ff9d80
[hb-directwrite] Don't load dwrit.dll dynamically
...
We already link to it, so I don't see the point of trying to load it
dynamically.
2021-06-05 04:22:46 +02:00
Khaled Hosny
b2070a509c
[hb-directwrite] Don’t override new/delete
...
This is a testing shaper, we don’t care for overridden malloc/free here.
Use malloc/free in the code called from hb_directwrite_face_create().
2021-06-05 04:22:46 +02:00
Khaled Hosny
221d642b19
[hb-directwrite] Remove _hb_directwrite_shape_experimental_width
...
Not used anywhere.
2021-06-05 04:22:46 +02:00
Qunxin Liu
35d6af6943
[subset] fix fuzzer testcase: https://oss-fuzz.com/testcase-detail/5965777994907648
2021-06-04 18:16:23 -06:00
Peter Williams
3d48bfc187
Avoid a deprecation warning in graphite2
...
As of graphite2 1.3.7, `gr_make_face` is deprecated in favor of
`gr_make_face_with_ops`. It's a one-liner to port over to using it.
This is potentially a compatibility break since I'm not sure when the
`with_ops` API was added, but the minimum version of graphite2 that's
supported by Harfbuzz doesn't seem to be documented anywhere anyway.
2021-06-03 09:51:43 -06:00
Qunxin Liu
1b6008ca62
fix fuzzer testcase: https://oss-fuzz.com/testcase-detail/5417934246772736
2021-06-02 17:32:16 -06:00
Garret Rieger
18f61210a4
Add public api methods to get/set the layout features to retain.
2021-06-02 15:18:45 -06:00
Andi-Bogdan Postelnicu
243d056ff1
Removed unused variable `supp_size` from plan_subset_encoding(...).
2021-06-02 07:17:32 -06:00
Qunxin Liu
7ab0f4eda9
fuzzer fix
2021-05-31 12:44:33 -06:00
Qunxin Liu
cb5a6b5a27
[subset] support option --layout-features
2021-05-26 18:04:18 -06: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
Qunxin Liu
f739e1dc6a
[subset] subset both CPAL and COLRv1
2021-05-26 15:39:42 -06:00
Garret Rieger
466e1fdf5d
[subset] remove unnessecary brackets.
2021-05-26 15:26:09 -06:00
Garret Rieger
583237299d
Add cmp() method for major to page map.
2021-05-26 15:26:09 -06:00
Garret Rieger
2c137045dc
[subset] Optimize set iteration by caching the last found page map index.
...
Reuse it if possible on consecutive calls to next(). Will signifcantly speed up cases where the entire set is iterated. In local testing iterating a very large set was 10x faster.
2021-05-26 15:26:09 -06:00
Behdad Esfahbod
9e5738a86a
[set] Okay, giving up on constexpr till C++14
...
../src/hb-set.hh:213:89: error: call to non-'constexpr' function 'const elt_t& hb_vector_size_t<elt_t, byte_size>::operator[](unsigned int) const [with elt_t = long long unsigned int; unsigned int byte_size = 64]'
2021-05-26 15:15:06 -06:00
Behdad Esfahbod
90fa558a5b
[set] Another try at constexpr to make msvc happy
2021-05-26 15:05:48 -06:00
Behdad Esfahbod
bf5d4a6392
[set] Add TODO
2021-05-26 14:27:02 -06:00
Behdad Esfahbod
11d03f1ff9
[set] Mark a couple methods as constexpr
2021-05-26 14:26:05 -06:00
Behdad Esfahbod
d2829ad374
[set] Refactor code into page_t::is_subset()
2021-05-26 14:24:27 -06:00
Behdad Esfahbod
e47e44a858
[set] Whitespace
2021-05-26 14:19:27 -06:00
Kurt Kartaltepe
2000f47ae5
[set] Compute is_subset by comparing pages.
...
Test subsets one page at a time instead of by codepoints. On my machine
this is about 250x faster than the previous implementation.
2021-05-26 14:15:25 -06:00
Dominik Röttsches
1dffb55361
Chromium build fixes for C++ 17 warning and missing _remap_indexes
...
Use class instead of typename, move _remap_indexes out of #ifndef.
Fixes #2979
2021-05-18 08:20:46 -06:00
Jonathan Kew
bbc5fc3731
[aat] If shaping via morx, don't adjust mark positioning when zeroing widths.
2021-05-17 21:44:29 -06:00
Jonathan Kew
4f1e8d2bf7
[aat] Update glyph properties from GDEF if available when doing a replacement.
2021-05-17 21:44:29 -06:00
Garret Rieger
5e0ec33b3d
Error when link width not in [2, 4]
2021-05-12 16:05:11 -06:00
Qunxin Liu
b23f29bf05
[subset] Add subset () method for COLRv1 Paint tables, BaseGlyphV1List and LayerV1List
...
Also add support for Offset24 in serializer and repacker
2021-05-12 16:05:11 -06:00
Garret Rieger
413769bf86
Add hb-ot-color-colrv1-closure.hh to sources list.
2021-05-12 15:29:53 -06:00
Garret Rieger
de0eba20ed
Remove array for visited_paint.
2021-05-12 15:29:53 -06:00
Qunxin Liu
e59ffe5482
[subset] COLRv1 layer/palette indices closure
2021-05-12 15:29:53 -06:00
Garret Rieger
a08900b721
[subset] fix failing colrv0 subsetting when font has composite glyphs.
...
Composite glyph collection was happening along side colrv0 glyph collection which meant it was possible to miss grabbing the component glyphs for a glyph added by colrv0.
2021-05-10 15:33:54 -06:00
tstuefe
b54d9b695a
start
2021-05-07 16:23:09 -06:00
Khaled Hosny
b37f03f16b
2.8.1
2021-05-04 02:07:06 +02:00
Garret Rieger
be50779cda
[subset] correct ClassDef format determination.
...
It was possible for glyph_min to be a glyph mapped to class zero which threw off the number of glyph calculation.
2021-04-30 14:46:57 -06:00
Khaled Hosny
90713f270e
[hb-ot-layout] Document some return values
2021-04-30 14:05:33 -06:00
Garret Rieger
e25efb31f2
[subset] consider all value formats when computing effective format.
2021-04-23 19:09:37 -07:00
Qunxin Liu
84dbfacfec
[subset] fix collect_variation_idx in PairPosFormat2
2021-04-23 18:52:24 -07:00
Garret Rieger
d356d0f79c
[subset] optimize ValueRecord's for PairPosFormat1.
2021-04-23 18:50:34 -07:00
Garret Rieger
f9fbe4817e
[subset] implement value record optimization for PairPosFormat2.
2021-04-23 18:50:34 -07:00
Garret Rieger
badb8e409b
[subset] use copy_values for PairPos serialize.
2021-04-23 18:50:33 -07:00
Garret Rieger
2f50283cd3
[subset] Begin implementing ValueRecord optimization:
...
remove value records which have a zero value.
2021-04-23 18:50:33 -07:00
Garret Rieger
5df7c668ba
[subset] In SinglePosFormat1 serialize only 1 value record.
...
Previously one record per glyph in the subset was serialized.
2021-04-23 18:50:33 -07:00
Garret Rieger
92757f6809
[subset] Don't drop anchor device tables when dropping hints. These may contain variation data.
...
Update subseting expected files to match latest version of fontTools.
2021-04-23 18:50:33 -07:00
Garret Rieger
6fddc2bbf9
[subset] subset layout tables (G*) by default.
2021-04-22 15:08:49 -07:00
Garret Rieger
425ba1f4ab
[subset] fixes infinite loop in hb_set_get_max().
...
Fixes https://oss-fuzz.com/testcase-detail/5363902507515904
2021-04-20 13:18:07 -06:00
Garret Rieger
ec4321068b
[subset] fix infinite loop caused by alloc failure in repacker.
...
Fixes: https://oss-fuzz.com/testcase-detail/5609112151916544 .
2021-04-20 13:18:07 -06:00
Garret Rieger
0e845d973e
[subset] fix memory leak in repacker caused by failed alloc.
...
Fixes: https://oss-fuzz.com/testcase-detail/5616763250278400 .
2021-04-20 13:18:07 -06:00
Garret Rieger
3fb62cdc14
[subset] fail on offset overflow in tables that we don't repack.
...
Fixes: https://oss-fuzz.com/testcase-detail/5229304507138048
2021-04-19 17:01:05 -06:00
Behdad Esfahbod
23a28f5ad0
Avoid undefined-behavior
...
If a struct had (because it's a union) sizeof that is larger than the null_size,
we were providing only null_size bytes for its Null object. We know we'd never
access beyond that, but is undefined-behavior nonetheless according to the
standard.
The alternative fix would have required use of flexible-arrays, which are not
standard and have their own issues in various compiler. We've discussed that
extensively in the follow Mozilla issue (currently locked; I've asked that it
be opened):
https://bugzilla.mozilla.org/show_bug.cgi?id=1577584
Part of
https://github.com/harfbuzz/harfbuzz/pull/2067
2021-04-16 13:23:25 -06:00
Behdad Esfahbod
499248c533
[blob] Use min_size, instead of null_size in .as<T>()
...
Part of https://github.com/harfbuzz/harfbuzz/pull/2067
2021-04-16 13:14:48 -06:00
Khaled Hosny
e116058bba
[directwrite] Use correct UTF-16 string length
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/2474
2021-04-15 09:30:40 -06:00
Ben Denckla
668acff1f0
similarly improve comments on Hebrew ccc 18 & 19
...
Should have committed this along with commit 9658435a25
but forgot.
2021-04-13 11:01:22 -06:00
Ben Denckla
43d955207b
improve comments on Hebrew ccc 18 & 19
...
improve comments to reflect that:
ccc 18 includes both "flavors" of qamats: qamats [gadol] and qamats qatan
ccc 19 includes both "flavors" of holam: holam [not haser for vav] and holam haser for vav
This code and its comments may have been written before these code points were added to Unicode.
I.e. originally, these comments may have been complete, but they may have become incomplete in the meantime.
2021-04-13 11:01:22 -06:00
Qunxin Liu
9dc9f0385d
[subset] fix for fuzzer testcase: https://oss-fuzz.com/testcase-detail/5858518134554624
2021-04-09 11:07:28 -06:00
Qunxin Liu
430a67ceab
[subset] COLRv1 struct definitions
2021-04-08 11:27:01 -06:00
Qunxin Liu
553ffaf682
[subset] fix for fuzzer testcase: https://oss-fuzz.com/testcase-detail/6382598554255360
...
avoid writing to null pointer
2021-04-08 09:54:48 -06:00
Garret Rieger
8b686afeb5
[subset] add unlikely().
2021-04-06 12:34:44 -06:00
Garret Rieger
64122b5a44
[subset] don't visit lookup if covered glyph set has failed.
...
If covered glyph set is in error then the same lookup can be recursed into repeatedly potentially causing a fuzzer timeout. Fixes: https://oss-fuzz.com/testcase-detail/5416421032067072 .
2021-04-06 12:34:44 -06:00
Garret Rieger
6f98a8ed46
[subset] Anchor should only use format 1 when hints are dropped.
...
Refactor Anchor to have a subset method instead of copy. This also allows
use to use serialize_subset in several places which simplifies calculating
offset bases.
2021-04-06 11:50:44 -06:00
Garret Rieger
71d6d15600
[subset] clamp distance to prevent shifting outside of the limits of int64.
...
Fixes https://oss-fuzz.com/testcase-detail/4961171477233664 .
2021-04-06 11:48:39 -06:00
Khaled Hosny
fcacd17748
[ot] Update _hb_glyph_info_is_default_ignorable_and_not_hidden()
...
Used _hb_glyph_info_substituted() similar to the change made to
_hb_glyph_info_is_default_ignorable() in
7686ff854b
.
2021-04-06 11:47:06 -06:00
Garret Rieger
596f4258d0
[subset] copy Lookup::markFilteringSet when subseting.
2021-04-02 15:33:52 -06:00
Behdad Esfahbod
d3a2f999e4
Fix up build
...
This was left out; oops.
2021-04-02 08:33:03 -06:00
Garret Rieger
c35d786397
[subset] never drop the 'pref' feature.
...
Never ever drop feature 'pref', even if it's empty. Harfbuzz uses it to choose the shaper for Khmer.
2021-04-01 16:27:35 -06:00
Behdad Esfahbod
092094f705
Use as_array() and range loops in a few places
2021-04-01 16:02:54 -06:00
Garret Rieger
55e7f3fe32
[subset] Match FeatureVariationRecord dropping from fontTools.
...
Only drop records with no matching features that are at the end of the list. See: cab7d13dc0
2021-04-01 15:26:02 -06:00
Garret Rieger
f0c78e0282
[subset] don't drop features referenced in a feature variation substitution.
2021-04-01 15:26:02 -06:00
Garret Rieger
dae99b7769
[subset] don't keep FeatureVariationRecord's with no subsittutions.
2021-04-01 15:26:02 -06:00
Garret Rieger
b10741ca7f
[subset] when closing glyphs in context lookups don't use a current glyph set if a lookup is already applied.
2021-03-31 21:03:33 -06:00
Garret Rieger
8ef4257dc8
[sanitize] change max ops to track number of bytes processed.
...
Counting bytes as the operations is likely to be a better proxy for how
much work processing the table will cost vs. the current approach of
counting the number of sub-objects.
This should allow checks for max features, max scripts, etc. to be removed.
I tested this change against the full collection of fonts at https://github.com/google/fonts
and a max ops factor of 3 was sufficient to successfully sanitize all of them.
2021-03-31 19:03:30 -06:00
Behdad Esfahbod
70110f6aaa
Modify OffsetTo<>::sanitize() overflow check
...
The code in question was introduced in 70eb2ff682
.
Rewrite it to not call sanitizer check_range() as we want to use
check_range() for byte accounting.
Part of https://github.com/harfbuzz/harfbuzz/pull/2923
2021-03-31 17:04:02 -06:00
Behdad Esfahbod
4dba749d83
Add SortedArray{16,32}Of<>
2021-03-31 16:09:39 -06:00
Behdad Esfahbod
5639e253f9
Add Array16Of<>
2021-03-31 16:04:43 -06:00
Behdad Esfahbod
2520a82df9
s/LArrayOf/Array32Of/g
2021-03-31 15:41:54 -06:00
Behdad Esfahbod
5efe360986
Rename (Unsized)OffsetListOf
2021-03-31 15:33:22 -06:00
Behdad Esfahbod
6c4e0491d7
s/OffsetArrayOf/Array16OfOffset16To/g
2021-03-31 15:31:32 -06:00
Behdad Esfahbod
1fc6b69aed
s/UnsizedOffsetArrayOf/UnsizedArray16OfOffsetTo/g
2021-03-31 15:30:35 -06:00
Behdad Esfahbod
2a54c9f744
.
2021-03-31 15:26:42 -06:00
Behdad Esfahbod
c539afb08b
[CFF] Use NNOffsetTo<> instead of OffsetTo<>
...
I'm pretty sure that's what is intended.
2021-03-31 13:28:25 -06:00
Behdad Esfahbod
9b4b58493b
Fixup for recent OffsetTo<> changes
2021-03-31 13:27:21 -06:00
Behdad Esfahbod
ad28f973f3
Rename offset types to be explicit about their size
...
Add Offset16To<>, Offset24To<>, and Offset32To<> for most use-cases.
2021-03-31 13:00:07 -06:00
Garret Rieger
c5c13006a1
[subset] fix memory leaks found in https://oss-fuzz.com/testcase-detail/5179935334465536
2021-03-31 12:37:45 -06:00
Behdad Esfahbod
bd2950b393
Make VariationStore::get_delta(outer, inner) private
2021-03-31 11:36:36 -06:00
Behdad Esfahbod
934675a429
Use VarIdx in VariationDevice
2021-03-31 11:34:41 -06:00
Behdad Esfahbod
0f7f7536b9
[hvar] Change variation-index types from "unsigned int" to uint32_t
2021-03-31 11:31:49 -06:00
Behdad Esfahbod
9ffc46b8ff
Add VarIdx
2021-03-31 11:26:18 -06:00
Behdad Esfahbod
2179281c40
Add Offset24
2021-03-31 11:20:21 -06:00
Andrzej Perczak
cab9d5a57d
hb-config: Include config-override earlier
...
Currently config-override.h is included at the end of this file. This caused a problem for me while undefing HB_DISABLE_DEPRECATED, namely HB_IF_NOT_DEPRECATED was defined before actual undef took place and broke the whole build. I believe it would break builds for some other defines, too. Moving config-override.h include right after predefined configs is more sane and fixes all potential problems with includes.
2021-03-30 20:50:02 -06:00
Garret Rieger
adca4ce071
[subset] fixes https://oss-fuzz.com/testcase-detail/6173520787800064 .
...
Caused by incorrect bounds check in glyph closure for context lookups.
2021-03-30 15:44:41 -06:00
Garret Rieger
9f77a0c1ff
[subset] use hb_set_clear to avoid calling clear() on null pool set.
2021-03-30 15:12:52 -06:00
Garret Rieger
752e393ad2
[subset] avoid calling clear on null pool set.
2021-03-30 15:12:52 -06:00
Behdad Esfahbod
9ed5f04a70
[subset] Simplify recent out-of-memory fixes
...
By checking return status of map->set().
2021-03-29 18:14:30 -06:00
Behdad Esfahbod
a8f9f85a91
[map] Return success from ->set()
2021-03-29 18:13:22 -06:00
Garret Rieger
8741914a80
[subset] fix memory leak when map insert fails.
2021-03-29 18:02:32 -06:00
Behdad Esfahbod
2397689387
Remove hb_success_t
...
Was not rolled-out yet. So just expand.
2021-03-29 17:49:16 -06:00
Behdad Esfahbod
7a2eda7817
Move code around
2021-03-29 17:49:12 -06:00
Behdad Esfahbod
bcb57dccaa
[sanitize] Add short-circuit to ArrayOfM1
...
Like the sibling ArrayOf types.
2021-03-29 17:49:08 -06:00
Garret Rieger
52df6b9fd8
[subset] check for set insertion success.
2021-03-29 17:41:07 -06:00
Garret Rieger
c6adb90a27
[subset] fix nullptr deref.
2021-03-29 17:41:07 -06:00
Garret Rieger
9a3537e5f6
[subset] invert err() return value. Undo previous change to check_success.
2021-03-29 17:15:22 -06:00
Garret Rieger
cdba5d44c2
[subset] fix incorrect handling of return value in check_success in the error case.
2021-03-29 17:15:22 -06:00
Behdad Esfahbod
05e845c49a
Make previous commit gcc-only
2021-03-29 16:02:10 -07:00
Behdad Esfahbod
b5e4032392
-Wno-unused-result
...
GCC doesn't let one turn off the warning using "(void) foo()".
People have introduced macros that do "unused << foo()" instead.
Until we do something similar, silence gcc.
Clang on the other hand understands "(void) foo()".
2021-03-29 15:57:36 -07:00
Qunxin Liu
95230e291d
[subset] support subsetting GSUB8
2021-03-29 15:54:11 -06:00
David Corbett
d18915f920
Reformat gen-tag-table.py
2021-03-28 10:21:46 -07:00
Garret Rieger
3c8273ab68
Check for alloc failures on the gsub/gpos_langsys maps in subset plan creation.
2021-03-25 16:53:56 -06:00
Behdad Esfahbod
29708e959a
[aat] Fix offsetToIndex math for out-of-bounds values
...
Previously, some bad font data was accidentally being interpretted as
legit if it happened to not fall out of memory bounds. The intention
of the code was what this commit does. I'm surprised we weren't getting
a "arithmetic between signed and unsigned values" warning / error
before.
2021-03-22 15:22:15 -07:00
Garret Rieger
46bf03d691
[subset] add NODISCARD to error checking methods on serializer.
2021-03-18 14:35:36 -07:00
Garret Rieger
3827a3eb56
[subset] rename serializer::set_error() to err().
2021-03-18 11:20:03 -07:00
Garret Rieger
f561fa6e4c
Change priority queue to use (priority, value) instead of (value, priority).
2021-03-18 11:13:47 -07:00
Garret Rieger
b14475d2ae
[subset] further changes to serializer error handling.
...
- Rename enum type and enum members.
- in_errors() now returns true for any error having been set. hb-subset now looks for offset overflow only errors to divert to repacker.
- Added INT_OVERFLOW and ARRAY_OVERFLOW enum values.
2021-03-18 10:51:26 -07:00
Garret Rieger
73ed59f7a6
[subset] store errors in the serializer as a flag set.
...
Make check_assign/check_equal specify the type of error to set.
2021-03-17 15:58:34 -07:00
Garret Rieger
b9ecc7420d
[subset] init offset_overflow in hb_serialize_context_t.
2021-03-17 15:53:58 -07:00
Garret Rieger
cf79fc342d
[subset] limit priority bumps to 16.
2021-03-17 15:53:58 -07:00
Garret Rieger
e2f14e81bd
[subset] fix memory leaks in test-repacker.
2021-03-17 15:53:58 -07:00
Garret Rieger
d3e2ba7c01
[subset] comment cleanup in hb-repacker.hh
2021-03-17 15:53:58 -07:00
Garret Rieger
832f2b599b
[subset] Refactor _subset () to reduce nesting and eliminate the use of 'goto'.
2021-03-17 15:53:58 -07:00
Garret Rieger
bb5c80a7c2
[subset] add error tracking to the repacker.
...
Also check for allocation failures as needed.
2021-03-17 15:53:58 -07:00
Garret Rieger
6e9468fcfb
[subset] cleanup memory leaks in the repacker.
2021-03-17 15:53:58 -07:00
Garret Rieger
a7a86a6eb4
[subset] Add prioritization offset resolution.
...
Vertices can now be prioritized to force them to sort closer to their parent. The resolver will attempt to use this for overflows on non-shared vertices.
2021-03-17 15:53:58 -07:00
Garret Rieger
b452b2c76c
[subset] refactor repacker graph to cache edge count and distances of vertices.
2021-03-17 15:53:57 -07:00
Garret Rieger
75414e82b5
[subset] Add table duplication overflow resolution.
2021-03-17 15:53:57 -07:00
Garret Rieger
8286bd8094
[subset] use vectors instead of hashmaps throughout the repacker since all keys will be mapped for these use cases.
2021-03-17 15:53:57 -07:00
Garret Rieger
519ae96617
[subset] switch sort_shortest_distance() to use priority queue.
2021-03-17 15:53:57 -07:00
Garret Rieger
5d3511e5b1
[subset] Change compute_distances() to use a priority queue.
2021-03-17 15:53:57 -07:00
Garret Rieger
59ac0a0d0a
[subset] Use priority for comparison in heap.
2021-03-17 15:53:57 -07:00
Garret Rieger
4c8dd41ed9
[subset] re-write compute distances to use an array lookup for the distance map.
2021-03-17 15:53:57 -07:00
Garret Rieger
5c4e0ffd97
[subset] Add a basic priority queue datastructure (binary heap).
2021-03-17 15:53:57 -07:00
Garret Rieger
dd8e5d0e1b
[subset] Only run the repacker for GSUB/GPOS.
2021-03-17 15:53:57 -07:00
Garret Rieger
aaa7873d42
[subset] add topological sort by closest distance via Dijkstra's algorithm.
2021-03-17 15:53:57 -07:00
Garret Rieger
8ebe5d734f
Implement will_overflow ().
2021-03-17 15:53:57 -07:00
Garret Rieger
6b1ea4cbe7
[subset] hook up the repacker to run if offset overflows are encountered during subsetting.
2021-03-17 15:53:57 -07:00
Garret Rieger
f4c78cc7dd
[subset] Implement Kahn's algo for topological sorting instead of BFS.
2021-03-17 15:53:57 -07:00
Garret Rieger
00f393dc3f
[subset] finish up BFS sort implementation.
2021-03-17 15:53:57 -07:00