'From Cuis 1.0 of 21 August 2009 [latest update: #268] on 25 August 2009 at 8:20:06 pm'!
!classDefinition: #TextStyle category: #'Graphics-Text'!
Object subclass: #TextStyle
	instanceVariableNames: 'name font alignment tabsArray color '
	classVariableNames: 'AvailableTextStyles DefaultTextStyle '
	poolDictionaries: ''
	category: 'Graphics-Text'!

!CharacterScanner methodsFor: 'private' stamp: 'jmv 8/25/2009 20:17'!
setActualTextStyle: aTextStyle

	| c |
	actualTextStyle _ aTextStyle.
	self setActualFont: aTextStyle font.
	self setAlignment: aTextStyle alignment.
	(c _ aTextStyle color) ifNotNil: [
		self textColor: c ]! !

!CharacterScanner methodsFor: 'private' stamp: 'jmv 8/25/2009 19:39'!
setFont
	| priorFont c |
	"Set the font and other emphasis.
	In fact set actual TextStyle, alignment, font and emphasis"
	priorFont _ font.
	text ifNotNil: [
		font _ nil.
		emphasisCode _ 0.
		kern _ 0.
		actualTextStyle _ text initialStyle.
		(c _ actualTextStyle color) ifNotNil: [
			self textColor: c ].
		alignment _ actualTextStyle alignment.
		(text attributesAt: lastIndex)
			do: [:att | att emphasizeScanner: self]].
	font ifNil: [
		self setActualFont: actualTextStyle font].
	font _ font emphasized: emphasisCode.
	priorFont ifNotNil: [ destX _ destX + priorFont descentKern ].
	destX _ destX - font descentKern.
	"NOTE: next statement should be removed when clipping works"
	leftMargin ifNotNil: [destX _ destX max: leftMargin].
	kern _ kern - font baseKern.

	"Install various parameters from the font."
	spaceWidth _ font widthOf: Character space.
	xTable _ font xTable.
	map _ font characterToGlyphMap.
	stopConditions _ DefaultStopConditions.! !


!TextStyle methodsFor: 'accessing' stamp: 'jmv 8/25/2009 19:39'!
color
	^color! !

!TextStyle methodsFor: 'initialization' stamp: 'jmv 8/25/2009 19:16'!
privateColor: aColor
	"Only to be used from TextStyle instance creation methods"
	
	color _ aColor! !

!classDefinition: #TextStyle category: #'Graphics-Text'!
Object subclass: #TextStyle
	instanceVariableNames: 'name font alignment tabsArray color'
	classVariableNames: 'AvailableTextStyles DefaultTextStyle'
	poolDictionaries: ''
	category: 'Graphics-Text'!
