'From Cuis 1.0 of 27 August 2009 [latest update: #282] on 3 September 2009 at 10:18:03 am'!

!StrikeFont methodsFor: 'accessing' stamp: 'jmv 9/3/2009 10:17'!
baseFont: aStrikeFont

	baseFont _ aStrikeFont.
	baseFont ifNotNil: [
		derivativeFonts _ nil ]! !

!StrikeFont methodsFor: 'emphasis' stamp: 'jmv 9/3/2009 10:17'!
emphasized: code
	"Answer a copy of the receiver with emphasis set to include code."
	| derivative addedEmphasis derivedFrom safeCode |
	self isBaseFont ifFalse: [ ^self baseFont emphasized: (code bitOr: emphasis) ].
	code = 0 ifTrue: [ ^ self ].
	
	derivative _ derivativeFonts at: (safeCode _ code min: derivativeFonts size).
	derivative ifNotNil: [^ derivative].  "Already have this style"

	"Dont have it -- derive from another with one with less emphasis"
	addedEmphasis _ 1 bitShift: safeCode highBit - 1.
	derivedFrom _ self emphasized: safeCode - addedEmphasis.  "Order is Bold, Ital, Under, Narrow"
	derivative _ derivedFrom copy.
	addedEmphasis = 1 ifTrue: [   "Compute synthetic bold version of the font"
		derivative
			ensureCleanBold;
			name: derivedFrom name , 'B';
			makeBoldGlyphs ].
	addedEmphasis = 2 ifTrue: [   "Compute synthetic italic version of the font"
		derivative
			name: derivedFrom name , 'I';
			makeItalicGlyphs ].
	addedEmphasis = 4 ifTrue: [   "Compute underlined version of the font"
		derivative
			name: derivedFrom name , 'U';
			makeUnderlinedGlyphs ].
	addedEmphasis = 8 ifTrue: [   "Compute narrow version of the font"
		derivative
			name: derivedFrom name , 'N';
			makeCondensedGlyphs ].
	addedEmphasis = 16 ifTrue: [   "Compute struck-out version of the font"
		derivative
			name: derivedFrom name , 'X';
			makeStruckOutGlyphs ].
	derivative baseFont: self.
	derivative emphasis: safeCode.
	derivativeFonts at: safeCode put: derivative.
	^ derivative! !

"Postscript:
Leave the line above, and replace the rest of this comment by a useful one.
Executable statements should follow this comment, and should
be separated by periods, with no exclamation points (!!).
Be sure to put any further comments in double-quotes, like this one."
StrikeFont allInstancesDo: [ :f | f fixDerivatives ]!

