'From etoys2.3 of 28 November 2007 [latest update: #1824] on 10 December 2007 at 5:38:55 pm'! "Change Set: TTProperReference-yo Date: 10 December 2007 Author: Yoshiki Ohshima Fix multi-level composition in TrueType."! !TTCFontReader methodsFor: 'all' stamp: 'yo 12/10/2007 17:24'! processCharMap: assoc "Process the given character map" | glyph cmap encode0 encode1 char value null g | cmap _ assoc value. null _ (glyphs at: (cmap at: Character space asUnicode + 1) + 1) copy. null contours: #(). encode0 _ Array new: 256 withAll: glyphs first. encode1 _ Array new: 65536 withAll: glyphs first. 0 to: 255 do: [:i | char _ Character value: i. glyph _ glyphs at: (cmap at: char asUnicode + 1) + 1. encode0 at: i+1 put: glyph. ]. Character separators do: [:c | encode0 at: (c asciiValue + 1) put: null. ]. 0 to: 65536 - 1 do: [:i | value _ cmap at: i+1. value = 65535 ifFalse: [ "???" g _ glyphs at: value+1. (g isKindOf: TTCompositeGlyph) ifFalse: [ encode1 at: i+1 put: g. ] ifTrue: [ g basicGlyphs: (((glyphs at: value+1) basicGlyphs) collect: [:t | t key->(glyphs at: (t value glyphIndex+1))]). encode1 at: i+1 put: g ]. ] ]. ^ {encode0. encode1}. ! ! !TTCFontSet class methodsFor: 'file out/in' stamp: 'yo 12/10/2007 17:28'! makeSmartRefFilesFrom: fileNames encodingTag: anInteger ranges: ranges outputFileName: outputFile " | dir | dir _ FileDirectory on: 'C:\tmp'. dir _ FileDirectory on: '/usr/share/fonts/dejavu-lgc'. ((dir fileNames select: [:e | e endsWith: '.ttf']) collect: [:e | dir fullNameFor: e]). TTCFontSet makeSmartRefFilesFrom: ((dir fileNames select: [:e | e endsWith: '.ttf']) collect: [:e | dir fullNameFor: e]) encodingTag: GreekEnvironment leadingChar ranges: EFontBDFFontReaderForRanges rangesForGreek outputFileName: 'GreekTT.out'. " | f ref descriptions | TTCFontReader encodingTag: anInteger. descriptions _ fileNames collect: [:ttfFile | TTCFontSet newTextStyleFromTTFile: ttfFile encodingTag: anInteger ranges: ranges]. f _ FileStream newFileNamed: outputFile. TextConstants at: #forceFontWriting put: true. ref _ SmartRefStream on: f. ref nextPutObjOnly: descriptions. ref close. TextConstants at: #forceFontWriting put: false. f close. " When you load a copyrighted font, be careful not to distribute the result. TTCFontSet makeSmartRefFilesFrom: #('C:\Windows\Fonts\MSGothic.ttc') encodingTag: JapaneseEnvironment leadingChar ranges: EFontBDFFontReaderForRanges basicNew rangesForJapanese outputFileName: 'JapaneseTT.out' "! ! !TTCompositeGlyph methodsFor: 'accessing' stamp: 'yo 12/10/2007 17:15'! basicGlyphs ^ glyphs ! ! !TTCompositeGlyph methodsFor: 'accessing' stamp: 'yo 12/10/2007 17:17'! basicGlyphs: colOfAssocs glyphs _ colOfAssocs ! !