[gvar] Make sure font's num_coords matches with gvar.axisCount
This commit is contained in:
parent
1af3363f9e
commit
9004848560
|
@ -739,7 +739,7 @@ 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, points.as_array ())))
|
if (unlikely (!face->table.gvar->apply_deltas_to_points (gid, font, points.as_array ())))
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -541,12 +541,11 @@ struct gvar
|
||||||
{ return (i >= end) ? start : (i + 1); }
|
{ return (i >= end) ? start : (i + 1); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool apply_deltas_to_points (hb_codepoint_t glyph,
|
bool apply_deltas_to_points (hb_codepoint_t glyph, hb_font_t *font,
|
||||||
const int *coords, unsigned int coord_count,
|
|
||||||
const hb_array_t<contour_point_t> points) const
|
const hb_array_t<contour_point_t> points) const
|
||||||
{
|
{
|
||||||
coord_count = hb_min (coord_count, gvar_table->axisCount);
|
/* num_coords should exactly match gvar's axisCount due to how GlyphVarData tuples are aligned */
|
||||||
if (!coord_count || coord_count != gvar_table->axisCount) return true;
|
if (!font->num_coords || font->num_coords != gvar_table->axisCount) return true;
|
||||||
|
|
||||||
hb_bytes_t var_data_bytes = gvar_table->get_glyph_var_data_bytes (gvar_table.get_blob (), glyph);
|
hb_bytes_t var_data_bytes = gvar_table->get_glyph_var_data_bytes (gvar_table.get_blob (), glyph);
|
||||||
if (!var_data_bytes.as<GlyphVarData> ()->has_data ()) return true;
|
if (!var_data_bytes.as<GlyphVarData> ()->has_data ()) return true;
|
||||||
|
@ -570,9 +569,11 @@ struct gvar
|
||||||
if (points[i].is_end_point)
|
if (points[i].is_end_point)
|
||||||
end_points.push (i);
|
end_points.push (i);
|
||||||
|
|
||||||
|
int *coords = font->coords;
|
||||||
|
unsigned num_coords = font->num_coords;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
float scalar = iterator.current_tuple->calculate_scalar (coords, coord_count, shared_tuples.as_array ());
|
float scalar = iterator.current_tuple->calculate_scalar (coords, num_coords, shared_tuples.as_array ());
|
||||||
if (scalar == 0.f) continue;
|
if (scalar == 0.f) continue;
|
||||||
const HBUINT8 *p = iterator.get_serialized_data ();
|
const HBUINT8 *p = iterator.get_serialized_data ();
|
||||||
unsigned int length = iterator.current_tuple->get_data_size ();
|
unsigned int length = iterator.current_tuple->get_data_size ();
|
||||||
|
|
Loading…
Reference in New Issue