[hb-style] Fix synthetic slant values
When reporting the slant ratio of a font that has synthetic slant set, we were reporting twice the expected value. Fix that. Test included.
This commit is contained in:
parent
56f11ec938
commit
e76061a737
|
@ -72,8 +72,7 @@ float
|
||||||
hb_style_get_value (hb_font_t *font, hb_style_tag_t style_tag)
|
hb_style_get_value (hb_font_t *font, hb_style_tag_t style_tag)
|
||||||
{
|
{
|
||||||
if (unlikely (style_tag == HB_STYLE_TAG_SLANT_RATIO))
|
if (unlikely (style_tag == HB_STYLE_TAG_SLANT_RATIO))
|
||||||
return _hb_angle_to_ratio (hb_style_get_value (font, HB_STYLE_TAG_SLANT_ANGLE))
|
return _hb_angle_to_ratio (hb_style_get_value (font, HB_STYLE_TAG_SLANT_ANGLE));
|
||||||
+ font->slant;
|
|
||||||
|
|
||||||
hb_face_t *face = font->face;
|
hb_face_t *face = font->face;
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,22 @@ test_face_user_setting (void)
|
||||||
hb_face_destroy (face);
|
hb_face_destroy (face);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_synthetic_slant (void)
|
||||||
|
{
|
||||||
|
hb_face_t *face = hb_test_open_font_file ("fonts/AdobeVFPrototype_vsindex.otf");
|
||||||
|
hb_font_t *font = hb_font_create (face);
|
||||||
|
|
||||||
|
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT_RATIO), 0);
|
||||||
|
|
||||||
|
hb_font_set_synthetic_slant (font, 0.2);
|
||||||
|
|
||||||
|
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT_RATIO), 0.2);
|
||||||
|
|
||||||
|
hb_font_destroy (font);
|
||||||
|
hb_face_destroy (face);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -155,6 +171,7 @@ main (int argc, char **argv)
|
||||||
hb_test_add (test_empty_face);
|
hb_test_add (test_empty_face);
|
||||||
hb_test_add (test_regular_face);
|
hb_test_add (test_regular_face);
|
||||||
hb_test_add (test_face_user_setting);
|
hb_test_add (test_face_user_setting);
|
||||||
|
hb_test_add (test_synthetic_slant);
|
||||||
|
|
||||||
return hb_test_run ();
|
return hb_test_run ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue