Fixed some errors in STAT table implementation

This commit is contained in:
Christer Sandberg authored and Behdad Esfahbod committed 2024-02-10 07:08:18 -07:00
1 parent 031fdb1c8b
commit 1ab8822b41
3 files changed
+20 -2

No files matched your search

+2 -2
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.
+18
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);