[comp.lang.postscript] currentpoint != last-point-in-path after charpath???

loki@moncam.uucp (Never Kid A Kidder) (03/01/90)

Sorry if this has been spotted before.  I'm running Adobe PostScript
V42.2 on an Apple LaserWriter, and I've just done a simple test;

/Courier findfont
100 scalefont
setfont
100 100 moveto
(a) false charpath
currentpoint = =
300 300 lineto
stroke showpage

Now the %output is

100.0
160.0

but the printed output (sorry, can't get it into this buffer...)
indicates that the last point was in fact at the top lefthand point of
the `a' (presumably the last point in the character data).  I've never
read of this discrepancy as a feature, but I noticed that Adobe's
implementation of their `boldening' does a charpath (each character
individually) followed by an explicit `currentpoint moveto', so it
looks like they're aware of it.  You don't notice it if you just
charpath a string and then stroke it.  You also don't notice it if you
do something like

(a) false charpath
(b) false charpath
(c) false charpath
stroke
showpage

so presumably Adobe's charpath has an implicit `currentpoint moveto'
at the beginning of it.

If it hasn't been commented on before, has anyone else noticed it?  Is
it the version I'm running?  (Note that `fixing' it so that it *does*
do the moveto would not break Adobe's boldening code, for instance,
since their explicit moveto would just overwrite the one there, but
of course making the currentpoint the last point in the character
data would have amusing consequences, notably to have the characters
climbing off the page...)
--
   Harry Fearnhamm, ,---.'\   EMAIL: loki@moncam.uucp
    Monotype ADG,  (, /@ )/          ...!ukc!acorn!moncam!loki
    Science Park,    /( _/ ') VOICE: +44 (0)223 420018
     Cambridge,      \,`---'    FAX: +44 (0)223 420911
      CB4 4FQ,           DISCLAIMER: Nothing is True.
      ENGLAND.                       Everything is Permitted.

woody@rpp386.cactus.org (Woodrow Baker) (03/04/90)

In article <LOKI.90Mar1154035@marvin.moncam.uucp>, loki@moncam.uucp (Never Kid A Kidder) writes:
> (a) false charpath
> 
> 
> the `a' (presumably the last point in the character data).  I've never
> read of this discrepancy as a feature, but I noticed that Adobe's
> implementation of their `boldening' does a charpath (each character
> individually) followed by an explicit `currentpoint moveto', so it
> looks like they're aware of it.  You don't notice it if you just
> charpath a string and then stroke it.  You also don't notice it if you
> do something like


I recently encountered it when working on a new program.  This one typesets
music TABLATURE for the fiddle.  It does not use normal notation, and as
such, I am not using Sonota.  I am using some DINGBATS, and normal drawing
commands such as lineto.  The problem started when I was creating multiple
note heads, with various shading.  It really vexed me.  I gave up worring
about it, and did the expicit moveto that was needed to cure it.  I have
never heard of it before, but it would seem to be a very subtle bug.  I'd
call it that, because to my knowlege it is not documented behavior.

On a related topic, does anyone know EXACTLY what is preserved by a gsave.
grestore pair.  The books say "the current graphics state" and give some
general things, but so far, I have never seen a comprehensive list of
EVERYTHING that gets saved.  This would be imensely helpful...

C
Cheers
Woody

rcd@ico.isc.com (Dick Dunn) (03/05/90)

woody@rpp386.cactus.org (Woodrow Baker) and loki@moncam.uucp (Harry
Fearnhamm), talking about:
> > (a) false charpath
...
> ...I have
> never heard of it before, but it would seem to be a very subtle bug.  I'd
> call it that, because to my knowlege it is not documented behavior...

(Maybe it's a bug in the documentation.:-)  Actually, "charpath" does what
you "want" it to do with the current point in most situations.  But the
red book isn't explicit here, as far as I can tell.  There are two ways to
reason why it does what it does:
	- charpath works like show; it's described in terms of show.  So
	  you probably want it to behave as much like show as is reason-
	  able.  (Most real uses of charpath seem to be just fancy
	  rendering of characters in ways you can't do with show.)  That
	  means that the current point should move by the string escapement,
	  without regard for the generated path.
	- As Fearnhamm suggested, the charpath behavior maintains the
	  useful effect that, for example:
	  (a) false charpath
	  (b) false charpath
	  (c) false charpath
	  gives the same effect as:
	  (abc) false charpath
	  It would be surprising if it didn't.  (Splitting into multiple
	  charpaths might happen if you had font changes in between the
	  pieces.)

So...it seems it would be most useful if the red book added a note that the
current point after a charpath is the same as if the corresponding show had
been executed.
-- 
Dick Dunn     rcd@ico.isc.com    uucp: {ncar,nbires}!ico!rcd     (303)449-2870
   ...Don't lend your hand to raise no flag atop no ship of fools.