[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
|
hb_bytes_t &dest_bytes /* OUT */) const
|
||||||
{
|
{
|
||||||
GlyphHeader *glyph_header = nullptr;
|
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);
|
glyph_header = (GlyphHeader *) hb_calloc (1, GlyphHeader::static_size);
|
||||||
if (unlikely (!glyph_header)) return false;
|
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);
|
plan->head_maxp_info.yMax = hb_max (plan->head_maxp_info.yMax, rounded_yMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*for empty glyphs: all_points only include phantom points.
|
/* when pinned at default, no need to compile glyph header
|
||||||
*just update metrics and then return */
|
* and for empty glyphs: all_points only include phantom points.
|
||||||
|
* just update metrics and then return */
|
||||||
if (!glyph_header)
|
if (!glyph_header)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -188,25 +189,28 @@ struct Glyph
|
||||||
!(plan->flags & HB_SUBSET_FLAGS_NOTDEF_OUTLINE))
|
!(plan->flags & HB_SUBSET_FLAGS_NOTDEF_OUTLINE))
|
||||||
type = EMPTY;
|
type = EMPTY;
|
||||||
|
|
||||||
switch (type) {
|
//dont compile bytes when pinned at default, just recalculate bounds
|
||||||
case COMPOSITE:
|
if (!plan->pinned_at_default) {
|
||||||
if (!CompositeGlyph (*header, bytes).compile_bytes_with_deltas (dest_start,
|
switch (type) {
|
||||||
deltas,
|
case COMPOSITE:
|
||||||
dest_end))
|
if (!CompositeGlyph (*header, bytes).compile_bytes_with_deltas (dest_start,
|
||||||
return false;
|
deltas,
|
||||||
break;
|
dest_end))
|
||||||
case SIMPLE:
|
return false;
|
||||||
if (!SimpleGlyph (*header, bytes).compile_bytes_with_deltas (all_points,
|
break;
|
||||||
plan->flags & HB_SUBSET_FLAGS_NO_HINTING,
|
case SIMPLE:
|
||||||
dest_end))
|
if (!SimpleGlyph (*header, bytes).compile_bytes_with_deltas (all_points,
|
||||||
return false;
|
plan->flags & HB_SUBSET_FLAGS_NO_HINTING,
|
||||||
break;
|
dest_end))
|
||||||
default:
|
return false;
|
||||||
/* set empty bytes for empty glyph
|
break;
|
||||||
* do not use source glyph's pointers */
|
default:
|
||||||
dest_start = hb_bytes_t ();
|
/* set empty bytes for empty glyph
|
||||||
dest_end = hb_bytes_t ();
|
* do not use source glyph's pointers */
|
||||||
break;
|
dest_start = hb_bytes_t ();
|
||||||
|
dest_end = hb_bytes_t ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!compile_header_bytes (plan, all_points, dest_start))
|
if (!compile_header_bytes (plan, all_points, dest_start))
|
||||||
|
|
|
@ -80,7 +80,7 @@ struct glyf
|
||||||
_populate_subset_glyphs (c->plan, glyphs);
|
_populate_subset_glyphs (c->plan, glyphs);
|
||||||
|
|
||||||
hb_font_t *font = nullptr;
|
hb_font_t *font = nullptr;
|
||||||
if (!c->plan->pinned_at_default)
|
if (c->plan->normalized_coords)
|
||||||
{
|
{
|
||||||
font = _create_font_for_instancing (c->plan);
|
font = _create_font_for_instancing (c->plan);
|
||||||
if (unlikely (!font)) return false;
|
if (unlikely (!font)) return false;
|
||||||
|
@ -108,7 +108,8 @@ struct glyf
|
||||||
|
|
||||||
if (font)
|
if (font)
|
||||||
{
|
{
|
||||||
_free_compiled_subset_glyphs (&glyphs);
|
if (!c->plan->pinned_at_default)
|
||||||
|
_free_compiled_subset_glyphs (&glyphs);
|
||||||
hb_font_destroy (font);
|
hb_font_destroy (font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue