From 8fba9945e01aec2e0d58bdbe99c84b4390decabf Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Mon, 20 Mar 2017 01:09:55 -0400 Subject: [PATCH] WPrefs: Properly read system fonts in font configuration panel. Previously, only the user's WMGLOBAL file would be read to determine the current WINGs fonts (System Font and Bold System Font) in the Font Configuration panel. It is quite possible that this information would not be in the user's WMGLOBAL file, but instead in the system WMGLOBAL file. We instead use the WMDefaultSystemFont and WMBoldDefaultSystemFont functions to get this information. --- WPrefs.app/FontSimple.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/WPrefs.app/FontSimple.c b/WPrefs.app/FontSimple.c index 2262e581..b545fd14 100644 --- a/WPrefs.app/FontSimple.c +++ b/WPrefs.app/FontSimple.c @@ -569,6 +569,9 @@ static void showData(_Panel * panel) { int i; WMMenuItem *item; + WMScreen *scr; + + scr = WMWidgetScreen(panel->parent); for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->optionP); i++) { char *ofont, *font; @@ -579,19 +582,12 @@ static void showData(_Panel * panel) if (ofont) wfree(ofont); - if (strcmp(fontOptions[i].option, "SystemFont") == 0 || - strcmp(fontOptions[i].option, "BoldSystemFont") == 0) { - char *path; - WMUserDefaults *defaults; - - path = wdefaultspathfordomain("WMGLOBAL"); - defaults = WMGetDefaultsFromPath(path); - wfree(path); - font = WMGetUDStringForKey(defaults, - fontOptions[i].option); - } else { + if (strcmp(fontOptions[i].option, "SystemFont") == 0) + font = WMGetFontName(WMDefaultSystemFont(scr)); + else if (strcmp(fontOptions[i].option, "BoldSystemFont") == 0) + font = WMGetFontName(WMDefaultBoldSystemFont(scr)); + else font = GetStringForKey(fontOptions[i].option); - } if (font) font = wstrdup(font); WMSetMenuItemRepresentedObject(item, font);