[glyf/VarComposite] Set coordinates

Code is untested but complete!
This commit is contained in:
Behdad Esfahbod 2022-10-17 13:05:22 -06:00
parent 4ec7781497
commit 7efd68da39
2 changed files with 18 additions and 1 deletions

View File

@ -356,7 +356,8 @@ struct Glyph
comp_points.reset ();
/* XXX Apply variations. */
coord_setter_t coord_setter (font);
item.set_coordinates (coord_setter, record_points);
if (unlikely (!glyf_accelerator.glyph_for_gid (item.get_gid ())
.get_points (font, glyf_accelerator, comp_points,

View File

@ -226,6 +226,22 @@ struct VarCompositeGlyphRecord
translate (matrix, trans, -tCenterX, -tCenterY);
}
void set_coordinates (coord_setter_t &setter,
hb_array_t<contour_point_t> axis_points) const
{
unsigned axis_width = (flags & AXIS_INDICES_ARE_SHORT) ? 2 : 1;
const HBUINT8 *p = &StructAfter<const HBUINT8> (num_axes);
const HBUINT16 *q = &StructAfter<const HBUINT16> (num_axes);
unsigned count = num_axes;
for (unsigned i = 0; i < count; i++)
{
unsigned axis_index = axis_width == 1 ? *p++ : *q++;
setter[axis_index] = axis_points[i].x;
}
}
protected:
HBUINT16 flags;
HBGlyphID16 gid;