Re: The future of GdkFont declarations
- From: Havoc Pennington <hp redhat com>
- To: ERDI Gergo <cactus cactus rulez org>
- Cc: gtk-devel-list gnome org, gnome-libs-devel gnome org
- Subject: Re: The future of GdkFont declarations
- Date: 03 May 2001 15:56:45 -0400
ERDI Gergo <cactus cactus rulez org> writes:
> Something like the attached patch?
For consistency w/ cell renderer, I would call it "markup" not
"text_markup", and for consistency with label call it "attributes" not
"attr_list".
> * It uses a glib box for PangoAttrList which is not defined in
> GTK+. I modified my local GTK+ copy to get it to compile -- Martin told me
> on iRC that the Pango types should be eventually defined in Pango itself
> (which sounds quite logical to me) and that they are looking for someone
> to do this. Does it involve more than writing the .defs files for boxed
> types?
There's already PANGO_TYPE_ATTR_LIST, as used in GtkLabel.
> * It doesn't have all the properties from GtkCellRendererText
> because I didn't want to bother until you tell me I am on the right track
> at all with the current patch
Yes this is basically right, some comments below.
> * I have no idea why it doesn't affect the AA canvas (at least
> when I modified canvas-primitives.c to see if anything happens, <span
> foreground="red"> only worked in the non-AA canvas)
pango_ft2_render_layout() isn't really doing what you want; you want
something like rgb_buffer_render_layout(), which would support more of
the attributes. ft2_render_layout() I guess is drawing to a bitmap or
grayscale so can't do the colors? Or maybe no one ever implemented the
color part.
gdk_draw_layout() is the most complete layout-rendering code, if you
want to copy some code from elsewhere, use that as a starting point.
> g_object_class_install_property
> (gobject_class,
> + PROP_TEXT_MARKUP,
> + g_param_spec_string ("text_markup", NULL, NULL,
Instead of NULL, why not write the docs! ;-)
> + textitem->text = g_strdup (pango_layout_get_text (textitem->layout));
> + textitem->attr_list = pango_attr_list_copy
> (pango_layout_get_attributes (textitem->layout));
This doesn't really make sense, to have an unused copy of the attr
list. Why not just ref the attr list, but keep it the same attr list.
For the purposes of GnomeAbout, the property you really want is the
"scale" property, so you can scale text relative to the default.
If you use the markup approach I suggested earlier, be sure to call
g_markup_escape_text() on any text that might have ampersands or angle
brackets in it.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]