Path: utzoo!attcan!uunet!cs.utexas.edu!sun-barr!newstop!exodus!rberlin From: rberlin@birdland.sun.com (Rich Berlin) Newsgroups: comp.lang.postscript Subject: Re: limitcheck in flattenpath Message-ID: Date: 12 Nov 90 21:39:42 GMT References: <1642@umriscc.isc.umr.edu> Sender: news@exodus.Eng.Sun.COM Organization: Sun Microsystems Lines: 38 In-reply-to: jmd@franklin.ee.umr.edu's message of 12 Nov 90 18:32:54 GMT I've experienced the same problem. Basically, there's a limit to the number of segments that the path can contain, and charpath eats LOTS of them. See the footnote on charpath, Red Book page 89. It says, in part, "if possible, it is best to deal with only one character's path at a time." Based on this, I suggest the following workaround. (But first I should ask something: the code you've written calculates the bounding box of the string. Are you really centering in both dimensions? If not, I think the stringwidth operator should give you what you want, much more cheaply.) /max where { pop }{ /max {2 copy lt {exch pop} {pop} ifelse} bind def } ifelse /hiwi { 0 0 3 -1 roll { % forall--loop over all characters in string. gsave % Put the char into a string 1 string dup 0 4 -1 roll put % Get the height and width of the single char newpath 0 0 moveto true charpath flattenpath pathbbox 4 2 roll pop pop % Now cumulate the result. The following line % assumes a horizontal writing direction. If the writing % direction is vertical, interchange `add' and `max'. exch 4 -1 roll add 3 1 roll max grestore } forall } bind def -- Rich