Fixed some errors in STAT table implementation

This commit is contained in:
Christer Sandberg 2024-02-09 17:24:49 +01:00 committed by Behdad Esfahbod
parent 031fdb1c8b
commit 1ab8822b41
3 changed files with 20 additions and 2 deletions

View file

@ -349,7 +349,7 @@ struct AxisValueFormat4
struct AxisValue
{
bool get_value (unsigned int axis_index) const
float get_value (unsigned int axis_index) const
{
switch (u.format)
{
@ -485,7 +485,7 @@ struct STAT
hb_array_t<const Offset16To<AxisValue>> axis_values = get_axis_value_offsets ();
for (unsigned int i = 0; i < axis_values.length; i++)
{
const AxisValue& axis_value = this+axis_values[i];
const AxisValue& axis_value = this+offsetToAxisValueOffsets+axis_values[i];
if (axis_value.get_axis_index () == axis_index)
{
if (value)

Binary file not shown.

View file

@ -58,6 +58,23 @@ test_regular_face (void)
hb_face_destroy (face);
}
static void
test_bold_face (void)
{
hb_face_t *face = hb_test_open_font_file ("fonts/NotoSans-Bold.ttf");
hb_font_t *font = hb_font_create (face);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT_ANGLE), 0);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 700);
hb_font_destroy (font);
hb_face_destroy (face);
}
static void
test_face_user_setting (void)
{
@ -182,6 +199,7 @@ main (int argc, char **argv)
hb_test_add (test_empty_face);
hb_test_add (test_regular_face);
hb_test_add (test_bold_face);
hb_test_add (test_face_user_setting);
hb_test_add (test_synthetic_slant);