From 2c1eb7cd88d80f5e9897a53da5fb6706d8daa8b8 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Mon, 5 Aug 2013 21:35:32 +0200 Subject: [PATCH] Be more forgiving when XCreateFontSet creates a fontset with missing charsets Especially utf-8 locales list unreasonable amounts of charsets as requirements. When a font can be found that satisfies some, but not all of them, we just use the font and write a warning into the logging. A user who really cares about all those charsets can fix his configuration himself. --- de/fontset.c | 135 ++++++++++++++++++++++++++------------------------- system-autodetect.mk | 7 +-- 2 files changed, 74 insertions(+), 68 deletions(-) diff --git a/de/fontset.c b/de/fontset.c index 108e08d3..b9e84a76 100644 --- a/de/fontset.c +++ b/de/fontset.c @@ -10,6 +10,7 @@ * * However, the code that this file is based on, was taken from: * + * Copyright (c) 2013 - the Notion team * Screen.cc for Blackbox - an X11 Window manager * Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry * Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) @@ -99,70 +100,74 @@ static const char *get_font_size(const char *pattern, int *size) } } - -XFontSet de_create_font_set(const char *fontname) +XFontSet de_create_font_in_current_locale(const char *fontname) { XFontSet fs; char **missing=NULL, *def="-"; - int nmissing, pixel_size=0; - char weight[CF_FONT_ELEMENT_SIZE], slant[CF_FONT_ELEMENT_SIZE]; - const char *nfontname=fontname; - char *pattern2=NULL; + int nmissing=0; int i; LOG(DEBUG, FONT, "Creating fontset for: %s", fontname); fs=XCreateFontSet(ioncore_g.dpy, fontname, &missing, &nmissing, &def); - if(fs && nmissing==0){ - if(missing!=NULL) - XFreeStringList(missing); - LOG(DEBUG, FONT, "Found a font without missing charsets for %s, returning it.", fontname); - return fs; + if(fs){ + if(nmissing==0) + LOG(DEBUG, FONT, "Found a font without missing charsets for %s, returning it.", fontname); + else { + int i; + LOG(INFO, FONT, "Found a font with %d missing charsets for %s:", nmissing, fontname); + for(i=0;i