[var] Build end-points array on gvar itself
This commit is contained in:
parent
cb65150fec
commit
60262e4ca9
|
@ -574,7 +574,6 @@ struct glyf
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_contour_points (contour_point_vector_t &points_ /* OUT */,
|
bool get_contour_points (contour_point_vector_t &points_ /* OUT */,
|
||||||
hb_vector_t<unsigned int> &end_points_ /* OUT */,
|
|
||||||
bool phantom_only = false) const
|
bool phantom_only = false) const
|
||||||
{
|
{
|
||||||
const HBUINT16 *endPtsOfContours = &StructAfter<HBUINT16> (header);
|
const HBUINT16 *endPtsOfContours = &StructAfter<HBUINT16> (header);
|
||||||
|
@ -586,13 +585,8 @@ struct glyf
|
||||||
for (unsigned int i = 0; i < points_.length; i++) points_[i].init ();
|
for (unsigned int i = 0; i < points_.length; i++) points_[i].init ();
|
||||||
if (phantom_only) return true;
|
if (phantom_only) return true;
|
||||||
|
|
||||||
end_points_.resize (num_contours);
|
|
||||||
|
|
||||||
for (int i = 0; i < num_contours; i++)
|
for (int i = 0; i < num_contours; i++)
|
||||||
{
|
|
||||||
end_points_[i] = endPtsOfContours[i];
|
|
||||||
points_[endPtsOfContours[i]].is_end_point = true;
|
points_[endPtsOfContours[i]].is_end_point = true;
|
||||||
}
|
|
||||||
|
|
||||||
/* Skip instructions */
|
/* Skip instructions */
|
||||||
const HBUINT8 *p = &StructAtOffset<HBUINT8> (&endPtsOfContours[num_contours + 1],
|
const HBUINT8 *p = &StructAtOffset<HBUINT8> (&endPtsOfContours[num_contours + 1],
|
||||||
|
@ -709,7 +703,6 @@ struct glyf
|
||||||
{
|
{
|
||||||
if (unlikely (depth > HB_MAX_NESTING_LEVEL)) return false;
|
if (unlikely (depth > HB_MAX_NESTING_LEVEL)) return false;
|
||||||
contour_point_vector_t points;
|
contour_point_vector_t points;
|
||||||
hb_vector_t<unsigned> end_points;
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case COMPOSITE:
|
case COMPOSITE:
|
||||||
|
@ -722,7 +715,7 @@ struct glyf
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIMPLE:
|
case SIMPLE:
|
||||||
if (unlikely (!SimpleGlyph (*header, bytes).get_contour_points (points, end_points, phantom_only)))
|
if (unlikely (!SimpleGlyph (*header, bytes).get_contour_points (points, phantom_only)))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
default: return false; /* empty glyph */
|
default: return false; /* empty glyph */
|
||||||
|
@ -746,8 +739,8 @@ struct glyf
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HB_NO_VAR
|
#ifndef HB_NO_VAR
|
||||||
if (unlikely (!face->table.gvar->apply_deltas_to_points (gid, font->coords, font->num_coords,
|
if (unlikely (!face->table.gvar->apply_deltas_to_points (gid, font->coords, font->num_coords, points.as_array ())))
|
||||||
points.as_array (), end_points.as_array ()))) return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -546,8 +546,7 @@ struct gvar
|
||||||
public:
|
public:
|
||||||
bool apply_deltas_to_points (hb_codepoint_t glyph,
|
bool apply_deltas_to_points (hb_codepoint_t glyph,
|
||||||
const int *coords, unsigned int coord_count,
|
const int *coords, unsigned int coord_count,
|
||||||
const hb_array_t<contour_point_t> points,
|
const hb_array_t<contour_point_t> points) const
|
||||||
const hb_array_t<unsigned int> end_points) const
|
|
||||||
{
|
{
|
||||||
coord_count = hb_min (coord_count, gvar_table->axisCount);
|
coord_count = hb_min (coord_count, gvar_table->axisCount);
|
||||||
if (!coord_count || coord_count != gvar_table->axisCount) return true;
|
if (!coord_count || coord_count != gvar_table->axisCount) return true;
|
||||||
|
@ -569,6 +568,11 @@ struct gvar
|
||||||
contour_point_vector_t deltas; /* flag is used to indicate referenced point */
|
contour_point_vector_t deltas; /* flag is used to indicate referenced point */
|
||||||
deltas.resize (points.length);
|
deltas.resize (points.length);
|
||||||
|
|
||||||
|
hb_vector_t<unsigned> end_points;
|
||||||
|
for (unsigned i = 0; i < points.length; ++i)
|
||||||
|
if (points[i].is_end_point)
|
||||||
|
end_points.push (i);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
float scalar = iterator.current_tuple->calculate_scalar (coords, coord_count, shared_tuples.as_array ());
|
float scalar = iterator.current_tuple->calculate_scalar (coords, coord_count, shared_tuples.as_array ());
|
||||||
|
|
Loading…
Reference in New Issue