Xlib and rotated text?

Alan Coopersmith alan.coopersmith at oracle.com
Thu Mar 17 12:42:50 PDT 2011


On 03/17/11 10:52 AM, Chris wrote:
> I want to write some strings that are rotated 90 degrees. If the solution handles ASCII, then that's sufficient, but if it handles latin-1 then even better, but I don't need any unicode or such.
> So, can I do it in Xlib without writing the complete matric algebra by myself (if so, where can I find an example/manual/tutorial), should I use xvertext, freetype or something completely different that I haven't found yet?

No.   The font handling used by Xlib can rotate characters, not strings,
so if you set it to a 45 degree rotation you will have a line of text
in a horizontal line across your screen in which each character has been
rotated 45 degrees.   For example, run:
xfontsel -fn '-adobe-new century schoolbook-medium-r-normal--0-[12 12 0
12]-100-100-p-0-iso8859-1'

If you can find a copy of the O'Reilly manual
"Programmer's Supplement for Release 6 of the X Window System", it has
a chapter on "The Matrix XLFD enhancement" that gives details.
Online sources of info include:
http://www.x.org/releases/current/doc/xorg-docs/specs/XLFD/xlfd.html#matrix_transformations
http://www.math.upenn.edu/~kazdan/210/LectureNotes/x11r6_fonts_94.pdf

I'd really suggest using higher level libraries like pango & freetype
rather than trying to reinvent them yourself though.

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System




More information about the xorg mailing list