Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!think.com!snorkelwacker.mit.edu!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU Newsgroups: comp.windows.x Subject: Re: vertical text Message-ID: <9012041617.AA07967@Larry.McRCIM.McGill.EDU> Date: 4 Dec 90 16:17:22 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 44 [Sorry everybody for posting something just snatched from the FAQ, but the post I'm replying to didn't include an email address...] > What I want to do is to print text in orentations other than > horizontal. Vertical would be acceptable but, printing at various > angles would be even better. > How does one go about doing this? -------------------------------------------------- Subject: 69)+ 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 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. [courtesy der Mouse (mouse@larry.mcrcim.mcgill.edu), Eric Taylor (etaylor@wilkins.bmc.tmc.edu), and Ken Lee (klee@wsl.dec.com), 11/90] -------------------------------------------------- der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu