Re: Vertical strings in a PixMap



Havoc Pennington <hp redhat com> writes:
> Colin Thomas <colin designresources co uk> writes:
> > I would like to write a string to a pixmap, but have the string be rotated.
> > i.e. vertical text.
> 
> You are doomed, GTK just uses the underlying X string-drawing
> mechanism, and X does not support this.

Well, it sort of does.

> > Any hints on where I should be looking ??

You can specify affine transforms in the XLFD (logical font
description -- that "-foo-bar-medium-r-normal--12-120-75-75..."
thing); this was introduced in X11R5, if my memory holds.

Have a look at the "X Logical Font Description Conventions" manual (it
comes with the X distribution) for a description of the syntax.  GNU
Backgammon is an example of a GTK+ program which uses rotated fonts
(it rotates the digits drawn on the doubling cube, depending which way
the cube is facing):

    http://savannah.gnu.org/cgi-bin/viewcvs/gnubg/gnubg/gtkboard.c

The function board_set_cube_font() in that file shows how to load a
rotated font (and how to fall back to a plain font if rotation is not
supported -- very important!), and board_redraw_cube() draws text
using that rotated font (which is unfortunately non-trivial).

Cheers,
Gary.
-- 
   Gary Wong           gtw gnu org           http://www.cs.arizona.edu/~gary/




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