diff --git a/src/hb-ot-stat-table.hh b/src/hb-ot-stat-table.hh index 58b3cd74d..c6c2b7511 100644 --- a/src/hb-ot-stat-table.hh +++ b/src/hb-ot-stat-table.hh @@ -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> 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) diff --git a/test/api/fonts/NotoSans-Bold.ttf b/test/api/fonts/NotoSans-Bold.ttf new file mode 100644 index 000000000..d84248ed1 Binary files /dev/null and b/test/api/fonts/NotoSans-Bold.ttf differ diff --git a/test/api/test-style.c b/test/api/test-style.c index 27b135f99..647848362 100644 --- a/test/api/test-style.c +++ b/test/api/test-style.c @@ -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);