'From Squeak3.1alpha [latest update: #''Squeak3.1alpha'' of 5 February 2001 update 3936] on 20 April 2001 at 3:43:51 pm'! "Change Set: morePSFont Date: 20 April 2001 Author: Bob Arning More Postscript fixups: - scale the substitute for ComicBold down a little more so it fits etoy tiles better - improve printing ImageMorphs when they have transparent bits - fix printing of 8 bit forms"! !Form methodsFor: 'postscript generation' stamp: 'RAA 4/20/2001 15:40'! encodePostscriptOn: aStream self unhibernate. "since current Postscript support treats 8-bit forms as 0 to 255 gray scale, convert to 16 first so we get more faithful results" self depth <= 8 ifTrue: [^(self asFormOfDepth: 16) encodePostscriptOn: aStream]. ^ self printPostscript: aStream operator: (self depth = 1 ifTrue: ['imagemask'] ifFalse: ['image'])! ! !ImageMorph methodsFor: 'drawing' stamp: 'RAA 4/20/2001 12:11'! drawPostscriptOn: aCanvas | top f2 c2 clrs | clrs _ image colorsUsed. (clrs includes: Color transparent) ifFalse: [^super drawPostscriptOn: aCanvas]. "no need for this, then" top _ aCanvas topLevelMorph. f2 _ Form extent: self extent depth: image depth. c2 _ f2 getCanvas. c2 fillColor: Color white. c2 translateBy: bounds origin negated clippingTo: f2 boundingBox during: [ :c | top fullDrawOn: c ]. aCanvas paintImage: f2 at: bounds origin ! ! !PostscriptCanvas methodsFor: 'initialization' stamp: 'RAA 4/20/2001 11:48'! initializeFontMap "Initialize the dictionary mapping message names to actions for C code generation." fontMap _ Dictionary new. #( 'Palatino' ('Palatino-Roman' 0.9) 'NewYork' ('Helvetica' 0.9) 'NewYork-Bold' ('Helvetica-Bold' 0.9) "try to make these the right size for etoy tiles" 'ComicBold' ('Helvetica-Narrow-Bold' 0.8) 'ComicPlainB-Bold' ('Helvetica-Narrow-Bold' 0.8) 'ComicPlain' ('Helvetica-Narrow' 0.8) ) pairsDo: [ :squeakName :info | fontMap at: squeakName put: info ]. ! ! !PostscriptCanvas methodsFor: 'drawing support' stamp: 'RAA 4/20/2001 11:53'! postscriptFontInfoForFont: font | fontName | fontName _ font familyName asString. font emphasis == 1 ifTrue:[ fontName _ fontName,'-Bold'. ]. ^ fontMap at: fontName ifAbsent: [{fontName. 0.9}] ! ! !PostscriptCanvas methodsFor: 'drawing support' stamp: 'RAA 4/20/2001 11:50'! postscriptFontNameForFont: font ^(self postscriptFontInfoForFont: font) first ! ! !PostscriptCanvas methodsFor: 'drawing support' stamp: 'RAA 4/20/2001 11:52'! setFont:aFont | fInfo | aFont = currentFont ifTrue: [^self]. currentFont _ aFont. self defineFont: aFont. fInfo _ self postscriptFontInfoForFont: aFont. target selectflippedfont: fInfo first size: aFont height * fInfo second "a fudge factor around 0.9" ascent: aFont ascent. " the 0.9 is obviously a fudge factor. I have to figure out how to figure out the actual font-size to request, neither #ascent nor #height are correct." ! ! PostscriptCanvas removeSelector: #mapFontName:!