[squeakRos] RV: [Morphic] I wish know when was the last image in what Nebraska performs as designed

Lic. Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Wed Feb 1 20:48:08 UTC 2006


Yoshiki.

I solve all.

I have the following proposal for when the fonts in both images are not the
same.

Break up the logic in CanvasDecoder class-decodeTTCFont.st
And in TTCFont

See the attached and say how this idea could be better.

In resumen, I try to add the missed fonts sizes.
Could be better if some intelligent dialog between images synchronize both
font sets if necessary.

Very, very thanks.

Edgar


-------------- next part --------------
'From Squeakland 3.8-05 of 7 September 2005 [latest update: #530] on 1 February 2006 at 5:28:48 pm'!

!TTCFont class methodsFor: 'instance creation' stamp: 'edc 2/1/2006 16:30'!
family: f

	^ self allInstances detect: [:a | a familyName = f ] ifNone: [nil].
! !
-------------- next part --------------
'From Squeakland 3.8-05 of 7 September 2005 [latest update: #530] on 1 February 2006 at 5:41:06 pm'!

!CanvasDecoder class methodsFor: 'decoding' stamp: 'edc 2/1/2006 17:36'!
decodeTTCFont: fontString

	"Decode a string that consists of <familyName> <pointSize> <emphasis> (e.g. 'ComicSansMS 12 0') into a proper instance."

	| first second familyName fontSize fontFromServer  emphasis |
	first _ fontString indexOf: $  startingAt: 1.
	second _ fontString indexOf: $  startingAt: first + 1.

	(first ~= 0 and: [second ~= 0]) ifTrue: [familyName := (fontString copyFrom: 1 to: (first - 1)).
fontSize := (fontString copyFrom: first + 1 to: second - 1) asNumber .
emphasis := (fontString copyFrom: second + 1 to: fontString size) asNumber .
fontFromServer := TTCFont family: familyName.
fontFromServer ifNil: [PopUpMenu notify: 'Font family name do not exist on server']
ifNotNil: [fontFromServer := TTCFont family: familyName size: fontSize .
fontFromServer ifNil: [PopUpMenu notify: 'Font size do not exist on server'.
((TextStyle named: familyName) addNewFontSize: fontSize) emphasis: emphasis.
]
ifNotNil:[^ TTCFont familyName: familyName size: fontSize  emphasized: emphasis
]]].

	^ TextStyle defaultFont.
! !


More information about the Squeak-dev mailing list