Commit Graph

9437 Commits

Author SHA1 Message Date
Behdad Esfahbod f0c3804fa2 [set] Add hb_bit_set_invertible_t and resurrect hb_set_invert()
Implementation is NOT complete yet.
2021-08-17 19:53:43 -06:00
Behdad Esfahbod b5cdbdc030 [set] Turn hb_set_t into instance of template taking implementation t 2021-08-17 10:53:08 -06:00
Behdad Esfahbod fad452bffb [set] Move main functionality into hb_bit_set_t
To add inversion on top in hb_invertible_set_t and use that as hb_set_t.
2021-08-17 10:47:18 -06:00
Behdad Esfahbod 9cc4da962f [object] Remove hb_object_is_inert() 2021-08-16 20:17:53 -06:00
Behdad Esfahbod 2d5ef05d67 Use !g_object_is_valid() instead of g_object_is_inert() 2021-08-16 20:13:58 -06:00
Behdad Esfahbod f6d6eff6a2 [object] Remove unused HB_REFERENCE_COUNT_INIT 2021-08-16 19:41:44 -06:00
Behdad Esfahbod f245dc4db8 [set] Whitespace 2021-08-15 18:59:58 -06:00
Behdad Esfahbod 9b390f8c40 [set] Move page_t into hb-bit-page.hh 2021-08-15 18:59:58 -06:00
Behdad Esfahbod 0c3e02ee2d [set] Add "inverted" to page_t::is_empty() 2021-08-15 18:59:58 -06:00
Behdad Esfahbod 9bd64fa077 [set] Add "inverted" to page_t::next/prev() 2021-08-15 18:59:58 -06:00
Behdad Esfahbod c88e7ec935 [set] Add page_t::elt_maybe_invert() 2021-08-15 18:59:58 -06:00
Behdad Esfahbod 9449cfeefd [set] Simplify page_t::next/prev() 2021-08-15 18:59:58 -06:00
Behdad Esfahbod 4394ee1f1d [set] Add inverted to page_t::get_min/max() 2021-08-15 18:59:58 -06:00
Behdad Esfahbod 0dcd9b15d9 [set] Add page_t::set_range() 2021-08-15 18:59:58 -06:00
Behdad Esfahbod cb273fd17c [set] Add page_t::set() 2021-08-15 18:59:58 -06:00
Behdad Esfahbod 32bbf53d9c [set] Minor rewrite one cmp() in term of other 2021-08-15 18:59:58 -06:00
Garret Rieger cb05c363d7 [subset] add some basic tests for the legacy subset methods. 2021-08-14 10:37:02 -06:00
Garret Rieger d18aad7ec5 [subset] restore old subsetting api methods.
These will be left in place until the 3.0.0 release.
2021-08-14 10:37:02 -06: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 c08f1b8903 [map] fix incorrect population count in hash map.
If the same key was set twice the population was being incorrectly incremented.
2021-08-10 14:00:55 -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
Ben Wagner f5ba1fabce Fix documentation of hb_subset_flags_t defaults
HB_SUBSET_FLAGS_DEFAULT is 0, and hb_subset_input_create_or_fail
initializes its flags to HB_SUBSET_FLAGS_DEFAULT, so currently all flags
are set to false by default. It has been decided that future flags will
also be false by default for simplicity (using NO_ in the name if
needed). Correct and simplify the documentation for hb_subset_flags_t to
reflect this.
2021-08-09 09:05:24 -06:00
Garret Rieger 8c0c217b5a [subset] fail reference blob in face builder if allocation for table sorting fails.
Fixes https://oss-fuzz.com/testcase-detail/5041767803125760
2021-08-06 15:54:41 -06:00
Garret Rieger e5bfd49ae5 [subset] don't allow table adds for tag == -1. 2021-08-05 17:49:37 -06:00
Garret Rieger 222b74f08f [subset] don't leak memory for duplicate tables. 2021-08-05 17:49:37 -06:00
Behdad Esfahbod f7a9c3ea93 [open-file] Use hb_is_source_of instead of hb_is_iterator 2021-08-05 13:05:07 -06:00
Behdad Esfahbod fa90cb8a31 Whitespace again 2021-08-05 12:31:06 -06:00
Behdad Esfahbod a110a47eb5 Whitespace 2021-08-05 12:28:39 -06:00
Behdad Esfahbod 2cb8c928d7 [face] Let hashmap derive invalid key/value types
Works now with the previous two fixes.
2021-08-05 12:27:22 -06:00
Behdad Esfahbod 95c888e192 [meta] Define hb_int_min for pointer types as nullptr 2021-08-05 12:27:02 -06:00
Behdad Esfahbod 407a112e7b [meta] Make hb_is_signed/hb_is_unsigned work on all types
They were failing if type was non-scalar, eg. pointer.
2021-08-05 12:23:53 -06:00
Behdad Esfahbod baf2166a24 [meta] Use hb_true_type/hb_false_type more 2021-08-05 12:08:47 -06:00
Behdad Esfahbod 74ad5ddcd7 [face] Minor cleaning of previous commit 2021-08-05 11:51:54 -06:00
Garret Rieger c2ee1fdd40 [subset] remove unsed table_entry struct. 2021-08-05 11:47:07 -06:00
Garret Rieger dea0fe5717 [subset] discard extra copies of a table in face builder.
Fixes #2361. Stores tables in the builder in a hashmap so you end up with at most one copy of each table. Table serialization order is now based on tag sort order instead of order of insertion into the builder.
2021-08-05 11:47:07 -06:00
Behdad Esfahbod 368e957887 [ot-shape] Add comment re `vert` feature 2021-08-05 10:41:18 -06:00
Garret Rieger 2c024dc3cb [subset] prune redundant cmap12 subtables.
If the post subset cmap12 table is equivalent to another cmap subtable don't include the 12 table in the final subset. Matches change https://github.com/fonttools/fonttools/pull/2146 from fontTools.
2021-08-04 17:36:24 -06:00
Behdad Esfahbod 09c3b82f5e [buffer] When shifting forward, leave no gap
Trying to see if this fixes the fuzzer issue:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36236
2021-08-04 11:55:53 -06:00
Behdad Esfahbod a150baf32c [ot-map] Allocate top mask bit as global bit
Avoids undefined-shift of 32 in the following line:

  map->mask = (1u << (next_bit + bits_needed)) - (1u << next_bit)

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1219263
2021-08-04 11:53:27 -06:00
Behdad Esfahbod e80c86ffa6 [coretext] Fix formatting 2021-08-04 10:25:06 -06:00
Simon Cozens 66aef2818e Support passing variations to coretext shaper 2021-08-04 10:24:40 -06:00
Behdad Esfahbod 62a535f154 [khmer] Fix comment
Fixes https://github.com/harfbuzz/harfbuzz/issues/3104
2021-08-03 10:11:43 -06:00
Behdad Esfahbod ee7473b8a4 [mutex] Remove unused HB_MUTEX_IMPL_INIT / HB_MUTEX_INIT
https://github.com/harfbuzz/harfbuzz/pull/3100#issuecomment-890089096
2021-07-30 12:55:28 -06:00
Behdad Esfahbod 0e37c07f4c Revert "Construct user_data in hb_object"
This reverts commit a78eb43c79.

See: https://github.com/harfbuzz/harfbuzz/pull/3100#issuecomment-890088227
2021-07-30 12:52:59 -06:00
Behdad Esfahbod 5dc4cd71cc [blob] Minor change in destruction
No semantic change.
2021-07-30 12:37:40 -06:00
Garret Rieger b63ac57174 [subset] bail if collection region indices is in error. 2021-07-29 18:30:37 -07:00
Garret Rieger f9d8e4a976 [subset] switch ..._set_flags to not take a mask. 2021-07-29 18:30:27 -07:00
Garret Rieger 46d4a5e673 [subset] Convert subset plan to use a flags bit set. 2021-07-29 18:02:34 -07:00
Garret Rieger 3d534b146c [subset] convert subset input flags into bit flags.
Store the flags in a bit set. Updates the public api to work with the bit set directly.
2021-07-29 18:02:34 -07:00
Ben Wagner a78eb43c79 Construct user_data in hb_object
hb_object's user_data is created lazily. The previous implementation of
hb_object_set_user_data created space for the user_data but did not
actually construct it. This means that hb_user_data_array_t's lock was
not constructed. If hb_mutex_t is backed by an implementation which
requires that it be constructed (not just zero initialized) then errors
will occur when taking the lock when setting the user data.

Change hb_object_set_user_data to construct the user_data in the created
space and hb_object_fini to call the destructor.
2021-07-29 16:03:56 -06:00