diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-11-27 09:14:12 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-11-27 10:10:04 -0500 |
commit | 88ab72ed2f92cd1bf70ca7b720723329fdca7945 (patch) | |
tree | cbcedacbb3ef4c3a0c85f5e11edf5c4df7435404 /pango | |
parent | ac2bf585e04c49be419f44a97c4ef0de0fd21014 (diff) | |
download | pango-88ab72ed2f92cd1bf70ca7b720723329fdca7945.tar.gz |
font: Avoid cosmetic ugliness
When setting variations to "", font descriptions
would add an ugly useless " @" at the end of their
serialization. Avoid that.
Test included.
Diffstat (limited to 'pango')
-rw-r--r-- | pango/fonts.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pango/fonts.c b/pango/fonts.c index d94feaf8..129e84d3 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -546,7 +546,7 @@ pango_font_description_set_variations_static (PangoFontDescription *desc, /** * pango_font_description_set_variations: * @desc: a `PangoFontDescription`. - * @variations: a string representing the variations + * @variations: (nullable): a string representing the variations * * Sets the variations field of a font description. * @@ -1492,7 +1492,8 @@ pango_font_description_to_string (const PangoFontDescription *desc) g_string_append (result, "px"); } - if (desc->variations && desc->mask & PANGO_FONT_MASK_VARIATIONS) + if ((desc->variations && desc->mask & PANGO_FONT_MASK_VARIATIONS) && + desc->variations[0] != '\0') { g_string_append (result, " @"); g_string_append (result, desc->variations); |