Behdad Esfahbod
2eacc37e08
[vector] Add internal API for exact-size allocation
...
Use it from a couple of places.
2022-12-31 12:30:31 -07:00
Behdad Esfahbod
071a2bb4f7
[serialize] Support zerocopy while sharing
2022-12-03 13:03:38 -07:00
Behdad Esfahbod
3ade2ffaa5
[serialize] Adjust pop_discard for zerocopy
2022-12-02 14:26:36 -07:00
Behdad Esfahbod
6012d3b228
[subset-cff] Write out charstrings zerocopy to serializer
2022-12-01 17:33:53 -07:00
Behdad Esfahbod
3843000660
[serialize] Add start_zerocopy()
2022-12-01 16:48:22 -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
1fed366d5b
[serialize] Shut compiler warning off
2022-11-25 12:37:24 -07:00
Behdad Esfahbod
59c45f6deb
Use hb_memcpy instead of memcpy consistently
2022-11-22 12:54:50 -07:00
Behdad Esfahbod
3d1c76f713
[serializer] Don't hash objects twice
2022-11-21 19:40:32 -07:00
Behdad Esfahbod
afd716d4cd
[serialize] Don't free object-pool in reset()
2022-11-16 12:28:56 -07:00
Garret Rieger
07fd0528c0
[repacker] add graph equality check.
...
Does not compare topological sorting, but looks for equivalence of the two graphs.
2022-08-15 23:16:51 +00:00
Behdad Esfahbod
f4f7d691af
Merge pull request #3779 from harfbuzz/split_pair_pos_2
...
[repacker] Add PairPosFormat2 table splitting in the repacker.
2022-08-09 22:23:23 -06:00
Qunxin Liu
7fde6ab025
fuzzer fix: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49790
2022-08-05 15:10:31 -06:00
Garret Rieger
a733a9afa5
[repacker] insert new subtables immediately after the subtable they split from in the lookup.
2022-08-05 00:32:47 +00:00
Behdad Esfahbod
b3f689e7e5
[serializer] Remove TODO that's not gonna happen
2022-06-10 07:31:47 -06:00
Behdad Esfahbod
3f78a71ca0
[map] Finally! Just can usd hb_hashmap_t<obj_t, obj_t>
...
Yay!
2022-06-02 11:23:37 -06:00
Behdad Esfahbod
0ccab339f9
[map] Remove invalid-key template arguments since unused
2022-06-02 11:23:37 -06:00
Garret Rieger
cbf8f44c9b
[subset-perf] swap instead of copying vertice's when reordering during sort.
2022-05-20 09:41:18 -06:00
Behdad Esfahbod
6eaa22e9d7
[serialize] Reduce link_t size from 16 to 12
2022-05-19 18:16:54 -06:00
Qunxin Liu
a35757c6bc
[repacker] expose hb_subset_repack() API, hb_object_t and hb_link_t structs
2022-03-10 17:26:20 -07:00
luz paz
e2e305066a
Fix various typos
...
Found via `codespell -q 3 -S ./perf/texts -L actualy,ba,beng,fo,gir,inout,nd,ot,pres,ro,te,teh,timne`
2022-01-16 05:39:03 -08:00
Behdad Esfahbod
8a69e00639
[meta] Use std::addressof() instead of hb_addressof()
2022-01-13 16:17:34 -07:00
Garret Rieger
39e76af19e
[subset] add all_links () to object_t.
...
Helper to provide easy access to concatenated real and virtual links iterator.
2021-12-01 08:37:04 -07:00
Garret Rieger
9121ed0cec
[subset] Improve sharing of Ligature subtables.
...
Ligature subtables use virtual links to enforce an ordering constraint between the subtables and the coverage table. Unfortunately this has the sideeffect of prevent the subtables from being shared by another Ligature with a different coverage table since object equality compares all links real and virtual. This change makes virtual links stored separately from real links and updates the equality check to only check real links. If an object is de-duped any virtual links it has are merged into the object that replaces it.
2021-12-01 08:37:04 -07:00
Behdad Esfahbod
394f772937
[map] Allow storing classes in the hashmap
...
Fixes https://github.com/harfbuzz/harfbuzz/issues/3293
The trick was to change the type of the invalid key/value to be non-class.
2021-11-19 11:49:23 -07:00
Garret Rieger
9643d77086
[repacker] add more detailed comment about virtual links.
2021-11-02 12:19:13 -06:00
Garret Rieger
5bfc7d1015
[repacker] remove VirtualOffset struct.
...
Make and add_virtual_link () specialization of add_link() instead.
2021-11-02 12:19:13 -06:00
Garret Rieger
bc4c5341d6
[repacker] Add test for virtual links in the repacker.
2021-11-02 12:19:13 -06:00
Garret Rieger
7615b94ecf
[repacker] add 'virtual links' to the serializer.
...
These aren't associated with an offset field, but instead exist solely to add an ordering constraint to the object graph.
2021-11-02 12:19:13 -06:00
Behdad Esfahbod
943921cf0c
[meta] Use more std type_traits
2021-11-02 00:26:46 -06:00
Behdad Esfahbod
6d555ce82e
[meta] Use std::forward instead of hb_forward()
2021-11-02 00:18:22 -06:00
Garret Rieger
2bd911b8b4
[subset] handle cmap4 overflows.
...
If a cmap4 subtable overflows during serialization drop it and the corresponding EncodingRecord. Don't drop the corresponding cmap12 table if it would have otherwise been removed.
2021-09-02 14:43:17 -06:00
Behdad Esfahbod
087e2705de
Fix signed-ness error in 0ded6a70c8
2021-07-28 11:42:48 -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
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
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
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
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
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
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
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
832f2b599b
[subset] Refactor _subset () to reduce nesting and eliminate the use of 'goto'.
2021-03-17 15:53:58 -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