TTCFontReader>> processCharacterMappingTable implementation question

Ned Konz ned at squeakland.org
Fri Mar 4 00:23:36 UTC 2005


On Thursday 03 March 2005 2:08 pm, John M McIntosh wrote:
> I'll note that TTCFontReader>>processCharacterMappingTable: entry
>
> has
>
> (pID = 1 or:[pID = 3]) ifTrue:[
>
> This is checking for macintosh or windows character mapping however I
> attempted to read in a random font, picking
>
> /Library/Fonts/Corsiva.ttf
>
> That fails with unknown character mapping because we check for mapping
> type 1 or 3 only.  Now according to
>
> http://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.html#ID
>
> says that pID = 0 means
> 0 Unicode Indicates Unicode version
>
> So I'm wonder if any one is working on reading those font types?

I already am in my Freetype2 code.

The other thing to remember is that we should be using the unicode mapping 
anyway (nowdays).

If you look at a quickie font reference:

m := AlignmentMorph new color: Color white.
m listDirection: #topToBottom; wrapDirection: #leftToRight; cellPositioning: 
#leftCenter; hResizing: #shrinkWrap; vResizing: #shrinkWrap; cellInset: 5; 
layoutInset: 5; extent: 700 at 700; borderWidth: 2; openInWorld.
TextStyle actualTextStyles keys asArray withIndexDo: [ :k :fnum |
t := TextMorph new hResizing: #shrinkWrap; vResizing: #shrinkWrap; extent: 
600 at 600; fontName: k pointSize: 14; contentsAsIs: (Text streamContents: 
[ :strm | 
strm withAttribute: TextColor red do: [ strm nextPutAll: k ]; cr. (33 to: 255) 
do: [ :v | strm nextPut: (Character value: v). (v \\ 32) isZero ifTrue: 
[ strm cr ] ]]); yourself.
fnum even ifTrue: [ t backgroundColor: m color darker ].
m addMorphBack: t. ].


see http://bike-nomad.com/squeak/StockFontRef.png

You'll see that our stock fonts are in fact Unicode.

I have some code that fixes this; I'll post it soon.

-- 
Ned Konz
http://bike-nomad.com/squeak/



More information about the Squeak-dev mailing list