Re: Equivalent to low-level text draws



On Sun, 2007-08-19 at 13:42 -0500, Mark Tilford wrote:
> I'm trying to port a Windows program.  It has its own text layout
> written in portable code, so I only need to handle things like
> draw_text_at (xcoord, ycoord, string, font) and measure_text (string,
> font).  Where's the appropriate documentation?

Pango is the layer used for major font handling with GTK. GTK provides
its own wrappers around Pango for the most part, so that its not often
necessary to deal with Pango directly. Most widgets that handle text can
be told to use or not use "markup". When using markup, <i>foo</i> will
render "foo" in an italic font; when not using, you can guess what
happens. 

Text measurement with Pango is a bit more complex, because Pango handles
many, many more writing systems than Windows explicitly acknowledges,
and is also capable of much finer control over the layer. Specifically,
Pango has a notion of "logical extents" and "ink extents". The former is
generally used for typesetting-style composition, the latter tells you
about the box surrounding the actual pixels that the font will render
into. 

Armed with this information, you should be able to find the
documentation you are looking for.

> (And it needs raw measuring; "<B>x</B>" should render / be measured as
> 8 characters, not 1.)

this is a picky, and IMHO, silly detail to bring up. did you have some
kind of issue with Windows and this sort of thing?

> 
> BTW, why is Cairo even mentioned in
> http://gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch15.html if it was
> apparently added in gtk 2.9?

very confusingly, gtkmm-2.4 is an *API* version, not a release version.
it defines a stable, source and binary compatible API that has been
maintained from GTK+ 2.something until the present. I don't consider
this nomenclature ideal, but its what we have.

--p






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