After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 64652 - Assertion failure in get_default_font()
Assertion failure in get_default_font()
Status: VERIFIED INCOMPLETE
Product: gnome-libs
Classification: Deprecated
Component: libgnomeui
1.4.x
Other Linux
: Normal major
: 1.4.1
Assigned To: gnome-libs Maintainers
gnome-libs Maintainers
Depends on:
Blocks:
 
 
Reported: 2001-11-15 22:21 UTC by Christian Marillat
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Marillat 2001-11-15 22:21:02 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,
Comment 1 Kjartan Maraas 2002-01-25 15:13:33 UTC
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?
Comment 2 Christian Marillat 2002-01-25 15:17:35 UTC
Or maybe gdk_fontset_load should always return a valid font name ?
Comment 3 Kjartan Maraas 2002-07-12 10:29:41 UTC
Wasn't this improved in a recent release?
Comment 4 Christian Marillat 2002-07-12 12:03:21 UTC
Yes. Bug closed.