atom feed4 messages in org.gnome.gtk-devel-listRe: unicode, rendering, and a minor d...
FromSent OnAttachments
Evan MartinJan 24, 2002 1:04 pm.patch
Owen TaylorJan 24, 2002 1:51 pm 
Evan MartinJan 24, 2002 2:07 pm.c, .u8
Owen TaylorJan 24, 2002 3:38 pm 
Subject:Re: unicode, rendering, and a minor doc typeo patch
From:Owen Taylor (otay@redhat.com)
Date:Jan 24, 2002 1:51:10 pm
List:org.gnome.gtk-devel-list

mart@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