[optical-bounds] Optimize
This commit is contained in:
parent
5d6f1a88e4
commit
4bf9621113
|
@ -81,13 +81,20 @@ struct SinglePosFormat1
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
position_single (hb_ot_apply_context_t *c,
|
position_single (hb_font_t *font,
|
||||||
hb_codepoint_t gid,
|
hb_direction_t direction,
|
||||||
hb_glyph_position_t &pos) const
|
hb_codepoint_t gid,
|
||||||
|
hb_glyph_position_t &pos) const
|
||||||
{
|
{
|
||||||
unsigned int index = (this+coverage).get_coverage (gid);
|
unsigned int index = (this+coverage).get_coverage (gid);
|
||||||
if (likely (index == NOT_COVERED)) return false;
|
if (likely (index == NOT_COVERED)) return false;
|
||||||
valueFormat.apply_value (c, this, values, pos);
|
|
||||||
|
/* This is ugly... */
|
||||||
|
hb_buffer_t buffer;
|
||||||
|
buffer.props.direction = direction;
|
||||||
|
OT::hb_ot_apply_context_t c (1, font, &buffer);
|
||||||
|
|
||||||
|
valueFormat.apply_value (&c, this, values, pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,14 +93,21 @@ struct SinglePosFormat2
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
position_single (hb_ot_apply_context_t *c,
|
position_single (hb_font_t *font,
|
||||||
hb_codepoint_t gid,
|
hb_direction_t direction,
|
||||||
hb_glyph_position_t &pos) const
|
hb_codepoint_t gid,
|
||||||
|
hb_glyph_position_t &pos) const
|
||||||
{
|
{
|
||||||
unsigned int index = (this+coverage).get_coverage (gid);
|
unsigned int index = (this+coverage).get_coverage (gid);
|
||||||
if (likely (index == NOT_COVERED)) return false;
|
if (likely (index == NOT_COVERED)) return false;
|
||||||
if (unlikely (index >= valueCount)) return false;
|
if (unlikely (index >= valueCount)) return false;
|
||||||
valueFormat.apply_value (c, this,
|
|
||||||
|
/* This is ugly... */
|
||||||
|
hb_buffer_t buffer;
|
||||||
|
buffer.props.direction = direction;
|
||||||
|
OT::hb_ot_apply_context_t c (1, font, &buffer);
|
||||||
|
|
||||||
|
valueFormat.apply_value (&c, this,
|
||||||
&values[index * valueFormat.get_len ()],
|
&values[index * valueFormat.get_len ()],
|
||||||
pos);
|
pos);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1735,14 +1735,10 @@ hb_ot_layout_get_optical_bound (hb_font_t *font,
|
||||||
hb_direction_t direction,
|
hb_direction_t direction,
|
||||||
hb_codepoint_t glyph)
|
hb_codepoint_t glyph)
|
||||||
{
|
{
|
||||||
/* This is ugly... */
|
|
||||||
hb_buffer_t buffer;
|
|
||||||
buffer.props.direction = direction;
|
|
||||||
OT::hb_ot_apply_context_t c_apply (1, font, &buffer);
|
|
||||||
const OT::PosLookup &lookup = font->face->table.GPOS->table->get_lookup (lookup_index);
|
const OT::PosLookup &lookup = font->face->table.GPOS->table->get_lookup (lookup_index);
|
||||||
hb_glyph_position_t pos = {0};
|
hb_glyph_position_t pos = {0};
|
||||||
hb_position_single_dispatch_t c;
|
hb_position_single_dispatch_t c;
|
||||||
lookup.dispatch (&c, &c_apply, glyph, pos);
|
lookup.dispatch (&c, font, direction, glyph, pos);
|
||||||
hb_position_t ret = 0;
|
hb_position_t ret = 0;
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue