'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 (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. ! !