Re: Vertical strings in a PixMap



On 04 May 2001 09:54:50 -0400
Havoc Pennington <hp redhat com> wrote:

> 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.
> > 
> > I have looked at the gdk_draw_string function, and font objects, and have
> > not managed to locate a switch to control text rotation.
> > 
> > Any hints on where I should be looking ??
> > 
> > I look forward to your combined wisdom.
> 
> You are doomed, GTK just uses the underlying X string-drawing
> mechanism, and X does not support this.

I'm afraid that this isn't quite correct...
(Wow - I never though I'd be correcting Havoc...)

X11R6 added support to the XLFD definition to allow an affine matrix to be
encoded within it, allowing various transformations to be applied to text
(including rotation, shearing, etc.)

It's tricky, and you'll need to read the section in "Programmers Supplement
for Release 6 of the X Window System" O'Reilly, ISBN 1-56592-08909
(or some other equivalent documentation) to understand how to specify your
rotation angle within the XLFD.

As an example, try something like
 % xfontsel -pattern "-*-courier-*-*-*-*-*-[10 ~10 0 10]-*-*-*-*-*-*"
and you should see rotated fonts.

By virtue, fonts in GTK can be rotated the same way.
(We're a GIS company, and we do it to place text along rivers, etc.)

Ian




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