warning attack from pango_font_map_load_fontset()



hey owen,

while hacking on a text view markup parser, i switched from
GDK_USE_XFT=1 to =0 and suddenly got lots of warnings
like:

** (tshow:26792): WARNING **: Couldn't load font "mono Italic 10" falling back to "Sans Italic 10"

** (tshow:26792): WARNING **: Couldn't load font "mono 10" falling back to "Sans 10"

** (tshow:26792): WARNING **: Couldn't load font "mono Italic 10" falling back to "Sans Italic 10"

** (tshow:26792): WARNING **: Couldn't load font "mono 10" falling back to "Sans 10"

these are actually issued by pango_font_map_load_fontset(), e.g.:
Program received signal SIGTRAP, Trace/breakpoint trap.
0x403aeed1 in g_logv (log_domain=0x0, log_level=G_LOG_LEVEL_WARNING, 
    format=0x403385c0 "Couldn't load font \"%s\" falling back to \"%s\"", args1=0xbfffec20) at gmessages.c:503
503                     G_BREAKPOINT ();
(gdb) bt
#0  0x403aeed1 in g_logv (log_domain=0x0, log_level=G_LOG_LEVEL_WARNING, 
    format=0x403385c0 "Couldn't load font \"%s\" falling back to \"%s\"", args1=0xbfffec20) at gmessages.c:503
#1  0x403aef89 in g_log (log_domain=0x0, log_level=G_LOG_LEVEL_WARNING, 
    format=0x403385c0 "Couldn't load font \"%s\" falling back to \"%s\"") at gmessages.c:526
#2  0x403294ec in pango_font_map_load_fontset () from /usr/lib/libpango-1.0.so.0
#3  0x403292ef in pango_font_map_load_fontset () from /usr/lib/libpango-1.0.so.0
#4  0x4032859b in pango_itemize () from /usr/lib/libpango-1.0.so.0
#5  0x40327f86 in pango_itemize () from /usr/lib/libpango-1.0.so.0
#6  0x4032da95 in pango_layout_get_pixel_size () from /usr/lib/libpango-1.0.so.0
#7  0x4032c444 in pango_layout_get_cursor_pos () from /usr/lib/libpango-1.0.so.0
#8  0x4032c6a3 in pango_layout_get_extents () from /usr/lib/libpango-1.0.so.0
#9  0x4015d21c in gtk_text_layout_get_line_display (layout=0x809e378, line=0x8092580, size_only=0) at gtktextlayout.c:1949
#10 0x401534ad in gtk_text_layout_draw (layout=0x809e378, widget=0x80888d0, drawable=0x8178a30, cursor_gc=0x0, x_offset=0, 
    y_offset=0, x=0, y=0, width=617, height=700, widgets=0xbffff0f8) at gtktextdisplay.c:774
#11 0x4016a99c in gtk_text_view_paint (widget=0x80888d0, area=0xbffff744, event=0xbffff738) at gtktextview.c:4076
#12 0x4016aa56 in gtk_text_view_expose_event (widget=0x80888d0, event=0xbffff738) at gtktextview.c:4112

there're a couple nasty issues with these warnings, that need to be fixed:
a) they are highly irritating, because the warnings are issued with a log domain of
   NULL (which is only the applications bussiness) making them look as if they
   came from the application code and not pango.
b) there're no measures being taken to supress repeated warnings, resulting in
   a swarm of identical warnings being issued, e.g. upon every text view expose event.
c) the situation of not being able to find a font is issued as a "warning",
   eventhough this is most certainly not a programming error, but usually just
   the user missing certain fonts in his X setup.

so, what about:
a) -DG_LOG_DOMAIN=\"Pango\"
b) adding a global hash to suppress repeated warnings about font descriptions
c) using g_message() instead of g_warning()

---
ciaoTJ




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]