diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-06-16 06:56:15 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-06-22 13:57:26 -0400 |
commit | 1bcf743b9e9aab8e0a085fdb415fb379423861ed (patch) | |
tree | 4907891f1f7b1f8b5ff94ca7097be73a2d4e75a3 | |
parent | 2421cf7deec6c898a418eebc99e49c42ee2a4d15 (diff) | |
download | pango-1bcf743b9e9aab8e0a085fdb415fb379423861ed.tar.gz |
Allow variant information in face descriptions
This is needed to fix small-caps roundtrips on MacOS.
-rw-r--r-- | pango/pango-fontmap.c | 3 | ||||
-rw-r--r-- | pango/pango-hbface.c | 5 | ||||
-rw-r--r-- | tests/testhbfont.c | 5 |
3 files changed, 7 insertions, 6 deletions
diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c index 99fbae64..fbcd4c86 100644 --- a/pango/pango-fontmap.c +++ b/pango/pango-fontmap.c @@ -874,8 +874,7 @@ pango_font_map_add_face (PangoFontMap *self, description = face->description; - if (pango_font_description_get_set_fields (description) & - (PANGO_FONT_MASK_VARIANT | PANGO_FONT_MASK_GRAVITY)) + if (pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_GRAVITY) g_warning ("Font description for PangoFontFace includes things that it shouldn't"); if (!self->in_populate) diff --git a/pango/pango-hbface.c b/pango/pango-hbface.c index 90459aa3..adee83f4 100644 --- a/pango/pango-hbface.c +++ b/pango/pango-hbface.c @@ -177,7 +177,6 @@ set_name_and_description (PangoHbFace *self, */ face->description = pango_font_description_from_string (fullname); pango_font_description_unset_fields (face->description, - PANGO_FONT_MASK_VARIANT | PANGO_FONT_MASK_VARIATIONS | PANGO_FONT_MASK_GRAVITY); @@ -704,9 +703,7 @@ pango_hb_face_new_from_hb_face (hb_face_t *face, g_return_val_if_fail (instance_id >= -2, NULL); g_return_val_if_fail (description == NULL || (pango_font_description_get_set_fields (description) & - (PANGO_FONT_MASK_VARIANT| - PANGO_FONT_MASK_SIZE| - PANGO_FONT_MASK_GRAVITY)) == 0, NULL); + (PANGO_FONT_MASK_SIZE|PANGO_FONT_MASK_GRAVITY)) == 0, NULL); self = g_object_new (PANGO_TYPE_HB_FACE, NULL); diff --git a/tests/testhbfont.c b/tests/testhbfont.c index ece94561..626877c2 100644 --- a/tests/testhbfont.c +++ b/tests/testhbfont.c @@ -82,6 +82,7 @@ test_hbface_roundtrip (void) desc = pango_font_face_describe (PANGO_FONT_FACE (face)); g_assert_cmpint (pango_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_STYLE | + PANGO_FONT_MASK_VARIANT | PANGO_FONT_MASK_WEIGHT | PANGO_FONT_MASK_STRETCH); g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarell"); @@ -100,6 +101,7 @@ test_hbface_roundtrip (void) desc = pango_font_face_describe (PANGO_FONT_FACE (face2)); g_assert_cmpint (pango_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_STYLE | + PANGO_FONT_MASK_VARIANT | PANGO_FONT_MASK_WEIGHT | PANGO_FONT_MASK_STRETCH); g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarell"); @@ -119,6 +121,7 @@ test_hbface_roundtrip (void) desc = pango_font_face_describe (PANGO_FONT_FACE (face2)); g_assert_cmpint (pango_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_STYLE | + PANGO_FONT_MASK_VARIANT | PANGO_FONT_MASK_WEIGHT | PANGO_FONT_MASK_STRETCH); g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarell"); @@ -138,6 +141,7 @@ test_hbface_roundtrip (void) desc = pango_font_face_describe (PANGO_FONT_FACE (face2)); g_assert_cmpint (pango_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_STYLE | + PANGO_FONT_MASK_VARIANT | PANGO_FONT_MASK_WEIGHT | PANGO_FONT_MASK_STRETCH); g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarellagain"); @@ -163,6 +167,7 @@ test_hbface_roundtrip (void) g_assert_cmpint (pango_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_STYLE | PANGO_FONT_MASK_WEIGHT | + PANGO_FONT_MASK_VARIANT | PANGO_FONT_MASK_VARIATIONS | PANGO_FONT_MASK_STRETCH); g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cat"); |