{BUG][FIX] Some fixes for Postscript output
Marcel Weiher
marcel at metaobject.com
Mon Nov 15 09:15:06 UTC 1999
--Apple-Mail-1553909635-2
content-type: text/enriched; charset=us-ascii
content-transfer-encoding: quoted-printable
<fontfamily><param>Helvetica</param>Hi folks,
this fixes some reported problems with the Postscript support new to =
2.6:
1. An incompatibility with Ghostscript due to=20
incorrect handling of font UniqueIDs is now
fixed: the UniqueID is properly removed.
2. An incompatibility with new #roundTo:
behavior is fixed. #roundTo: apparently
always converts to a real now, even if
the number in question is alread an=20
integer. The PostscriptEncoder now
checks for integer-ness first before
rounding.
3. Postscript Level 1 compatibility.
The generated Postscript should not cause
errors on (older) devices that only support
Postscript Level 1. However, some features
will render incorrectly (mainly images with
transparency and color-mapped images).
</fontfamily>=
--Apple-Mail-1553909635-2
content-type: application/octet-stream; x-unix-mode=0644; name=Postscript-fixes-1.15Nov909am.cs
content-transfer-encoding: quoted-printable
'=46rom Squeak2.6 of 11 October 1999 [latest update: #1559] on 15 =
November 1999 at 9:09:21 am'!=0D"Change Set: =
Postscript-fixes-1=0DDate: 15 November 1999=0D=
Author: Marcel Weiher=0D=0DFixes several bugs:=0D=0D1. =
new roundTo: converts integers to floats, so check for integer-ness =
first.=0D2. Postscript font modification code now removes UniqueID, in =
conformance=0D with PLRM (and to remove incompatibilities with =
Ghostscript)=0D3. The generated Postscript should now be Postscript =
Level 1 compatible, although some features ( most notably transparent =
images and images with CLUTs) won't have the desired results."!=0D=0D=0D=
!Form methodsFor: 'postscript generation' stamp: 'mpw 11/14/1999 22:22'!=0D=
bytesPerRow=0D ^ self numComponents * self paddedWidth * self =
bitsPerComponent / 8.! !=0D=0D!Form methodsFor: 'postscript generation' =
stamp: 'mpw 11/15/1999 08:46'!=0DprintPostscript:aStream =
operator:operator=0D aStream gsave; =0D =
rectclip:(0 @ 0 extent: (width) @ (height)).=0D self =
setColorspaceOn:aStream.=0D aStream print:'[ '; cr;=0D =
print:'/ImageType 1'; cr;=0D print:'/ImageMatrix [1 0 =
0 1 0 0]'; cr;=0D print:'/MultipleDataSources =
false'; cr;=0D print:'/DataSource level1 { { =
currentfile '; write:self bytesPerRow;print:' string readhexstring pop =
}} bind { currentfile /ASCIIHexDecode filter } ifelse'; cr;=0D =
print:'/Width '; write:self paddedWidth; cr;=0D =
print:'/Height '; write:self height; cr;=0D =
print:'/Decode '; print:self decodeArray; cr;=0D =
print:'/BitsPerComponent '; write:self bitsPerComponent; cr;=0D =
print:'makeDict '; print:operator; cr.=0D self depth <=3D 8 =
ifTrue:[self storeHexBitsOn:aStream].=0D self depth =3D 16 =
ifTrue:[self store15To24HexBitsOn:aStream].=0D self depth =3D 32 =
ifTrue:[self store32To24HexBitsOn:aStream].=0D aStream print:$>; cr.=0D =
aStream cr.=0D aStream grestore; cr.! !=0D=0D!Form methodsFor: =
'postscript generation' stamp: 'mpw 11/15/1999 08:34'!=0DrowPadding=0D =
^ 32 // self depth! !=0D=0D=0D!PostscriptCanvas methodsFor: =
'initialization' stamp: 'mpw 11/15/1999 08:57'!=0DwriteProcset=0D =
target print:'=0D=0D%%BeginProcset: Squeak-Level2-Emulation=0D/level1 =
/languagelevel where { =0D pop languagelevel 2 lt=0D} {true } =
ifelse def=0Dlevel1=0D{=0D /rectclip {=0D 4 2 roll moveto=0D=
1 index 0 rlineto=0D 0 exch rlineto=0D =
neg 0 rlineto closepath=0D clip newpath=0D } bind def=0D =
/setcolorspace { pop } bind def=0D /makeDict {=0D =
counttomark 2 idiv dup dict begin=0D { def } repeat=0D =
currentdict end exch pop=0D } bind def=0D /defaultDict [ =
/MultipleDataSources false makeDict def=0D /image {=0D =
dup type /dicttype eq {=0D defaultDict begin=0D =
begin=0D Width=0D =
Height=0D BitsPerComponent=0D =
ImageMatrix =0D /DataSource load =
MultipleDataSources { aload pop } if =
MultipleDataSources=0D Decode length 2 idiv=0D =
end=0D end=0D } if=0D =
colorimage =0D currentfile ( ) readstring pop pop=0D } bind =
def=0D=0D /_imagemask /imagemask load def=0D /imagemask {=0D =
dup type /dicttype eq {=0D begin=0D =
Width=0D Height=0D =
Decode 0 get 1 eq=0D ImageMatrix=0D =
/DataSource load=0D end=0D =
} if=0D _imagemask =0D currentfile ( ) readstring pop =
pop=0D } bind def=0D /transparentimage {=0D pop image=0D =
} bind def=0D=0D} {=0D /makeDict { >> } bind def=0D =
/transparentimage {=0D gsave=0D 32 dict begin=0D =
/tinteger exch def=0D /transparent 1 string def=0D transparent 0 =
tinteger put=0D /olddict exch def=0D olddict /DataSource get dup =
type /filetype ne {=0D olddict /DataSource 3 -1 roll 0 () =
/SubFileDecode filter put=0D } {=0D pop=0D } =
ifelse=0D /newdict olddict maxlength dict def=0D =
olddict newdict copy pop=0D /w newdict /Width get def=0D /str w =
string def=0D /substrlen 2 w log 2 log div floor exp cvi def=0D =
/substrs [=0D {=0D substrlen string=0D 0 1 =
substrlen 1 sub {=0D 1 index exch tinteger put=0D } =
for=0D /substrlen substrlen 2 idiv def=0D substrlen 0 eq =
{exit} if=0D } loop=0D ] def=0D /h newdict /Height get =
def=0D 1 w div 1 h div matrix scale=0D olddict /ImageMatrix =
get exch matrix concatmatrix=0D matrix invertmatrix concat=0D =
newdict /Height 1 put=0D newdict /DataSource str put=0D =
/mat [w 0 0 h 0 0] def=0D newdict /ImageMatrix mat put=0D =
0 1 h 1 sub {=0D mat 5 3 -1 roll neg put=0D olddict =
/DataSource get str readstring pop pop=0D /tail str def=0D =
/x 0 def=0D {=0D tail transparent search dup /done =
exch not def=0D {exch pop exch pop} if=0D /w1 1 index length =
def=0D w1 0 ne {=0D newdict /DataSource 3 -1 roll =
put=0D newdict /Width w1 put=0D mat 4 x neg put=0D=
/x x w1 add def=0D newdict image=0D =
/tail tail w1 tail length w1 sub getinterval def=0D } =
if=0D done {exit} if=0D tail substrs {=0D =
anchorsearch {pop} if=0D } forall=0D /tail exch =
def=0D tail length 0 eq {exit} if=0D /x w tail length =
sub def=0D } loop=0D } for=0D end=0D =
grestore=0D } bind def=0D} ifelse=0D=0D%%EndProcset=0D=
%%BeginProcset: Squeak-Printing=0D/_showpageSqueak /showpage load def=0D=
/showpage { gsave _showpageSqueak grestore } bind def=0D/countspaces {=0D=
[ exch { dup 32 ne { pop } if } forall ] length =0D} bind def=0D=
/jshow { =0D 10 dict begin=0D /width exch def=0D /str =
exch def=0D str length 0 gt {=0D str dup length 1 sub get =
32 eq { /str str dup length 1 sub 0 exch getinterval def } if=0D =
/strw str stringwidth pop def=0D /diffwidth width strw =
sub def=0D /numspaces str countspaces def=0D =
numspaces 0 eq { /numspaces 1 def } if=0D /adjspace width =
strw sub numspaces div def=0D /adjchar 0 def=0D =
diffwidth 0 lt {=0D /adjspace adjspace 0.2 mul def=0D=
/adjchar diffwidth str length div 0.8 mul def=0D =
} if=0D adjspace 0 32 adjchar 0 str awidthshow=0D=0D =
} if=0D end=0D} bind def=0D=0D/copydict {=0D dup length dict begin =0D=
{ 1 index /FID eq 2 index /UniqueID eq and {pop pop} { =
def } ifelse } forall=0D currentdict end=0D} bind def=0D=
/getSymbolcharproc {=0D 1 dict begin =0D /charstring exch =
def =0D [ 550 0 0 0 650 600 /setcachedevice cvx 50 100 /translate cvx =
/pop cvx =0D 1 dict begin /setbbox { pop pop pop } bind def =
currentdict end /begin cvx =0D=0D gsave /Symbol 600 =
selectfont 0 0 moveto charstring false charpath false upath grestore=0D=0D=
/exec cvx /fill cvx /end cvx ] cvx bind =0D end=0D} bind def=0D=
/adjustFontForSqueak % converts _ to left-arrow, ^to upArrow =
and tab -> 4 spaces=0D{ =0D gsave dup 1000 selectfont=0D dup dup =
findfont copydict=0D begin=0D CharStrings =0D /CharStrings =
exch copydict=0D dup /leftarrow (\254) getSymbolcharproc put=0D =
dup /uparrow (\255) getSymbolcharproc put=0D dup /tab [ /pop cvx ( ) =
stringwidth pop 6 mul 0 0 0 0 0 /setcachedevice cvx ] cvx bind put=0D =
def=0D /Encoding Encoding dup length array copy =0D dup 94 /uparrow =
put=0D dup 95 /leftarrow put=0D dup 9 /tab put=0D def=0D =
currentdict end definefont pop pop=0D grestore=0D} bind def=0D=0D=
%%EndProcset=0D'.=0D! !=0D=0D=0D!PostscriptDummyWarp commentStamp: 'mpw =
11/12/1999 00:53' prior: 0!=0DI simulate the effects of having a =
WarpBlit done in Postscript, by simply adjusting the coordinate system.=0D=
!=0D=0D!PostscriptEncoder methodsFor: 'Postscript generation' stamp: =
'mpw 11/12/1999 00:46'!=0DwriteNumber:aNumber=0D super =
writeNumber:(aNumber isInteger ifTrue:[aNumber] ifFalse:[aNumber =
roundTo:0.001]).=0D! !=0D=0D=0D=
--Apple-Mail-1553909635-2--
More information about the Squeak-dev
mailing list
|