[instancer] always recalculate bounds when --instance option enabled
But don't recompile glyph bytes if pinned at default
This commit is contained in:
parent
1f948e7fd5
commit
2ecb1c31e9
|
@ -116,7 +116,7 @@ struct Glyph
|
|||
hb_bytes_t &dest_bytes /* OUT */) const
|
||||
{
|
||||
GlyphHeader *glyph_header = nullptr;
|
||||
if (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);
|
||||
if (unlikely (!glyph_header)) return false;
|
||||
|
@ -155,8 +155,9 @@ struct Glyph
|
|||
plan->head_maxp_info.yMax = hb_max (plan->head_maxp_info.yMax, rounded_yMax);
|
||||
}
|
||||
|
||||
/*for empty glyphs: all_points only include phantom points.
|
||||
*just update metrics and then return */
|
||||
/* when pinned at default, no need to compile glyph header
|
||||
* and for empty glyphs: all_points only include phantom points.
|
||||
* just update metrics and then return */
|
||||
if (!glyph_header)
|
||||
return true;
|
||||
|
||||
|
@ -188,6 +189,8 @@ struct Glyph
|
|||
!(plan->flags & HB_SUBSET_FLAGS_NOTDEF_OUTLINE))
|
||||
type = EMPTY;
|
||||
|
||||
//dont compile bytes when pinned at default, just recalculate bounds
|
||||
if (!plan->pinned_at_default) {
|
||||
switch (type) {
|
||||
case COMPOSITE:
|
||||
if (!CompositeGlyph (*header, bytes).compile_bytes_with_deltas (dest_start,
|
||||
|
@ -208,6 +211,7 @@ struct Glyph
|
|||
dest_end = hb_bytes_t ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!compile_header_bytes (plan, all_points, dest_start))
|
||||
{
|
||||
|
|
|
@ -80,7 +80,7 @@ struct glyf
|
|||
_populate_subset_glyphs (c->plan, glyphs);
|
||||
|
||||
hb_font_t *font = nullptr;
|
||||
if (!c->plan->pinned_at_default)
|
||||
if (c->plan->normalized_coords)
|
||||
{
|
||||
font = _create_font_for_instancing (c->plan);
|
||||
if (unlikely (!font)) return false;
|
||||
|
@ -108,6 +108,7 @@ struct glyf
|
|||
|
||||
if (font)
|
||||
{
|
||||
if (!c->plan->pinned_at_default)
|
||||
_free_compiled_subset_glyphs (&glyphs);
|
||||
hb_font_destroy (font);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue