[instancer] bug fix

It's possible that length of all_points equals to 4 for non-empty
glyphs: a composite glyph which contains only one child glyph that is
empty.
This commit is contained in:
Qunxin Liu 2023-02-10 11:08:05 -08:00 committed by Behdad Esfahbod
parent 8302da8630
commit af1e605be2
7 changed files with 15 additions and 1 deletions

View File

@ -119,7 +119,7 @@ struct Glyph
hb_bytes_t &dest_bytes /* OUT */) const hb_bytes_t &dest_bytes /* OUT */) const
{ {
GlyphHeader *glyph_header = nullptr; GlyphHeader *glyph_header = nullptr;
if (!plan->pinned_at_default && type != EMPTY && all_points.length > 4) if (!plan->pinned_at_default && type != EMPTY && all_points.length >= 4)
{ {
glyph_header = (GlyphHeader *) hb_calloc (1, GlyphHeader::static_size); glyph_header = (GlyphHeader *) hb_calloc (1, GlyphHeader::static_size);
if (unlikely (!glyph_header)) return false; if (unlikely (!glyph_header)) return false;

View File

@ -63,6 +63,7 @@ EXTRA_DIST += \
expected/pin_all_at_default \ expected/pin_all_at_default \
expected/instance_no_double_free \ expected/instance_no_double_free \
expected/mvar_full_instance \ expected/mvar_full_instance \
expected/instance_comp_glyph_empty_child \
fonts \ fonts \
profiles \ profiles \
$(NULL) $(NULL)

View File

@ -54,6 +54,7 @@ TESTS = \
tests/pin_all_at_default.tests \ tests/pin_all_at_default.tests \
tests/instance_no_double_free.tests \ tests/instance_no_double_free.tests \
tests/mvar_full_instance.tests \ tests/mvar_full_instance.tests \
tests/instance_comp_glyph_empty_child.tests \
$(NULL) $(NULL)
# TODO: re-enable once colrv1 subsetting is stabilized. # TODO: re-enable once colrv1 subsetting is stabilized.

Binary file not shown.

View File

@ -0,0 +1,11 @@
FONTS:
RobotoMono.ttf
PROFILES:
default.txt
SUBSETS:
*
INSTANCES:
wght=700

View File

@ -56,6 +56,7 @@ tests = [
'instance_feature_variations', 'instance_feature_variations',
'instance_no_double_free', 'instance_no_double_free',
'mvar_full_instance', 'mvar_full_instance',
'instance_comp_glyph_empty_child',
] ]
repack_tests = [ repack_tests = [