Re: unicode, rendering, and a minor doc typeo patch



martine cs washington edu (Evan Martin) writes:

> My current project is trying to write a simple font character set
> browser using Gtk.  I want to render the glyphs from the font to a
> GtkLayout (so it can scroll).
> 
> It seems the easy (and probably naive and slow) way to render fonts is
> like this (in the expose event): 
> 	layout = gtk_widget_create_pango_layout(widget, text);
> 	gdk_draw_layout(window, 
> 		widget->style->fg_gc[widget->state],
> 		10, 10, 
> 		layout); 
> 	g_object_unref(G_OBJECT(layout));
> 
> When I try this with my sample file (sample.u8, displayed in the above
> screenshot), my text displays correctly, but I get this warning:
> 	fb (pid:17955): ** WARNING **: pango_default_break(): the array
> 	of PangoLogAttr passed in must have at least N+1 elements, if
> 	there are N characters in the text being broken
> 
> Here's a backtrace (using --g-fatal-warnings):
> #2  0x4044401e in pango_default_break () from /usr/lib/libpango-0.23.so
> #3  0x404456b6 in pango_break () from /usr/lib/libpango-0.23.so
> #4  0x404506ab in pango_layout_get_pixel_size () from /usr/lib/libpango-0.23.so
> #5  0x404509c9 in pango_layout_get_pixel_size () from /usr/lib/libpango-0.23.so
> #6  0x40451fa3 in pango_layout_get_iter () from /usr/lib/libpango-0.23.so
> #7  0x4024400b in gdk_draw_layout_with_colors () from /usr/lib/libgdk-x11-1.3.so.12
> #8  0x402442a0 in gdk_draw_layout () from /usr/lib/libgdk-x11-1.3.so.12
> #9  0x080491e0 in expose_event ()
> 
> 
> Am I going about this the wrong way?

It sounds reasonable. I think there I may have heard about some problems with one-character
layouts, though I can't reproduce that in some quick tests. If you can produce a test
case that exhibits the problem, I'll take a look.

Regards,
                                        Owen



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