[squeak-dev] The Inbox: TrueType-EG.72.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Feb 8 13:33:49 UTC 2022


A new version of TrueType was added to project The Inbox:
http://source.squeak.org/inbox/TrueType-EG.72.mcz

==================== Summary ====================

Name: TrueType-EG.72
Author: EG
Time: 8 February 2022, 8:22:21.647553 am
UUID: 30a1fb32-8d4c-45f6-853d-4b6727e2149c
Ancestors: TrueType-EG.71

Removing leftover halt message

=============== Diff against TrueType-mt.68 ===============

Item was changed:
  ----- Method: TTCharacterMappingTable>>isUnicode (in category 'testing') -----
  isUnicode
  
+ 	"A cmap is considered Unicode if either:
+ 	 a) the platformID is 0, ie the Unicode platform; or
+ 	 b) The platformID is Windows (3) and the encodingID is Unicode for Windows (10).
+ 	 See the 'cmap encoding subtables' section of https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6cmap.html"
+ 	^ (platformID = 0) or: [
+ 		(platformID = 3 and: [ encodingID = 10 ])]!
- 	^ platformID = 0!

Item was added:
+ ----- Method: TTFontReader>>decodeCmapFmtTable12: (in category 'private') -----
+ decodeCmapFmtTable12: entry
+ 	"Segmented coverage for supplementary range unicode chars.
+ 	See https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#format-0-byte-encoding-table"
+ 	| length language numGroups cmap groups |
+ 	entry nextUShort. "This is ignored, so we now align to 32-bit values"
+ 	length := entry nextULong.
+ 	language := entry nextULong.
+ 	numGroups := entry nextULong.
+ 	groups := Array new: numGroups.
+ 	
+ 	1 to: numGroups do: [ :num |
+ 		groups at: num put: {
+ 			entry nextULong. "startCharCode"
+ 			entry nextULong. "endCharCode"
+ 			entry nextULong. "startGlyphId"
+ 			0. "End glyph id will be calculated"}].
+ 		
+ 	"Groups are in order, so the last group's endCharcode is
+ 	the full size of the character map"
+ 	cmap := Array new: (groups last second + 1) withAll: 0.
+ 	
+ 	groups do: [ :groupData |
+ 		| codeStart codeEnd |
+ 		codeStart := groupData first.
+ 		codeEnd := groupData second.
+ 		codeStart to: codeEnd do: [ :index |
+ 			cmap at: (index + 1) put: (groupData third + (index - codeStart))]].
+ 
+ 	^ {language. cmap}
+ 	!

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].
+ 			[12] -> [self decodeCmapFmtTable12: entry].
  		} otherwise: [
  			Transcript showln: '[TTFontReader] Unsupported encoding of cmap: ', cmapFmt.
  			{nil.nil}]!

Item was changed:
  ----- Method: TTFontReader>>processCharMap: (in category 'processing - support') -----
  processCharMap: mappingTables
  	"Process the given character map. Prefer Unicode mappings"
+ 	"According to https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6cmap.html
+ 	we should not only prefer Unicode cmaps, but should prioritize cmaps not restricted to BMP. Therefore
+ 	if there are multiple Unicode maps we need to select the first best option"
  
+ 	"^ mappingTables
- 	^ mappingTables
  		detect: [:ea | ea isUnicode]
  		ifFound: [:table | table map: glyphs]
+ 		ifNone: [mappingTables last map: glyphs]"
+ 	
+ 	| unicode result |
+ 	unicode := mappingTables select: [ :cmap | cmap isUnicode ].
+ 	unicode size = 1 ifTrue: [ ^ unicode first map: glyphs ].
+ 	unicode size = 0 ifTrue: [ ^ mappingTables last map: glyphs ].
+ 	
+ 	"Otherwise, we have multiple Unicode maps. In lieu of selecting
+ 	the one not restricted to BMP, we pick the one with the largest
+ 	character range. There might be a better way to handle this."
+ 	result := unicode first.
+ 	unicode do: [ :cmap |
+ 		cmap characterMap size > result characterMap size
+ 			ifTrue: [ result := cmap]].
+ 	^ result map: glyphs!
- 		ifNone: [mappingTables last map: glyphs]!



More information about the Squeak-dev mailing list