Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sdd.hp.com!decwrl!shelby!neon!lucid.com!jwz From: jwz@lucid.com (Jamie Zawinski) Newsgroups: comp.lang.postscript Subject: Re: X11 graphics to postscript (was Re: Hardcopy in X) Message-ID: Date: 10 Sep 90 22:47:52 GMT References: <9009061401.AA02648@islanders.> <7077.26e81ad5@swift.cs.tcd.ie> Sender: jwz@lucid.com Organization: Lucid, Inc., Menlo Park, CA Lines: 19 In-reply-to: cjmchale@swift.cs.tcd.ie's message of 7 Sep 90 22:10:28 GMT > 4. If I want to center some text in a rectangle/oval then I > subclass in my graphics class hierarchy and create a new > graphics object for this. This object will take extra care > when dumping postscript to ensure that the text is centered > inside the rectangle/oval on the postscript page. This sounds like the way to go to me. One possible way to make sure things fit is, compute the left and right pixel position which the string occupies on the X display, map that area into PostScript page space, and scale the PostScript font so that the string in question exactly fits in that rectangle. This means that mapping "iiii" in some random X font to PostScript, and mapping "wwww" in the same font to PostScript might actually use differently- scaled PostScript fonts, but you would be guarenteed that the font which was used would not cause the string to overlap its allotted space. Depending on the application, though, it might be noticeable that the aspect ratio of the fonts of the various pieces of text was changing slightly, but for a graph- like thing, that seems unlikely. -- Jamie