[squeak-dev] The Trunk: TrueType-mt.68.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Feb 6 12:35:03 UTC 2022
Marcel Taeumel uploaded a new version of TrueType to project The Trunk:
http://source.squeak.org/trunk/TrueType-mt.68.mcz
==================== Summary ====================
Name: TrueType-mt.68
Author: mt
Time: 6 February 2022, 1:35:03.086367 pm
UUID: aab3d683-d9e0-cc4f-880a-54ea666530b2
Ancestors: TrueType-mt.67
Fixes regression from last commit. I forgot that there can be multiple cmap tables using different formats so that we might find one that we actually support. Sorry for the noise.
=============== Diff against TrueType-mt.67 ===============
Item was added:
+ ----- Method: TTCharacterMappingTable>>isValid (in category 'testing') -----
+ isValid
+
+ ^ characterMap notNil!
Item was changed:
----- Method: TTCharacterMappingTable>>printOn: (in category 'printing') -----
printOn: stream
stream
nextPutAll: 'cmap( ';
nextPutAll: self platformName;
nextPutAll: ' ; ';
nextPutAll: self encodingName.
self isMacintosh ifTrue: [
stream
nextPut: $<;
nextPutAll: self macLanguageName;
nextPut: $>].
stream
nextPutAll: ' ; ';
+ nextPutAll: (self characterMap ifNil: ['n/a'] ifNotNil: [:m | m size asString]);
- nextPutAll: self characterMap size asString;
nextPutAll: ' )'.!
Item was changed:
----- Method: TTFontReader>>decodeCmapFmtTable: (in category 'private') -----
decodeCmapFmtTable: entry
"Decode cmap table. Currently supports formats 0, 4, and 6
https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#format-0-byte-encoding-table"
| cmapFmt |
^ (cmapFmt := entry nextUShort)
caseOf: {
[0] -> [self decodeCmapFmtTable0: entry].
[4] -> [self decodeCmapFmtTable4: entry].
[6] -> [self decodeCmapFmtTable6: entry].
+ } otherwise: [
+ Transcript showln: '[TTFontReader] Unsupported encoding of cmap: ', cmapFmt.
+ {nil.nil}]!
- } otherwise: [self error: 'Unsupported encoding of cmap: ', cmapFmt]!
Item was changed:
----- Method: TTFontReader>>processData:offset: (in category 'public') -----
processData: fontData offset: anOffset
+ | headerEntry maxProfileEntry nameEntry indexLocEntry charMapEntry glyphEntry horzHeaderEntry horzMetricsEntry kerningEntry os2Entry glyphOffset cmaps numHMetrics indexToLocFormat |
- | headerEntry maxProfileEntry nameEntry indexLocEntry charMapEntry glyphEntry horzHeaderEntry horzMetricsEntry kerningEntry os2Entry glyphOffset cmap numHMetrics indexToLocFormat |
"Read the raw font byte data"
fontDescription := TTFontDescription new.
"Search the tables required to build the font"
(headerEntry := self getTableDirEntry: 'head' from: fontData offset: anOffset) == nil ifTrue:[
^self error:'This font does not have a header table'].
(maxProfileEntry := self getTableDirEntry: 'maxp' from: fontData offset: anOffset) == nil ifTrue:[
^self error:'This font does not have a maximum profile table'].
(nameEntry := self getTableDirEntry: 'name' from: fontData offset: anOffset) == nil ifTrue:[
^self error:'This font does not have a name table'].
(indexLocEntry := self getTableDirEntry: 'loca' from: fontData offset: anOffset) == nil ifTrue:[
^self error:'This font does not have a relocation table'].
(charMapEntry := self getTableDirEntry: 'cmap' from: fontData offset: anOffset) == nil ifTrue:[
^self error:'This font does not have a character map table'].
(glyphEntry := self getTableDirEntry: 'glyf' from: fontData offset: anOffset) == nil ifTrue:[
^self error:'This font does not have a glyph table'].
(horzHeaderEntry := self getTableDirEntry: 'hhea' from: fontData offset: anOffset) == nil ifTrue:[
^self error:'This font does not have a horizontal header table'].
(horzMetricsEntry := self getTableDirEntry: 'hmtx' from: fontData offset: anOffset) == nil ifTrue:[
^self error:'This font does not have a horizontal metrics table'].
(kerningEntry := self getTableDirEntry: 'kern' from: fontData offset: anOffset) == nil ifTrue:[
Transcript cr; show:'This font does not have a kerning table';endEntry].
(os2Entry := self getTableDirEntry: 'OS/2' from: fontData offset: anOffset) == nil ifTrue:[
Transcript cr; show: 'This font does not have a OS/2 table'; endEntry].
"Process the data"
indexToLocFormat := self processFontHeaderTable: headerEntry.
self processMaximumProfileTable: maxProfileEntry.
self processNamingTable: nameEntry.
glyphOffset := self processIndexToLocationTable: indexLocEntry format: indexToLocFormat.
+ cmaps := self processCharacterMappingTable: charMapEntry.
+ "cmaps explore."
+ cmaps := cmaps select: [:ea | ea isValid].
+ cmaps ifEmpty:[^self error:'This font has no suitable character mappings'].
- cmap := self processCharacterMappingTable: charMapEntry.
- (cmap == nil or:[cmap value == nil])
- ifTrue:[^self error:'This font has no suitable character mappings'].
self processGlyphDataTable: glyphEntry offsets: glyphOffset.
numHMetrics := self processHorizontalHeaderTable: horzHeaderEntry.
self processHorizontalMetricsTable: horzMetricsEntry length: numHMetrics.
kerningEntry isNil
ifTrue:[kernPairs := #()]
ifFalse:[self processKerningTable: kerningEntry].
os2Entry ifNotNil: [self processOS2Table: os2Entry].
+ charMap := self processCharMap: cmaps.
+ charMapENC := self processCharMapENC: cmaps. self flag: #leadingChar.
- charMap := self processCharMap: cmap.
- charMapENC := self processCharMapENC: cmap. self flag: #leadingChar.
fontDescription setGlyphs: glyphs mapping: charMap.
fontDescription setKernPairs: kernPairs.
^fontDescription!
More information about the Squeak-dev
mailing list
|