[style] Rename HB_STYLE_TAG_SLANT to HB_STYLE_TAG_SLANT_ANGLE

This commit is contained in:
Behdad Esfahbod 2021-09-09 11:09:46 -06:00
parent a23ce28977
commit 201cbe3c66
2 changed files with 17 additions and 16 deletions

View File

@ -42,7 +42,7 @@
* be interpreted as (fully) italic. * be interpreted as (fully) italic.
* @HB_STYLE_TAG_OPTICAL_SIZE: Used to vary design to suit different text sizes. * @HB_STYLE_TAG_OPTICAL_SIZE: Used to vary design to suit different text sizes.
* Non-zero. Values can be interpreted as text size, in points. * Non-zero. Values can be interpreted as text size, in points.
* @HB_STYLE_TAG_SLANT: Used to vary between upright and slanted text. Values * @HB_STYLE_TAG_SLANT_ANGLE: Used to vary between upright and slanted text. Values
* must be greater than -90 and less than +90. Values can be interpreted as * must be greater than -90 and less than +90. Values can be interpreted as
* the angle, in counter-clockwise degrees, of oblique slant from whatever the * the angle, in counter-clockwise degrees, of oblique slant from whatever the
* designer considers to be upright for that font design. * designer considers to be upright for that font design.
@ -58,10 +58,11 @@
* *
* Since: EXPERIMENTAL * Since: EXPERIMENTAL
**/ **/
typedef enum { typedef enum
{
HB_STYLE_TAG_ITALIC = HB_TAG ('i','t','a','l'), HB_STYLE_TAG_ITALIC = HB_TAG ('i','t','a','l'),
HB_STYLE_TAG_OPTICAL_SIZE = HB_TAG ('o','p','s','z'), HB_STYLE_TAG_OPTICAL_SIZE = HB_TAG ('o','p','s','z'),
HB_STYLE_TAG_SLANT = HB_TAG ('s','l','n','t'), HB_STYLE_TAG_SLANT_ANGLE = HB_TAG ('s','l','n','t'),
HB_STYLE_TAG_WIDTH = HB_TAG ('w','d','t','h'), HB_STYLE_TAG_WIDTH = HB_TAG ('w','d','t','h'),
HB_STYLE_TAG_WEIGHT = HB_TAG ('w','g','h','t'), HB_STYLE_TAG_WEIGHT = HB_TAG ('w','g','h','t'),
@ -119,7 +120,7 @@ hb_style_get_value (hb_font_t *font, hb_tag_t tag)
? design / 10. ? design / 10.
: 12.f; : 12.f;
} }
case HB_STYLE_TAG_SLANT: case HB_STYLE_TAG_SLANT_ANGLE:
return face->table.post->table->italicAngle.to_float (); return face->table.post->table->italicAngle.to_float ();
case HB_STYLE_TAG_WIDTH: case HB_STYLE_TAG_WIDTH:
return face->table.OS2->has_data () return face->table.OS2->has_data ()

View File

@ -33,7 +33,7 @@
#define HB_STYLE_TAG_ITALIC HB_TAG ('i','t','a','l') #define HB_STYLE_TAG_ITALIC HB_TAG ('i','t','a','l')
#define HB_STYLE_TAG_OPTICAL_SIZE HB_TAG ('o','p','s','z') #define HB_STYLE_TAG_OPTICAL_SIZE HB_TAG ('o','p','s','z')
#define HB_STYLE_TAG_SLANT HB_TAG ('s','l','n','t') #define HB_STYLE_TAG_SLANT_ANGLE HB_TAG ('s','l','n','t')
#define HB_STYLE_TAG_WIDTH HB_TAG ('w','d','t','h') #define HB_STYLE_TAG_WIDTH HB_TAG ('w','d','t','h')
#define HB_STYLE_TAG_WEIGHT HB_TAG ('w','g','h','t') #define HB_STYLE_TAG_WEIGHT HB_TAG ('w','g','h','t')
@ -44,7 +44,7 @@ test_empty_face (void)
assert_cmpfloat (hb_style_get_value (empty, HB_STYLE_TAG_ITALIC), 0); assert_cmpfloat (hb_style_get_value (empty, HB_STYLE_TAG_ITALIC), 0);
assert_cmpfloat (hb_style_get_value (empty, HB_STYLE_TAG_OPTICAL_SIZE), 12); assert_cmpfloat (hb_style_get_value (empty, HB_STYLE_TAG_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (empty, HB_STYLE_TAG_SLANT), 0); assert_cmpfloat (hb_style_get_value (empty, HB_STYLE_TAG_SLANT_ANGLE), 0);
assert_cmpfloat (hb_style_get_value (empty, HB_STYLE_TAG_WIDTH), 100); assert_cmpfloat (hb_style_get_value (empty, HB_STYLE_TAG_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (empty, HB_STYLE_TAG_WEIGHT), 400); assert_cmpfloat (hb_style_get_value (empty, HB_STYLE_TAG_WEIGHT), 400);
} }
@ -57,7 +57,7 @@ test_regular_face (void)
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0); 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_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT), 0); 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_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);
@ -73,7 +73,7 @@ test_face_user_setting (void)
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0); 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_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT), 0); 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_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 389.34f); /* its default weight */ assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 389.34f); /* its default weight */
assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0); assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0);
@ -82,7 +82,7 @@ test_face_user_setting (void)
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0); 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_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT), 0); 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_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 200); assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 200);
assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0); assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0);
@ -91,7 +91,7 @@ test_face_user_setting (void)
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0); 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_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT), 0); 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_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 300); assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 300);
assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0); assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0);
@ -100,7 +100,7 @@ test_face_user_setting (void)
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0); 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_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT), 0); 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_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);
assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0); assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0);
@ -109,7 +109,7 @@ test_face_user_setting (void)
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0); 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_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT), 0); 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_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT),600); assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT),600);
assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0); assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0);
@ -118,7 +118,7 @@ test_face_user_setting (void)
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0); 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_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT), 0); 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_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 700); assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 700);
assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0); assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0);
@ -127,7 +127,7 @@ test_face_user_setting (void)
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0); 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_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT), 0); 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_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 900); assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 900);
assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0); assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 0);
@ -136,7 +136,7 @@ test_face_user_setting (void)
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0); 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_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT), 0); 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_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 900); assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 900);
assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 50); assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 50);
@ -145,7 +145,7 @@ test_face_user_setting (void)
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0); 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_OPTICAL_SIZE), 12);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT), 0); 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_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 900); assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 900);
assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 100); assert_cmpfloat (hb_style_get_value (font, (hb_style_tag_t) HB_TAG ('C','N','T','R')), 100);