[style] give ptem value when asked for opsz

ptem, used for AAT's tracking/`trak` table is equivalent to opsz of variable fonts.

For variable AAT fonts, such as SFNS, ideally variable axis of the hb_font_t
should be set and equivalent to ptem, https://crbug.com/1005969#c37
This commit is contained in:
Ebrahim Byagowi 2020-02-08 14:09:09 +03:30
parent 22037499b4
commit de0ec5f4fe
2 changed files with 6 additions and 0 deletions

View File

@ -63,6 +63,9 @@ hb_style_get_value (hb_font_t *font, hb_style_tag_t style_tag)
} }
#endif #endif
if (style_tag == HB_STYLE_TAG_OPTICAL_SIZE && font->ptem)
return font->ptem;
/* STAT */ /* STAT */
float value; float value;
if (face->table.STAT->get_value (style_tag, &value)) if (face->table.STAT->get_value (style_tag, &value))

View File

@ -70,6 +70,9 @@ test_face_fdsc (void)
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WIDTH), 100); assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 400); assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 400);
hb_font_set_ptem (font, 36);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_OPTICAL_SIZE), 36);
hb_font_destroy (font); hb_font_destroy (font);
hb_face_destroy (face); hb_face_destroy (face);
} }