changeset 1001:4ef0e878fe06

Added support for Dynamic Windows style font names for GTK3.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 08 May 2011 06:18:41 +0000
parents 99907f19a703
children 0802d6122ec7
files gtk3/dw.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gtk3/dw.c	Sun May 08 03:28:10 2011 +0000
+++ b/gtk3/dw.c	Sun May 08 06:18:41 2011 +0000
@@ -20,6 +20,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <ctype.h>
 #include <errno.h>
 #include <sys/time.h>
 #include <dirent.h>
@@ -2509,7 +2510,8 @@
 {
    PangoFontDescription *pfont;
    GtkWidget *handle2 = handle;
-   char *font;
+   char *font = strdup(fontname);
+   char *name = strchr(font, '.');
    int _locked_by_me = FALSE;
    gpointer data;
 
@@ -2520,7 +2522,18 @@
       if(tmp)
          handle2 = tmp;
    }
-   font = strdup(fontname);
+   
+   /* Detect Dynamic Windows style font name... 
+    * Format: ##.Fontname
+    * and convert to a Pango name
+    */
+   if(name && isdigit(*font))
+   {
+       int size = atoi(font);
+       *name = 0;
+       name++;
+       sprintf(font, "%s %d", name, size);
+   }
 
    /* Free old font name if one is allocated */
    data = g_object_get_data(G_OBJECT(handle2), "_dw_fontname");