]> Pileus Git - ~andy/gtk/commitdiff
On Win32, expand possible hex escapes in the font family (put there by
authorTor Lillqvist <tml@iki.fi>
Thu, 30 Sep 1999 16:59:08 +0000 (16:59 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 30 Sep 1999 16:59:08 +0000 (16:59 +0000)
1999-09-30  Tor Lillqvist  <tml@iki.fi>

* gtk/gtkfontsel.c (gtk_font_selection_get_xlfd_field): On Win32,
expand possible hex escapes in the font family (put there by
logfont_to_xlfd if the font name isn't a legal XLFD font family,
mainly if it contains slashes). (gtk_font_selection_create_xlfd):
On Win32, add hex escapes here, too.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfontsel.c

index b3f9672df11aa90252d0febce0675e8d860cce01..ad1ef656bcbfbbaa5e1fcd3d28b65e372fca4af1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+1999-09-30  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfontsel.c (gtk_font_selection_get_xlfd_field): On Win32,
+       expand possible hex escapes in the font family (put there by
+       logfont_to_xlfd if the font name isn't a legal XLFD font family,
+       mainly if it contains slashes). (gtk_font_selection_create_xlfd):
+       On Win32, add hex escapes here, too.
+
 Wed Sep 29 19:55:35 1999  Owen Taylor  <otaylor@redhat.com>
 
        * */*.[ch]: Changed from #if GDK_WINDOWING == GDK_WINDOWING_X11
index b3f9672df11aa90252d0febce0675e8d860cce01..ad1ef656bcbfbbaa5e1fcd3d28b65e372fca4af1 100644 (file)
@@ -1,3 +1,11 @@
+1999-09-30  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfontsel.c (gtk_font_selection_get_xlfd_field): On Win32,
+       expand possible hex escapes in the font family (put there by
+       logfont_to_xlfd if the font name isn't a legal XLFD font family,
+       mainly if it contains slashes). (gtk_font_selection_create_xlfd):
+       On Win32, add hex escapes here, too.
+
 Wed Sep 29 19:55:35 1999  Owen Taylor  <otaylor@redhat.com>
 
        * */*.[ch]: Changed from #if GDK_WINDOWING == GDK_WINDOWING_X11
index b3f9672df11aa90252d0febce0675e8d860cce01..ad1ef656bcbfbbaa5e1fcd3d28b65e372fca4af1 100644 (file)
@@ -1,3 +1,11 @@
+1999-09-30  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfontsel.c (gtk_font_selection_get_xlfd_field): On Win32,
+       expand possible hex escapes in the font family (put there by
+       logfont_to_xlfd if the font name isn't a legal XLFD font family,
+       mainly if it contains slashes). (gtk_font_selection_create_xlfd):
+       On Win32, add hex escapes here, too.
+
 Wed Sep 29 19:55:35 1999  Owen Taylor  <otaylor@redhat.com>
 
        * */*.[ch]: Changed from #if GDK_WINDOWING == GDK_WINDOWING_X11
index b3f9672df11aa90252d0febce0675e8d860cce01..ad1ef656bcbfbbaa5e1fcd3d28b65e372fca4af1 100644 (file)
@@ -1,3 +1,11 @@
+1999-09-30  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfontsel.c (gtk_font_selection_get_xlfd_field): On Win32,
+       expand possible hex escapes in the font family (put there by
+       logfont_to_xlfd if the font name isn't a legal XLFD font family,
+       mainly if it contains slashes). (gtk_font_selection_create_xlfd):
+       On Win32, add hex escapes here, too.
+
 Wed Sep 29 19:55:35 1999  Owen Taylor  <otaylor@redhat.com>
 
        * */*.[ch]: Changed from #if GDK_WINDOWING == GDK_WINDOWING_X11
index b3f9672df11aa90252d0febce0675e8d860cce01..ad1ef656bcbfbbaa5e1fcd3d28b65e372fca4af1 100644 (file)
@@ -1,3 +1,11 @@
+1999-09-30  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfontsel.c (gtk_font_selection_get_xlfd_field): On Win32,
+       expand possible hex escapes in the font family (put there by
+       logfont_to_xlfd if the font name isn't a legal XLFD font family,
+       mainly if it contains slashes). (gtk_font_selection_create_xlfd):
+       On Win32, add hex escapes here, too.
+
 Wed Sep 29 19:55:35 1999  Owen Taylor  <otaylor@redhat.com>
 
        * */*.[ch]: Changed from #if GDK_WINDOWING == GDK_WINDOWING_X11
index b3f9672df11aa90252d0febce0675e8d860cce01..ad1ef656bcbfbbaa5e1fcd3d28b65e372fca4af1 100644 (file)
@@ -1,3 +1,11 @@
+1999-09-30  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfontsel.c (gtk_font_selection_get_xlfd_field): On Win32,
+       expand possible hex escapes in the font family (put there by
+       logfont_to_xlfd if the font name isn't a legal XLFD font family,
+       mainly if it contains slashes). (gtk_font_selection_create_xlfd):
+       On Win32, add hex escapes here, too.
+
 Wed Sep 29 19:55:35 1999  Owen Taylor  <otaylor@redhat.com>
 
        * */*.[ch]: Changed from #if GDK_WINDOWING == GDK_WINDOWING_X11
index b3f9672df11aa90252d0febce0675e8d860cce01..ad1ef656bcbfbbaa5e1fcd3d28b65e372fca4af1 100644 (file)
@@ -1,3 +1,11 @@
+1999-09-30  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfontsel.c (gtk_font_selection_get_xlfd_field): On Win32,
+       expand possible hex escapes in the font family (put there by
+       logfont_to_xlfd if the font name isn't a legal XLFD font family,
+       mainly if it contains slashes). (gtk_font_selection_create_xlfd):
+       On Win32, add hex escapes here, too.
+
 Wed Sep 29 19:55:35 1999  Owen Taylor  <otaylor@redhat.com>
 
        * */*.[ch]: Changed from #if GDK_WINDOWING == GDK_WINDOWING_X11
index 9fbf0678707a58aa9f61f0fd3f73cb2810de33b8..1171c6eb1a09937a448540c87fe14eeade7f3f87 100644 (file)
@@ -2666,7 +2666,8 @@ logfont_to_xlfd (const LOGFONT *lfp,
   int point_size;
   static int logpixelsy = 0;
   gchar facename[LF_FACESIZE*3];
-  gchar *p, *q;
+  gchar *p;
+  const gchar *q;
 
   if (logpixelsy == 0)
     {
@@ -3575,6 +3576,9 @@ gtk_font_selection_get_xlfd_field (const gchar *fontname,
 {
   const gchar *t1, *t2;
   gint countdown, len, num_dashes;
+#ifdef GDK_WINDOWING_WIN32
+  gchar *p;
+#endif
   
   if (!fontname)
     return NULL;
@@ -3605,6 +3609,23 @@ gtk_font_selection_get_xlfd_field (const gchar *fontname,
 #ifdef GDK_WINDOWING_X11
       /* Convert to lower case. */
       g_strdown (buffer);
+#elif defined (GDK_WINDOWING_WIN32)
+      /* Check for hex escapes in font family */
+      if (field_num == XLFD_FAMILY)
+       {
+         p = buffer;
+         while (*p)
+           {
+             if (*p == '%' && isxdigit (p[1]) && isxdigit (p[2]))
+               {
+                 guint c;
+                 sscanf (p+1, "%2x", &c);
+                 *p = c;
+                 strcpy (p+1, p+3);
+               }
+             p++;
+           }
+       }
 #endif
     }
   else
@@ -3630,7 +3651,11 @@ gtk_font_selection_create_xlfd (gint               size,
 {
   gchar buffer[16];
   gchar *pixel_size = "*", *point_size = "*", *fontname;
-  
+  gchar *fam = family;
+#ifdef GDK_WINDOWING_WIN32 
+  gchar *p, *q;
+#endif
+
   if (size <= 0)
     return NULL;
   
@@ -3640,10 +3665,27 @@ gtk_font_selection_create_xlfd (gint              size,
   else
     point_size = buffer;
   
+#ifdef GDK_WINDOWING_WIN32
+  fam = g_malloc (strlen (family) * 3 + 1);
+  p = fam;
+  q = family;
+  while (*q)
+    {
+      if (*q == '-' || *q == '*' || *q == '?' || *q == '%')
+       p += sprintf (p, "%%%.02x", *q);
+      else
+       *p++ = *q;
+      q++;
+    }
+  *p = '\0';
+#endif
   fontname = g_strdup_printf ("-%s-%s-%s-%s-%s-*-%s-%s-*-*-%s-*-%s",
-                             foundry, family, weight, slant,
+                             foundry, fam, weight, slant,
                              set_width, pixel_size, point_size,
                              spacing, charset);
+#ifdef GDK_WINDOWING_WIN32
+  g_free (fam);
+#endif
   return fontname;
 }