Mercurial > dwindows
diff gtk3/dw.c @ 2260:cb24daa675a2
GTK3: Hopefully the last commit of the CSS font code changes.
Clean up the code, so the CSS doesn't have any extra text or spaces.
Also add some fonts with combinations of Italic and Bold for testing.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 27 Jan 2021 09:15:45 +0000 |
parents | 5f1677cc32e9 |
children | 3361ce6070ce |
line wrap: on
line diff
--- a/gtk3/dw.c Wed Jan 27 01:27:46 2021 +0000 +++ b/gtk3/dw.c Wed Jan 27 09:15:45 2021 +0000 @@ -2710,8 +2710,14 @@ { int size = atoi(font); #if GTK_CHECK_VERSION(3,20,0) - newfont = g_strdup_printf("%s normal %s %dpx \"%s\"", Italic ? "italic " : "normal", - Bold ? "bold " : "normal", size, name); + int len = (Italic ? (Bold ? (Italic > Bold ? (Bold - name) : (Italic - name)) : (Italic - name)) : (Bold ? (Bold - name) : strlen(name))); + char *newname = alloca(len+1); + + memset(newname, 0, len+1); + strncpy(newname, name, len); + + newfont = g_strdup_printf("%s normal %s %dpx \"%s\"", Italic ? "italic" : "normal", + Bold ? "bold" : "normal", size, newname); #else newfont = g_strdup_printf("%s %d", name, size); #endif