[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)
;
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);
return_trace (true);
@ -885,7 +886,10 @@ struct MathVariants
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 ());
return_trace (true);
}

View File

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

View File

@ -44,6 +44,7 @@ TESTS = \
tests/variable.tests \
tests/glyph_names.tests \
tests/math.tests \
tests/math_coverage_offset.tests \
tests/post.tests \
$(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',
'colr',
'math',
'math_coverage_offset',
# TODO: re-enable once colrv1 subsetting is stabilized.
# 'colrv1.notoemoji',
'colrv1',