GNOME Bugzilla – Bug 64652
Assertion failure in get_default_font()
Last modified: 2009-08-15 18:40:50 UTC
Hi, The "Missing charsets" message is all very well, but there are other problems highlighted in all three of these bug reports, chiefly the failed assertion. While it says that gdk_fontset_load(DEFAULT_FONT_NAME) never returns 0, it calls XCreateFontSet() which returns NULL if the current locale is not supported, so this assertion is not justified. For example, I added the following line (taken from /usr/share/doc/locales/SUPPORTED.gz) to /etc/locale.gen: en_IE@euro ISO-8859-15 I then ran locale-gen and set LC_ALL=en_IE@euro. As far as I can tell, all applications that use libgnomeui32, including gmc (#108375) and anjuta (#110885) above, now die as soon as they try to use any fonts. Installing xfonts-100dpi-transcoded only helps when I restart the X server, which is probably not going to be clear to a novice user. I think the correct approach is certainly not to call g_assert() when gdk_fontset_load() fails. Rather, I suggest attempting, if possible, to fall back to a locale like C, then, if even that fails (can it?), printing a much more helpful error message that the current failed assertion, such as: There are no X fonts available for your current locale (name of locale here). Please install appropriate fonts and try again. A library used by many end-user applications should make every effort not to fall over ignominiously in this way. Judging from the bugs that I've seen reported so far, it's confusing users and developers alike. Thanks,
So, should we just use gdk_fontset_load() and fallback to gdk_font_load() if that fails? Maybe this change should be done all over the place?
Or maybe gdk_fontset_load should always return a valid font name ?
Wasn't this improved in a recent release?
Yes. Bug closed.