lim@.cs.umass.edu (06/12/91)
>Subject: 119)* How do I render rotated text? > > Xlib intentionally does not provide such sophisticated graphics >capabilities, leaving them up to server-extensions or clients-side graphics >libraries. > Your only choice, if you want to stay within the core X protocol, is to >render the text into a pixmap, read it back via XGetImage(), rotate it "by >hand" >with whatever matrices you want, and put it back to the server via XPutImage(); >more specifically: > 1) create a bitmap B and write your text to it. > 2) create an XYBitmap image I from B (via XGetImage). > 3) create an XYBitmap Image I2 big enough to handle the transformation. > 4) for each x,y in I2, I2(x,y) = I(a,b) where > a = x * cos(theta) - y * sin(theta) > b = x * sin(theta) + y * cos(theta) > 5) render I2 > Note that you should be careful how you implement this not to lose >bits; an algorithm based on shear transformations may in fact be better. > The high-level server-extensions and graphics packages available for X >also permit rendering of rotated text: Display PostScript, PEX, PHIGS, and GKS, >although most are not capable of arbitrary rotation and probably do not use the >same fonts that would be found on a printer. > In addition, if you have enough access to the server to install a font >on it, you can create a font which consists of letters rotated at some >predefined angle. Your application can then itself figure out placement of each >glyph. Hi, I'd appreciate it if anyone could provide more information about the shear transformation algorithm. Thanks. Jonathan Lim lim@cs.umass.edu