From 52fc190261c536c86e5e4e7d50bf990d02eba18e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 8 Dec 2008 03:53:12 +0000 Subject: [PATCH] =?utf8?q?Bug=20499624=20=E2=80=93=20Spaces=20around=20com?= =?utf8?q?mas=20in=20PangoFontDescription=20family=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2008-12-07 Behdad Esfahbod Bug 499624 – Spaces around commas in PangoFontDescription family name should be trimmed * pango/fonts.c (pango_font_description_from_string): * pango/pangofc-fontmap.c (pango_fc_make_pattern): Do it in pango_font_description_from_string() instead of pangofc backend. svn path=/trunk/; revision=2753 --- ChangeLog | 10 ++++++++++ pango/fonts.c | 16 ++++++++++++++++ pango/pangofc-fontmap.c | 7 ++----- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc124be..cb16244 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,16 @@ Bug 499624 – Spaces around commas in PangoFontDescription family name should be trimmed + * pango/fonts.c (pango_font_description_from_string): + * pango/pangofc-fontmap.c (pango_fc_make_pattern): + Do it in pango_font_description_from_string() instead of pangofc + backend. + +2008-12-07 Behdad Esfahbod + + Bug 499624 – Spaces around commas in PangoFontDescription family name + should be trimmed + * pango/pangofc-fontmap.c (pango_fc_make_pattern): Trim family strings before adding to pattern. diff --git a/pango/fonts.c b/pango/fonts.c index af71a5e..f5570b2 100644 --- a/pango/fonts.c +++ b/pango/fonts.c @@ -1084,7 +1084,23 @@ pango_font_description_from_string (const char *str) if (str != last) { + int i; + char **families; + desc->family_name = g_strndup (str, last - str); + + /* Now sanitize it to trim space from around individual family names. + * bug #499624 */ + + families = g_strsplit (desc->family_name, ",", -1); + + for (i = 0; families[i]; i++) + g_strstrip (families[i]); + + g_free (desc->family_name); + desc->family_name = g_strjoinv (",", families); + g_strfreev (families); + desc->mask |= PANGO_FONT_MASK_FAMILY; } diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index edda2a3..5c5dbe5 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -845,11 +845,8 @@ pango_fc_make_pattern (const PangoFontDescription *description, families = g_strsplit (pango_font_description_get_family (description), ",", -1); - for (i = 0; families[i]; i++) { - char *family = pango_trim_string (families[i]); - FcPatternAddString (pattern, FC_FAMILY, family); - g_free (family); - } + for (i = 0; families[i]; i++) + FcPatternAddString (pattern, FC_FAMILY, families[i]); g_strfreev (families); -- 2.7.4