[subset] MATH: don't serialize coverage table when iterator is empty

when iterator is empty, just set coverage offset to 0.
serialize() in coverage will at lease write out a 16-bit format header.
This commit is contained in:
Qunxin Liu 2021-12-02 19:50:16 -08:00 committed by Behdad Esfahbod
parent 1d9ef3a75a
commit 74b46b29e7
11 changed files with 22 additions and 3 deletions

View File

@ -511,7 +511,8 @@ struct MathGlyphInfo
| hb_map_retains_sorting (glyph_map) | hb_map_retains_sorting (glyph_map)
; ;
out->extendedShapeCoverage.serialize_serialize (c->serializer, it); if (it) out->extendedShapeCoverage.serialize_serialize (c->serializer, it);
else out->extendedShapeCoverage = 0;
out->mathKernInfo.serialize_subset (c, mathKernInfo, this); out->mathKernInfo.serialize_subset (c, mathKernInfo, this);
return_trace (true); return_trace (true);
@ -884,8 +885,11 @@ struct MathVariants
if (!o) return_trace (false); if (!o) return_trace (false);
o->serialize_subset (c, glyphConstruction[i], this); o->serialize_subset (c, glyphConstruction[i], this);
} }
out->vertGlyphCoverage.serialize_serialize (c->serializer, new_vert_coverage.iter ()); if (new_vert_coverage)
out->vertGlyphCoverage.serialize_serialize (c->serializer, new_vert_coverage.iter ());
if (new_hori_coverage)
out->horizGlyphCoverage.serialize_serialize (c->serializer, new_hori_coverage.iter ()); out->horizGlyphCoverage.serialize_serialize (c->serializer, new_hori_coverage.iter ());
return_trace (true); return_trace (true);
} }

View File

@ -52,6 +52,7 @@ EXTRA_DIST += \
expected/variable \ expected/variable \
expected/glyph_names \ expected/glyph_names \
expected/math \ expected/math \
expected/math_coverage_offset \
expected/post \ expected/post \
fonts \ fonts \
profiles \ profiles \

View File

@ -44,6 +44,7 @@ TESTS = \
tests/variable.tests \ tests/variable.tests \
tests/glyph_names.tests \ tests/glyph_names.tests \
tests/math.tests \ tests/math.tests \
tests/math_coverage_offset.tests \
tests/post.tests \ tests/post.tests \
$(NULL) $(NULL)

Binary file not shown.

View File

@ -0,0 +1,12 @@
FONTS:
Caudex-Regular.ttf
PROFILES:
default.txt
retain-gids.txt
glyph-names.txt
notdef-outline.txt
keep-all-layout-features.txt
SUBSETS:
*

View File

@ -39,6 +39,7 @@ tests = [
'sbix', 'sbix',
'colr', 'colr',
'math', 'math',
'math_coverage_offset',
# TODO: re-enable once colrv1 subsetting is stabilized. # TODO: re-enable once colrv1 subsetting is stabilized.
# 'colrv1.notoemoji', # 'colrv1.notoemoji',
'colrv1', 'colrv1',