From 88ab72ed2f92cd1bf70ca7b720723329fdca7945 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 27 Nov 2021 09:14:12 -0500 Subject: 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. --- pango/fonts.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pango/fonts.c') 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); -- cgit v1.2.1