Commit Graph

146 Commits

Author SHA1 Message Date
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 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
Behdad Esfahbod 4e9a6cfb49 [COLR] Use VarStoreInstancer 2022-12-12 10:20:51 -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 8c29dcaee4 s/HBFixed/F16DOT16/g 2022-10-13 12:06:15 -06:00
Behdad Esfahbod f7147835eb [colr] Add MIN_SIZE to Paint 2022-07-15 16:03:25 -06:00
Behdad Esfahbod 7c4e9080c0 [sanitize] Minor trace format fixup
This likely() is unlikely to make a difference, and obscures
the return_trace() message by writing out "something" instead
of the true/false value.
2022-07-11 21:52:41 -06:00
Behdad Esfahbod ae9fc7f533 Clean accelerators a bit more 2022-01-20 12:37:21 -07:00
Garret Rieger 87496bf63e [subset] fix fuzzer timeout if visisted_paint goes into error. 2022-01-13 11:08:24 -08:00
Qunxin Liu 51655a078e [subset] COLR : only include glyphs after COLR closure 2021-12-06 13:29:21 -07:00
Behdad Esfahbod 82a9f54410 [colr] Simplify sanitize 2021-11-10 10:50:38 -08:00
Garret Rieger 64b29dbd59 [subset] reuse colrv1 max nesting depth constant for sanitize. 2021-11-10 10:34:46 -07:00
Garret Rieger ace98cc65f [subset] Only sanitize recursion depth in COLR. 2021-11-10 10:34:46 -07:00
Qunxin Liu 0a7563a53f [subset] fuzzer fix: https://oss-fuzz.com/testcase?key=6254792024915968
Make sure input is valid, each gid has a corresponding offset value in
the map
2021-11-02 15:25:18 -07:00
Behdad Esfahbod 6d555ce82e [meta] Use std::forward instead of hb_forward() 2021-11-02 00:18:22 -06:00
Qunxin Liu 85deddb16e [subset] fuzzer fix: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40406 2021-10-27 16:16:15 -07:00
Qunxin Liu f55d834736 [subset] Move struct DeltaSetIndexMap into hb-ot-var-common.hh
Also fix naming issues in review comments
2021-10-23 11:22:39 -07:00
Qunxin Liu 8c583db9b5 [subset] COLRv1: update subset() method for new strutc ClipList and VarIdxMap
Also fix issues in struct PaintTransform definition
2021-10-23 11:22:39 -07:00
Qunxin Liu e51c7f8e79 [subset] COLRv1: add ClipList/ClipRecord/ClipBox struct definition 2021-10-23 11:22:39 -07:00
Qunxin Liu 2e5636eeaf [subset] add DeltasetIndexMap struct definition 2021-10-23 11:22:39 -07:00
Qunxin Liu d2e986fead [subset] update COLRv1 table struct definitions 2021-10-23 11:22:39 -07:00
Behdad Esfahbod c852b86841 Rename HBGlyphID to HBGlyphID16 2021-09-19 16:30:12 -04: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
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
Qunxin Liu 35d6af6943 [subset] fix fuzzer testcase: https://oss-fuzz.com/testcase-detail/5965777994907648 2021-06-04 18:16:23 -06:00
Qunxin Liu 1b6008ca62 fix fuzzer testcase: https://oss-fuzz.com/testcase-detail/5417934246772736 2021-06-02 17:32:16 -06:00
Qunxin Liu f739e1dc6a [subset] subset both CPAL and COLRv1 2021-05-26 15:39:42 -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 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
Qunxin Liu 430a67ceab [subset] COLRv1 struct definitions 2021-04-08 11:27:01 -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
ckitagawa b198d94489 use {} rather than {0} 2021-01-25 14:07:52 -08:00
ckitagawa 2e50b517e1 Nicer more idiomatic fix 2021-01-25 14:07:52 -08:00
ckitagawa 8f6559a373 [subet/COLR] Default initialize firstLayerIdx 2021-01-25 14:07:52 -08:00
Ebrahim Byagowi a6fb8ce98a Minor, fix -Wrange-loop-analysis warnings
Fixing these complains raised by newer versions of clang,

./hb-ot-layout-common.hh:1720:53: error: loop variable 'gid_klass_pair' is always a copy because the range of type 'hb_map_iter_t<hb_sorted_array_t<OT::HBGlyphID>, (lambda at ./hb-ot-layout-common.hh:1672:29), hb_function_sortedness_t::RETAINS_SORTING, nullptr>' does not return a reference [-Werror,-Wrange-loop-analysis]
    for (const hb_pair_t<hb_codepoint_t, unsigned>& gid_klass_pair : + it)

And

./hb-ot-color-colr-table.hh:177:44: error: loop variable '_' is always a copy because the range of type 'hb_map_iter_t<hb_filter_iter_t<hb_map_iter_t<hb_range_iter_t<unsigned int, unsigned int>, (lambda at ./hb-ot-color-colr-table.hh:209:31), hb_function_sortedness_t::RETAINS_SORTING, nullptr>, (anonymous struct at ./hb-algs.hh:331:1) &, (anonymous struct at ./hb-algs.hh:51:1) &, nullptr>, (anonymous struct at ./hb-algs.hh:338:1) &, hb_function_sortedness_t::RETAINS_SORTING, nullptr>' does not return a reference [-Werror,-Wrange-loop-analysis]
    for (const hb_item_type<BaseIterator>& _ : + base_it.iter ())
2020-07-05 11:18:04 +04:30
Ebrahim Byagowi 21e1b1310a [colr] minor style fix 2020-02-11 17:10:34 +03:30
Ebrahim Byagowi cbb45c3ee7 [subset/colr] minor improve to resolve msvc complain
MSVC says,
  hb-ot-color-colr-table.hh(215): warning C4700: uninitialized local variable 'new_record' used [build\harfbuzz-subset.vcxproj]
    harfbuzz-subset.vcxproj -> build\Debug\harfbuzz-subset.lib
2020-02-11 16:46:18 +03:30
ckitagawa 92f43a99c6 [subset] COLR, simplify logic and use add_array 2020-01-29 16:06:55 -05:00
ckitagawa fba5128a9e Fix build 2020-01-29 10:24:55 -05:00
ckitagawa 7d542a5274 Refactor to two iterators 2020-01-29 10:21:00 -05:00
ckitagawa 0aed54dca6 Use one-liner methods 2020-01-28 15:35:53 -05:00
ckitagawa 81c469eb62 Try to fix Wrange-loop-analysis 2020-01-28 15:35:53 -05:00
ckitagawa 0d1ba94ac7 Minor style fixes 2020-01-28 15:35:53 -05:00
ckitagawa ed857c4680 [subset] Add COLR support 2020-01-28 15:35:53 -05:00
Ebrahim Byagowi d512087e4d Rename GlyphID to HBGlyphID
Avoid collision with macOS's ATSUnicodeTypes.h GlyphID
2019-09-14 11:55:53 +04:30
Ebrahim Byagowi d67201da5a
[colr] minor 2019-07-30 17:20:18 +04:30
Ebrahim Byagowi e5cf9718c0
[colr][feat][meta] Port sub_array iteration to dagger (#1868) 2019-07-30 04:44:23 +04:30
Ebrahim Byagowi 92588782d7
Remove space between right angle brackets now that we have C++11 (#1689) 2019-04-30 13:05:10 -07:00
Behdad Esfahbod ef00654962 Convert tag enum class consts to static constexpr
Part of https://github.com/harfbuzz/harfbuzz/issues/1553
2019-01-22 12:17:26 +01:00
Behdad Esfahbod b1152d5e66 Use NNOffsetTo<> 2019-01-17 18:17:04 -05:00
Behdad Esfahbod 474a12058d [array/vector] Rename len to length 2018-12-21 18:53:01 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Ebrahim Byagowi b2ebaa9afa Remove redundant 'inline' from methods (#1483) 2018-12-16 14:08:10 -05:00
Behdad Esfahbod 5c4fead734 Convert "static const hb_tag_t" constants to enum 2018-11-29 15:05:47 -05:00
Behdad Esfahbod ae96c98dfa [color] Use SortedUnsizedArrayOf<> 2018-11-24 10:25:10 -05:00
Ebrahim Byagowi 1d82b4761d [colr/feat/trak] minor 2018-11-10 19:31:12 +03:30
Behdad Esfahbod 17ffbc070f [color] Use Index for colorIdx
Doesn't matter, but matches the description.
2018-10-22 21:22:25 -07:00
Behdad Esfahbod 3bf91bd269 [color] Rewrite colr access
COLR table has one function: return layers for a glyph, and we expose exactly
that, so should just wire it through.  Also use sub_array() for verifiable
safety.

Also, BaseGlyphRecord's null object is enough.  We don't need to special-case
the not-found.
2018-10-22 14:21:23 -07:00
Behdad Esfahbod 3b3668acc8 [color] Rename / reorder a bit
Implement has_data() for realz.
2018-10-22 14:21:23 -07:00
Behdad Esfahbod 228fa71bf9 [colr] Move sanitize 2018-10-22 13:03:29 -07:00
Behdad Esfahbod b92b9d7e52 [colr] Move compare function into a static
Not sure if MSVC would be unhappy about this.
2018-10-22 10:17:31 +02:00
Behdad Esfahbod b6b171732a [colr] Minor 2018-10-22 10:17:31 +02:00
Behdad Esfahbod a6ade3471e [colr] Move sanitize() to right place
Sanitize always comes just before data member definitions, so
it's easy to cross-check.
2018-10-22 10:17:31 +02:00
Behdad Esfahbod 24adc15757 [colr] Touch up a bit
When a struct is plain old data with no references, etc, it's okay
to mark its members public.
2018-10-22 10:17:31 +02:00
Khaled Hosny d4e928b142 [color] Minimal API for COLR/CPAL 2018-10-22 10:17:31 +02:00
Behdad Esfahbod 10642b3fbf Disallow null-enabled offsets to unsized structures...
...like UnsizedArrayOf<>.

This fixes a class of crasher bugs, mostly with color and AAT tables.  We
cannot use nullable offsets to varsized data that does not declare min_size,
because it's nost safe to use our fixed-size null pool for types that have
their size external.  So, use non_null'able offsets for these.

A further enhancement would be to make use of min_size in Null<> itself.
Will try that after.
2018-09-15 19:43:33 +02:00
Behdad Esfahbod c77ae40852 Rename hb-*private.hh to hb-*.hh
Sorry for the noise, downstream custom builders.  Please adjust.
2018-08-25 22:36:36 -07:00
Ebrahim Byagowi a47070cd40
Minor, annotate the added tables with likely/unlikely (#997) 2018-04-18 12:09:37 +04:30
Behdad Esfahbod 924803166e [colr] Check layer record access 2018-04-17 15:32:02 +02:00
Ebrahim Byagowi a02c3ee70f Add or update tables specifications links 2018-04-12 13:44:32 +04:30
Ebrahim Byagowi a62554af89
[colr/cpal] Improvements and add a sample renderer (#927) 2018-04-10 00:53:50 +04:30
Behdad Esfahbod 56946d21c0 [color/COLR] Simplify 2018-03-15 07:47:02 -07:00
Behdad Esfahbod 6418ae4e8a [color/COLR] Clean up 2018-03-15 07:47:02 -07:00
Behdad Esfahbod 150c53ee96 [color/COLR] Fix bad sanitize
Bad bad bad bad code. Don't do that. If compiler's not happy, understand why.
2018-03-15 07:47:02 -07:00
Behdad Esfahbod 399c800b93 [color/COLR] Clean up 2018-03-15 07:47:02 -07:00
Behdad Esfahbod e4cbb87bd3 Minor 2018-03-07 09:37:22 +01:00
Ebrahim Byagowi 54cbe6702c
[ot-color] Further improvements on COLR/CPAL implementation (#859)
* Implemented a bsearch on get_base_glyph_record
* Made get_color_record_argb actually work
2018-03-06 16:41:08 +03:30
Ebrahim Byagowi c446c23f0f
[ot-color] Move the related tables to hb-ot-color-* (#858) 2018-03-03 22:43:23 +03:30