[gedit] gedit-pango.c: Quote font-family CSS string



commit 69a076892102d6ddad0db171e13e6feddc65f2cd
Author: lxylxy123456 <13691419520 163 com>
Date:   Fri May 7 23:16:00 2021 -0700

    gedit-pango.c: Quote font-family CSS string
    
    Currently the css string generated by
    gedit_pango_font_description_to_css() does not quote the font-family
    string. If the font family name contains space, gtk may fail to parse
    the css string correctly (e.g. "Courier 10 Pitch").
    
    To fix this issue, simly add double quotes to the font name. This fix
    should work for font names that do not contain special character (e.g.
    quotation marks, backslashes, etc.)
    
    https://gitlab.gnome.org/GNOME/gedit/-/issues/435

 gedit/gedit-pango.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gedit/gedit-pango.c b/gedit/gedit-pango.c
index 0488bbcd2..85b44fe99 100644
--- a/gedit/gedit-pango.c
+++ b/gedit/gedit-pango.c
@@ -102,9 +102,9 @@ gedit_pango_font_description_to_css (const PangoFontDescription *desc)
   set = pango_font_description_get_set_fields (desc);
   if (set & PANGO_FONT_MASK_FAMILY)
     {
-      g_string_append (s, "font-family: ");
+      g_string_append (s, "font-family: \"");
       g_string_append (s, pango_font_description_get_family (desc));
-      g_string_append (s, "; ");
+      g_string_append (s, "\"; ");
     }
   if (set & PANGO_FONT_MASK_STYLE)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]