Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!know!tegra!phillips From: phillips@tegra.COM (Steve Phillips) Newsgroups: comp.lang.postscript Subject: Re: postscript back-slash escapes Message-ID: <1942@robbie.tegra.COM> Date: 17 Jan 91 16:06:54 GMT References: <663@ast.dsd.northrop.com> Reply-To: phillips@robbie.UUCP (Steve Phillips) Organization: Tegra-Varityper, Inc. Billerica, MA Lines: 58 In article <663@ast.dsd.northrop.com> paynter@ast.dsd.northrop.com (paynter ann m.) writes: >I am having trouble with PostScript when using certain escape sequences (\). >The ones that don't work for me are \b, \r, and \n. Also, when I print a >multi-line string, it all ends up on one line. I have looked in numerous >PostScript books (including pages 22 - 24 of the red book - possibly first >edition, copyright 1985). I'd like to know if anyone else has had this >problem, and if so how it was solved. Or, if anyone knows the solution to my >mystery. > > ..... > >(This is testing \nthe back-slash n \nas a means of creating new lines) >show > >43.200001 -110.000000 moveto >(This is testing >the return >as a means of creating new lines) >show > ..... The problem isn't with the escape sequences you're using. It's that PostScript doesn't interpret a \n to mean "go to the beginning of the next line." It's merely a character in the font which gets drawn on the page. Most PostScript fonts don't do anything when a special character like \n is encountered - they just ignore the character. [More specifically, that position in the font's encoding vector contains the /.notdef entry which draws nothing]. One reason for this is that, on a PostScript printer, as opposed to a dot matrix printer, for example, there really isn't a clearly defined place to go when you say, "go to the beginning of the next line." What if I do a 100 100 moveto and then a show? Should the next line start right below the current line (e.g. 100 90) or should it go to the left edge of the page (e.g. 0 90)? What happens with rotated or reversed text? How much vertical spacing (leading) should be used between lines? So, to sum up, if you want to draw text on successive lines, you have to manually position the current point yourself. To make this easier, you could define a routine like "lineshow" which looks through the string, calls show for regular characters, and does a moveto to the next line each time a \n is encountered. That way, you can define "go to the beginning of the next line" any way you want to. Hope this helps - Steve -- ============================================================================ Steve Phillips "Never put off until tomorrow what Tegra-Varityper, Inc., Billerica, MA you can do the day after tomorrow" tegra!phillips@uunet.com - Mark Twain