Optimize positioning for when h_origin is nil
This commit is contained in:
parent
762770c964
commit
5bc28b5f68
|
@ -654,23 +654,23 @@ hb_ot_position_default (hb_ot_shape_context_t *c)
|
||||||
if (HB_DIRECTION_IS_HORIZONTAL (direction))
|
if (HB_DIRECTION_IS_HORIZONTAL (direction))
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
|
||||||
pos[i].x_advance = c->font->get_glyph_h_advance (info[i].codepoint);
|
pos[i].x_advance = c->font->get_glyph_h_advance (info[i].codepoint);
|
||||||
|
if (c->font->has_glyph_h_origin_func ())
|
||||||
|
for (unsigned int i = 0; i < count; i++)
|
||||||
c->font->subtract_glyph_h_origin (info[i].codepoint,
|
c->font->subtract_glyph_h_origin (info[i].codepoint,
|
||||||
&pos[i].x_offset,
|
&pos[i].x_offset,
|
||||||
&pos[i].y_offset);
|
&pos[i].y_offset);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
{
|
|
||||||
pos[i].y_advance = c->font->get_glyph_v_advance (info[i].codepoint);
|
pos[i].y_advance = c->font->get_glyph_v_advance (info[i].codepoint);
|
||||||
|
if (c->font->has_glyph_v_origin_func ())
|
||||||
|
for (unsigned int i = 0; i < count; i++)
|
||||||
c->font->subtract_glyph_v_origin (info[i].codepoint,
|
c->font->subtract_glyph_v_origin (info[i].codepoint,
|
||||||
&pos[i].x_offset,
|
&pos[i].x_offset,
|
||||||
&pos[i].y_offset);
|
&pos[i].y_offset);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (c->buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK)
|
if (c->buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK)
|
||||||
_hb_ot_shape_fallback_spaces (c->plan, c->font, c->buffer);
|
_hb_ot_shape_fallback_spaces (c->plan, c->font, c->buffer);
|
||||||
}
|
}
|
||||||
|
@ -719,6 +719,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
|
||||||
|
|
||||||
/* Change glyph origin to what GPOS expects (horizontal), apply GPOS, change it back. */
|
/* Change glyph origin to what GPOS expects (horizontal), apply GPOS, change it back. */
|
||||||
|
|
||||||
|
if (c->font->has_glyph_h_origin_func ())
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
c->font->add_glyph_h_origin (info[i].codepoint,
|
c->font->add_glyph_h_origin (info[i].codepoint,
|
||||||
&pos[i].x_offset,
|
&pos[i].x_offset,
|
||||||
|
@ -726,6 +727,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
|
||||||
|
|
||||||
c->plan->position (c->font, c->buffer);
|
c->plan->position (c->font, c->buffer);
|
||||||
|
|
||||||
|
if (c->font->has_glyph_h_origin_func ())
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
c->font->subtract_glyph_h_origin (info[i].codepoint,
|
c->font->subtract_glyph_h_origin (info[i].codepoint,
|
||||||
&pos[i].x_offset,
|
&pos[i].x_offset,
|
||||||
|
|
Loading…
Reference in New Issue