[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:
parent
5cab55ca90
commit
ec17b62457
|
@ -716,7 +716,6 @@ struct glyf
|
||||||
if (unlikely (!SimpleGlyph (*header, bytes).get_contour_points (points, phantom_only)))
|
if (unlikely (!SimpleGlyph (*header, bytes).get_contour_points (points, phantom_only)))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
default: return false; /* empty glyph */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_face_t *face = font->face;
|
hb_face_t *face = font->face;
|
||||||
|
@ -787,7 +786,8 @@ struct glyf
|
||||||
|
|
||||||
all_points.extend (phantoms);
|
all_points.extend (phantoms);
|
||||||
} break;
|
} break;
|
||||||
default: return false;
|
default:
|
||||||
|
all_points.extend (phantoms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (depth == 0) /* Apply at top level */
|
if (depth == 0) /* Apply at top level */
|
||||||
|
@ -860,6 +860,8 @@ struct glyf
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool get_points (hb_font_t *font, hb_codepoint_t gid, T consumer) const
|
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
|
/* Making this alloc free is not that easy
|
||||||
https://github.com/harfbuzz/harfbuzz/issues/2095
|
https://github.com/harfbuzz/harfbuzz/issues/2095
|
||||||
mostly because of gvar handling in VF fonts,
|
mostly because of gvar handling in VF fonts,
|
||||||
|
|
|
@ -540,6 +540,8 @@ struct gvar
|
||||||
/* num_coords should exactly match gvar's axisCount due to how GlyphVariationData tuples are aligned */
|
/* 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 (!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);
|
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;
|
if (!var_data_bytes.as<GlyphVariationData> ()->has_data ()) return true;
|
||||||
hb_vector_t<unsigned int> shared_indices;
|
hb_vector_t<unsigned int> shared_indices;
|
||||||
|
|
|
@ -57,6 +57,7 @@ TESTS = \
|
||||||
tests/use.tests \
|
tests/use.tests \
|
||||||
tests/variations-rounding.tests \
|
tests/variations-rounding.tests \
|
||||||
tests/variations-rvrn.tests \
|
tests/variations-rvrn.tests \
|
||||||
|
tests/variations-space.tests \
|
||||||
tests/vertical.tests \
|
tests/vertical.tests \
|
||||||
tests/zero-width-marks.tests \
|
tests/zero-width-marks.tests \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
Binary file not shown.
|
@ -57,6 +57,7 @@ in_house_tests = [
|
||||||
'use.tests',
|
'use.tests',
|
||||||
'variations-rounding.tests',
|
'variations-rounding.tests',
|
||||||
'variations-rvrn.tests',
|
'variations-rvrn.tests',
|
||||||
|
'variations-space.tests',
|
||||||
'vertical.tests',
|
'vertical.tests',
|
||||||
'zero-width-marks.tests',
|
'zero-width-marks.tests',
|
||||||
]
|
]
|
||||||
|
|
|
@ -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]
|
Loading…
Reference in New Issue