[var] Apply variations on empty glyphs

It was ignoring empty glyphs for no good reason, this fixes it.

Fixes #2618
This commit is contained in:
Ebrahim Byagowi 2020-08-06 20:16:11 +04:30 committed by GitHub
parent 5cab55ca90
commit ec17b62457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 2 deletions

View File

@ -716,7 +716,6 @@ struct glyf
if (unlikely (!SimpleGlyph (*header, bytes).get_contour_points (points, phantom_only)))
return false;
break;
default: return false; /* empty glyph */
}
hb_face_t *face = font->face;
@ -787,7 +786,8 @@ struct glyf
all_points.extend (phantoms);
} break;
default: return false;
default:
all_points.extend (phantoms);
}
if (depth == 0) /* Apply at top level */
@ -860,6 +860,8 @@ struct glyf
template<typename T>
bool get_points (hb_font_t *font, hb_codepoint_t gid, T consumer) const
{
if (gid >= num_glyphs) return false;
/* Making this alloc free is not that easy
https://github.com/harfbuzz/harfbuzz/issues/2095
mostly because of gvar handling in VF fonts,

View File

@ -540,6 +540,8 @@ struct gvar
/* num_coords should exactly match gvar's axisCount due to how GlyphVariationData tuples are aligned */
if (!font->num_coords || font->num_coords != table->axisCount) return true;
if (unlikely (glyph >= table->glyphCount)) return false;
hb_bytes_t var_data_bytes = table->get_glyph_var_data_bytes (table.get_blob (), glyph);
if (!var_data_bytes.as<GlyphVariationData> ()->has_data ()) return true;
hb_vector_t<unsigned int> shared_indices;

View File

@ -57,6 +57,7 @@ TESTS = \
tests/use.tests \
tests/variations-rounding.tests \
tests/variations-rvrn.tests \
tests/variations-space.tests \
tests/vertical.tests \
tests/zero-width-marks.tests \
$(NULL)

View File

@ -57,6 +57,7 @@ in_house_tests = [
'use.tests',
'variations-rounding.tests',
'variations-rvrn.tests',
'variations-space.tests',
'vertical.tests',
'zero-width-marks.tests',
]

View File

@ -0,0 +1,2 @@
../fonts/ab40c89624a6104e5d0a2308e448a989302f515b.ttf:--variations=wdth=60:U+0020:[space=0+266]
../fonts/ab40c89624a6104e5d0a2308e448a989302f515b.ttf:--variations=wdth=402:U+0020:[space=0+639]