Re: The future of GdkFont declarations



ERDI Gergo <cactus cactus rulez org> writes:
> On 1 May 2001, Havoc Pennington wrote:
> 
> > No, that's all wrong. If you aren't using PangoLayout you are doing it
> > wrong, I promise. ;-)
> > 
> > You should not need the lang, or any of that. Just
> > gtk_widget_create_pango_layout().
> 
> OK, but it's not yet clear to me how that would work. Should I just create
> PangoLayouts from the utility widgets and store them, just like GdkFonts
> (and in the Pango version, PangoFontDescriptions) in the current setup?
> (have a look at the GnomeAbout code in libgnomeui HEAD to understand what
> I'm talking about).
> 

I believe all the fonts crap is just for i18n. So just take it all out
entirely. It is no longer needed. Also delete all the widget
name-setting mess.

Create your layout and then use markup to make text larger or smaller
or bold or whatever:

 pango_layout_set_markup (layout, "<big>foo</big>");

Available tags are documented in the Pango API reference.

If you want to make this user-configurable (I would consider this
bloat...) then use style properties. grep for
gtk_widget_class_install_style_property() in GTK to find examples.

To do this it looks like you need to fix GnomeCanvasText; it should
have similar parameters to GtkLabel/GtkCellRendererText/GtkTextTag. At
minimum a "markup" property, probably also the weight, style, stretch,
etc. stuff; should just cut-and-paste from the cell renderer so you
get exactly the same property names and types.

Using the "scale" property you can actually avoid markup here, since
you are scaling the entire string not a sub-portion. (But the markup
property on GnomeCanvasText is essential for i18n in general, because
you have to translate the position of the tags when you translate the
text itself, in the case where the tags cover subportions of a
string.)

While poking around in this source, I noticed that you can also get
rid of color allocation, just use gdk_gc_set_rgb_fg_color() or
whatever it's called.

Havoc





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