# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1611738945 0 # Node ID cb24daa675a2cc5f2d8c9ade8475061acf92ab20 # Parent 5f1677cc32e9ea6d5bb5c2feead0c6876b51df03 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. diff -r 5f1677cc32e9 -r cb24daa675a2 dwtest.c --- a/dwtest.c Wed Jan 27 01:27:46 2021 +0000 +++ b/dwtest.c Wed Jan 27 09:15:45 2021 +0000 @@ -1399,6 +1399,10 @@ dw_listbox_append(fontname, "Helvetica"); dw_listbox_append(fontname, "DejaVu Sans"); dw_listbox_append(fontname, "New Times Roman"); + dw_listbox_append(fontname, "New Times Roman Bold"); + dw_listbox_append(fontname, "New Times Roman Italic"); + dw_listbox_append(fontname, "New Times Roman Italic Bold"); + dw_listbox_append(fontname, "New Times Roman Bold Italic"); dw_box_pack_start(hbox, fontname, 150, -1, TRUE, FALSE, 1); dw_box_pack_start(notebookbox4, hbox, -1, -1, TRUE, FALSE, 1); diff -r 5f1677cc32e9 -r cb24daa675a2 gtk3/dw.c --- 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