Ricardo Moran uploaded a new version of TrueType to project Etoys: http://source.squeak.org/etoys/TrueType-Richo.3.mcz
==================== Summary ====================
Name: TrueType-Richo.3 Author: Richo Time: 30 May 2010, 5:11:08 pm UUID: 87c0ca6c-4fa5-5e45-85e5-aaf9937d2a07 Ancestors: TrueType-Richo.2
* Integrating true type font support by Andreas Raab.
=============== Diff against TrueType-Richo.2 ===============
Item was changed: ----- Method: TTFileDescription>>on:offset: (in category 'initialize') ----- on: aFileName offset: fontOffset "Initialize the receiver from a file name" fileName := aFileName. fileOffset := fontOffset. self withFileDo:[:fontFile| + "Some bitmap fonts are called .ttf; skip anything that doesn't have a header" + (self findTable: 'head' in: fontFile) ifFalse:[^nil]. - (self findTable: 'head' in: fontFile) - ifFalse:[^self error: 'File does not have a header table']. self processFontHeaderTable: fontFile. (self findTable: 'maxp' in: fontFile) ifFalse:[^self error: 'File does not have a profile table']. self processMaximumProfileTable: fontFile. (self findTable: 'name' in: fontFile) ifFalse:[^self error: 'File does not have a naming table']. self processNamingTable: fontFile. (self findTable: 'hhea' in: fontFile) ifFalse:[^self error: 'File does not have a horizontal header table']. self processHorizontalHeaderTable: fontFile. (self findTable: 'hmtx' in: fontFile) ifFalse:[^self error: 'File does not have a horizontal header table']. hmtxTableOffset := fontFile position. (self findTable: 'loca' in: fontFile) ifFalse:[^self error: 'File does not have a naming table']. indexToLocOffset := fontFile position. (self findTable: 'glyf' in: fontFile) ifFalse:[^self error: 'File does not have a naming table']. glyphTableOffset := fontFile position. (self findTable: 'cmap' in: fontFile) ifFalse:[^self error: 'File does not have a header table']. self processCharacterMappingTable: fontFile. ].!
Item was changed: ----- Method: TTFileDescription class>>fontOffsetsInFile: (in category 'instance creation') ----- fontOffsetsInFile: file "Answer a collection of font offsets in the given file" | tag version nFonts | file position: 0. tag := file next: 4. tag caseOf:{ + ['true' asByteArray] -> ["Version 1.0 TTF file" + "http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6.html + The values 'true' (0x74727565) and 0x00010000 are recognized by the Mac OS + as referring to TrueType fonts." + ^Array with: 0 "only one font" + ]. [#(0 1 0 0) asByteArray] -> ["Version 1.0 TTF file" ^Array with: 0 "only one font" ]. ['ttcf' asByteArray] -> ["TTC file" version := file next: 4. version = #(0 1 0 0) asByteArray ifFalse:[^self error: 'Unsupported TTC version']. nFonts := file nextNumber: 4. ^(1 to: nFonts) collect:[:i| file nextNumber: 4]. ]. } otherwise:[ self error: 'This is not a valid Truetype file'. ].!
Item was changed: ----- Method: TTFileDescription class>>readFontsFrom: (in category 'instance creation') ----- readFontsFrom: aFilename "Reads and returns all the fonts in the given file" " TTFileDescription readFontsFrom: 'batang.ttc'. " ^self openFontFile: aFilename do:[:file| (self fontOffsetsInFile: file) + collect:[:offset| self new on: aFilename offset: offset] + thenSelect:[:font| font notNil]]. - collect:[:offset| self new on: aFilename offset: offset]]. !
etoys-dev@lists.squeakfoundation.org