[font] Fix design-coords

Ouch!
This commit is contained in:
Behdad Esfahbod 2022-07-23 13:25:40 -06:00
parent efab763885
commit 473a5e5651
2 changed files with 9 additions and 1 deletions

View File

@ -2387,6 +2387,10 @@ hb_font_set_variations (hb_font_t *font,
return; return;
} }
/* Initialize design coords to default from fvar. */
for (unsigned int i = 0; i < coords_length; i++)
design_coords[i] = axes[i].get_default ();
for (unsigned int i = 0; i < variations_length; i++) for (unsigned int i = 0; i < variations_length; i++)
{ {
const auto tag = variations[i].tag; const auto tag = variations[i].tag;

View File

@ -135,7 +135,6 @@ struct AxisRecord
return_trace (c->check_struct (this)); return_trace (c->check_struct (this));
} }
protected:
void get_coordinates (float &min, float &default_, float &max) const void get_coordinates (float &min, float &default_, float &max) const
{ {
default_ = defaultValue / 65536.f; default_ = defaultValue / 65536.f;
@ -144,6 +143,11 @@ struct AxisRecord
max = hb_max (default_, maxValue / 65536.f); max = hb_max (default_, maxValue / 65536.f);
} }
float get_default () const
{
return defaultValue / 65536.f;
}
public: public:
Tag axisTag; /* Tag identifying the design variation for the axis. */ Tag axisTag; /* Tag identifying the design variation for the axis. */
protected: protected: