determining character width



I want to set the width of a text window in characters rather than
fixing it in pixels.  The idea is to supply the function that creates
the window with a width parameter ("hsize") in characters, then the
function computes on the fly the corresponding width in pixels.

In gtk-1.2 I did:

hsize *= gdk_char_width(fixed_font, 'X');

where "fixed_font" is the relevant (monospaced) GdkFont.

I'm trying to figure out how to do this in gtk-2.0, but I'm getting
lost in the complexities of pango.  I guess I need to go from the
current PangoFontDescription to the associated metrics, but there
doesn't seem to be any simple way of doing that.  Any help
appreciated.

-- 
Allin Cottrell
Department of Economics
Wake Forest University, NC




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