Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
2259:5f1677cc32e9 | 2260:cb24daa675a2 |
---|---|
2708 */ | 2708 */ |
2709 if(name && (name++) && isdigit(*font)) | 2709 if(name && (name++) && isdigit(*font)) |
2710 { | 2710 { |
2711 int size = atoi(font); | 2711 int size = atoi(font); |
2712 #if GTK_CHECK_VERSION(3,20,0) | 2712 #if GTK_CHECK_VERSION(3,20,0) |
2713 newfont = g_strdup_printf("%s normal %s %dpx \"%s\"", Italic ? "italic " : "normal", | 2713 int len = (Italic ? (Bold ? (Italic > Bold ? (Bold - name) : (Italic - name)) : (Italic - name)) : (Bold ? (Bold - name) : strlen(name))); |
2714 Bold ? "bold " : "normal", size, name); | 2714 char *newname = alloca(len+1); |
2715 | |
2716 memset(newname, 0, len+1); | |
2717 strncpy(newname, name, len); | |
2718 | |
2719 newfont = g_strdup_printf("%s normal %s %dpx \"%s\"", Italic ? "italic" : "normal", | |
2720 Bold ? "bold" : "normal", size, newname); | |
2715 #else | 2721 #else |
2716 newfont = g_strdup_printf("%s %d", name, size); | 2722 newfont = g_strdup_printf("%s %d", name, size); |
2717 #endif | 2723 #endif |
2718 } | 2724 } |
2719 } | 2725 } |