[comp.lang.postscript] What is a good pathforall substitute??

mhovan@gmuvax2.gmu.edu (Mike Hovan) (05/02/91)

	I am interested in placing text on a path created by a
charpath call.  Unfortunately the LRM says that pathforall operator 
is not allowed to operate on paths created with charpath.  What is
a good way to accomplish this?

	Basically, I am trying to display text created with a small font
along the outline of text created with a much larger font.


		Mike

-- 
  |X|X| "Women,                                 Michael Andrew Hovan III |X|X|
  |X|    Can't live with them,                  mhovan@gmuvax2.gmu.edu     |X|
  |X|    Can't fry them in a WOK!"              George Mason University    |X|
  |X|X|    -- MTV Half-Hour Comedy Hour         Fairfax, Virginia, USA   |X|X|

davis@3d.enet.dec.com (Peter Davis) (05/02/91)

In article <1991May1.212603.7751@gmuvax2.gmu.edu>, mhovan@gmuvax2.gmu.edu (Mike Hovan) writes...
> 
>	I am interested in placing text on a path created by a
>charpath call.  Unfortunately the LRM says that pathforall operator 
>is not allowed to operate on paths created with charpath.  What is
>a good way to accomplish this?
> 
>	Basically, I am trying to display text created with a small font
>along the outline of text created with a much larger font.
> 
Can't do it.  The restriction on doing 'pathforall' on paths containing
character outlines was specifically put in by Adobe to protect font designs.

Actually, this is a PostScript Level I restriction.  PostScript Level II
supposedly lifts this restriction, depending on where in the Language Reference
Manual you look.  On page 462, in the description of the 'pathforall' operator,
the book says:

	If charpath was used to construct any portion of the current
	path from a font whose outlines are protected, pathforall is
	not allowed.  Its execution will produce an invalidaccess
	error (see charpath).

However, on page 560, in the section on language changes affecting existing
operators, it says:

	charpath no longer protects the character outlines for most fonts.
	pathforall is permitted after charpath for normally constructed
	Type 1 and Type 3 fonts.

I guess the upshot is that it's still possible to protect your font's outlines,
but that by default, they will not be protected.

-pd

woody@chinacat.Unicom.COM (Woody Baker @ Eagle Signal) (05/03/91)

In article <1991May1.212603.7751@gmuvax2.gmu.edu>, mhovan@gmuvax2.gmu.edu (Mike Hovan) writes:
> 
> 	Basically, I am trying to display text created with a small font
> along the outline of text created with a much larger font

Don lancaster published a routine called apathforall in the computer shopper
several months ago.  It turns out to be a part of the Metamorphisis (sic)
package from Altsys.  It works by turning off the charpath checking flag.

This was sent to me by lawrence.  He cleared it for distribution some
time ago.  It accomplishes the same thing.  It gives you a character path.
Cheers
Woody



From waikato.ac.nz!CCC_LDO Tue Jun 26 07:25:21 1990
Received: from cs.utexas.edu by chinacat.Unicom.COM (smail2.5c) with UUCP
	id AA20643; 26 Jun 90 07:25:21 CDT (Tue)
Posted-Date: Tue, 26 Jun 90 23:05 +1200
Message-Id: <9006261138.AA29517@cs.utexas.edu>
Received: from truth.waikato.ac.nz by cs.utexas.edu (5.64/1.63)
	id AA29517; Tue, 26 Jun 90 06:38:14 -0500
Date: Tue, 26 Jun 90 23:05 +1200
From: "Lawrence D'Oliveiro, Waikato University, Hamilton, NZ"
 <CCC_LDO@waikato.ac.nz>
Subject: Cracked it!
To: woody@chinacat.unicom.com
X-Vms-To: IN%"woody@chinacat.unicom.com"

Howdy.

I've got "apathforall" sussed! And I've succeeded in writing my own
version. Because of the way that "apathforall" works, I've decided to implement
a slightly different operator, which I've called "unprotectpath". All
this does is clear the flag that is set by charpath and checked by
pathforall; you then just call pathforall as usual. Here's the code,
and an example use:

%
% define the "unprotectpath" operator
%
currentfile 1256 string readhexstring
6EA0339904E8000104020010000000002F172F6F000800044EFA041400000000205F43FA
FFF8229F4ED0207AFFF0D0FC00A020504E902040226F000422D822D84E7520572EAF0004
2F6F000800042F480008207AFFC8D0FC005020504E90508F4E75207AFFB8D0FC00802050
4ED020572EAF00042F480004207AFFA2D0FC00F820504E90588F4E7520572EAF00042F6F
000800042F480008207AFF82D0FC011C20504E90508F4E7520572EAF00042F480004207A
FF68D0FC00B420504E90588F2040226F000422D822D84E75207AFF4ED0FC009C20504E90
2040226F000422D822D84E7520572EAF00042F6F000800042F6F000C00082F6F0010000C
2F480010207AFF1AD0FC007420504E90DEFC00102040226F000422D822D84E752F6F0004
000C201F225F205F2F0070001018600212D851C8FFFC42194E75221F201F225F205F2F01
600212D851C8FFFC484051C800046004484060EE4E754E56FFFC48E7010849FA03582854
2E140687000000432D47FFFC286EFFFC42144CDF10804E5E4E754E56FEE848E70108486E
FEE8598F487A008C286E0008486CFF004EBAFF7E4EBAFF06588F2D6EFEE8FFF82D6EFEEC
FFFC486EFEE82F2EFFFC2F2EFFF8286E00082F2CFEFC2F2CFEF84EBAFF18588F2D6EFEE8
FFF02D6EFEECFFF43E2EFFF21D47FEF02F2EFFF4486EFEF142471E2EFEF048C72F074EBA
FF42486EFEF0487A00184EBA02BC57C744071D47000C4CDF10804E5E2E9F4E750432332E
30000776657273696F6E4E56FFFA48E70118286E0008286C00082E1406870000011C2847
2D54FFFC3D7C0180FFFA55AEFFFC286EFFFC0C944EF10E006600001859AEFFFC286E0008
197C0001FEF060000044600000222E2EFFFC598728470C94E780D0B966000010286E0008
197C0001FEF060000020536EFFFA4A6EFFFA6600000E286E0008422CFEF0600000081E3C
0000679A286E00084A2CFEF067000010286E0008266EFFFC26532953FEF44CDF18804E5E
2E9F4E754E56FFDE48E70118486EFFDE598F487A00DE286E0008486CFF004EBAFE2C4EBA
FDB4588F2D6EFFDEFFF82D6EFFE2FFFC486EFFDE2F2EFFFC2F2EFFF8286E00082F2CFEFC
2F2CFEF84EBAFDC6588F2D6EFFDEFFF02D6EFFE2FFF43E2EFFF2CFECFEF248C7DEACFEF4
28472D54FFEC3D7C007FFFE6286EFFEC0C542079660000262E2EFFEC5C8728470C944A28
00436600001454AEFFEC286E0008197C0001FEF06000002454AEFFEC536EFFE64A6EFFE6
6600000E286E0008422CFEF0600000081E3C000067AE286E00084A2CFEF06700001449FA
01142D4CFFE8286EFFE8266EFFEC28934CDF18804E5E2E9F4E750A70617468666F72616C
6C004E56FFF048E70108486EFFF04EBAFC4E588F2D6EFFF0FFF82D6EFFF4FFFC2F2EFFFC
2F2EFFF84EBAFC4C487AFD60598F487A0020286E0008486CFF004EBAFD104EBAFC784EBA
FC4E4CDF10804E5E2E9F4E750D756E70726F74656374706174684E56FEE848E70108286E
00082F144EBAFBE21D7C0001FEF0486EFEE84EBAFC80588F2D6EFEE8FEF82D6EFEECFEFC
558F2F0E4EBAFD201E1F670000143D7C0004FEF22D7C00497CCCFEF46000000E3D7C0008
FEF22F0E4EBAFDA04A2EFEF0670000082F0E4EBAFE404A2EFEF0670000082F0E4EBAFF2C
1E2EFEF0488748C72F074EBAFBBE4CDF10804E5E2E9F4E7500000000241F225F205F2F02
42401018424112193400B44163023401B4026002B10956CAFFFC6602B0414E75
pop
(BAB2CD7AD2DAABB1603D) eexec

not
  {
    (Couldn't define unprotectpath) =
    quit
  }
if

newpath
0 0 moveto
/Times-Roman findfont 72 scalefont setfont
(T) false charpath

/TempStr 255 string def

unprotectpath

  { % move
    exch TempStr cvs print ( ) print
    TempStr cvs print ( moveto) =
  }
  { % line
    exch TempStr cvs print ( ) print
    TempStr cvs print ( lineto) =
  }
  { % curve
    6 5 roll TempStr cvs print ( ) print
    5 4 roll TempStr cvs print ( ) print
    4 3 roll TempStr cvs print ( ) print
    3 2 roll TempStr cvs print ( ) print
    exch TempStr cvs print ( ) print
    TempStr cvs print ( curveto) =
  }
  { % close
    (closepath) =
  }
pathforall

davis@3d.enet.dec.com (Peter Davis) (05/04/91)

In article <1978@chinacat.Unicom.COM>, woody@chinacat.Unicom.COM (Woody Baker @ Eagle Signal) writes...
>
>Don lancaster published a routine called apathforall in the computer shopper
>several months ago.  It turns out to be a part of the Metamorphisis (sic)
>package from Altsys.  It works by turning off the charpath checking flag.
> 
>This was sent to me by lawrence.  He cleared it for distribution some
>time ago.  It accomplishes the same thing.  It gives you a character path.
>Cheers
>Woody
>

I tried this out on both printer and Display PostScript.  In both interpreters,
it blew up with:

	undefined: Name not known - offending command is cexec

Since I didn't find cexec in the text portion of the file, I assume it's buried
in the eexec encrypted portion.  Is there a readable version of this around? 

Better still, is there a working version?

If there's really a way to unprotect charpath outlines in Level 1 PostScript,
that would be extremely useful.  I'd be surprised if Adobe left such a hole,
though.  How does one access internal flags such as the charpath checking flag?

Thanks.
-pd

deadman@garnet.berkeley.edu (Ben Haller) (05/05/91)

In article <1991May1.212603.7751@gmuvax2.gmu.edu> mhovan@gmuvax2.gmu.edu (Mike Hovan) writes:
>
>	I am interested in placing text on a path created by a
>charpath call.  Unfortunately the LRM says that pathforall operator 
>is not allowed to operate on paths created with charpath.  What is
>a good way to accomplish this?
>
>	Basically, I am trying to display text created with a small font
>along the outline of text created with a much larger font.

  As far as I know you can't, to answer the question.  On to more
interesting points: as far as I can tell, this means that a non-PostScript
printer used with ATM on a Macintosh is actually *more* powerful than a PS
printer in some respects (according to Adobe, ATM 2.0 includes a
programming interface to the ATM driver that allows a program to get the
path of a character - essentially the "pathforall" information that
PostScript is unable to provide).
  Am I wrong?

-Ben Haller (deadman@garnet.berkeley.edu)
 "Clap your hands
  And listen for an echo..." - The Horseflies

orthlieb@adobe.COM (Carl Orthlieb) (05/07/91)

In article <1991May4.193113.24989@agate.berkeley.edu> deadman@garnet.berkeley.edu (Ben Haller) writes:
>In article <1991May1.212603.7751@gmuvax2.gmu.edu> mhovan@gmuvax2.gmu.edu (Mike Hovan) writes:
>>
>>	I am interested in placing text on a path created by a
>>charpath call.  Unfortunately the LRM says that pathforall operator 
>>is not allowed to operate on paths created with charpath.  What is
>>a good way to accomplish this?
>>
>>	Basically, I am trying to display text created with a small font
>>along the outline of text created with a much larger font.
>
>  As far as I know you can't, to answer the question.  On to more
>interesting points: as far as I can tell, this means that a non-PostScript
>printer used with ATM on a Macintosh is actually *more* powerful than a PS
>printer in some respects (according to Adobe, ATM 2.0 includes a
>programming interface to the ATM driver that allows a program to get the
>path of a character - essentially the "pathforall" information that
>PostScript is unable to provide).
>  Am I wrong?

Yes and no.  The ATM 'Backdoor' is available on both the PC and Mac versions
of ATM.  This allows a developer to create interesting font effects on
screen (rotate/non-uniform scale/skew) and get character outlines.

In order to get the outlines you pass ATM the character, a matrix,  and 
four call-back routines (moveto, lineto, curveto, closepath).  ATM takes it
from there, invoking your call-backs as appropriate.  Note that the character
outline is passed back unhinted.

There are two technical notes for the Mac available from our server:
	Documents ATM_mac_tips.ps
	Documents ATM_mac_advtype.ps

The first contains basic info on how to make sure that your app works 
with ATM.  The second is the backdoor documentation.  

The Windows ATM doc is still in draft.  Expect to see it on our server
soon.

Carl 8^)