[squeak-dev] The Trunk: Graphics-mt.468.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jan 30 19:17:12 UTC 2022


Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-mt.468.mcz

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

Name: Graphics-mt.468
Author: mt
Time: 30 January 2022, 8:17:05.704695 pm
UUID: 1f47d2db-9a76-f747-9613-9df0594a4d76
Ancestors: Graphics-mt.467

Fixes an issue in regarding #widthOf: for pre-renderend fonts that have holes in their supported code-point range. See commentary in #asGlyphForCode:.

Since Squeak's internal encoding is based on Unicode code points, make it explicit by renaming #minAscii and #maxAscii to #minCodePoint and #maxCodePoint. The comments already explained that.

=============== Diff against Graphics-mt.467 ===============

Item was added:
+ ----- Method: AbstractFont>>asNewTextStyle (in category 'converting') -----
+ asNewTextStyle
+ 	"Answer a new text style where the receiver is the default font. Try to lookup the an existing #textStyle so that TextFontChange can be used in views."
+ 	
+ 	| newTextStyle |
+ 	newTextStyle := self textStyleOrNil
+ 		ifNil: [TextStyle fontArray: {self}]
+ 		ifNotNil: [:style | style copy].
+ 	newTextStyle defaultFontIndex: (newTextStyle fontIndexOfPointSize: self pointSize).	
+ 	^ newTextStyle!

Item was added:
+ ----- Method: AbstractFont>>maxCodePoint (in category 'accessing') -----
+ maxCodePoint
+ 	"Answer the largest code point that the receiver can translate into glyphs. Use the range from #minCodePoint to #maxCodePoint to configure a list of #fallbackFont's. Note that subclasses may insert 'holes' via #hasGlyphOf: test such as StrikeFont's internal xTable."
+ 	
+ 	^ 16r10FFFF "Unicode uses 21-bit but 16r110000 to 16r1FFFFF are not valid code points. See https://www.unicode.org/versions/stats/."!

Item was added:
+ ----- Method: AbstractFont>>minCodePoint (in category 'accessing') -----
+ minCodePoint
+ 	"Answer the smallest code point that the receiver can translate into glyphs. Use the range from #minCodePoint to #maxCodePoint to configure a list of #fallbackFont's. Note that subclasses may insert 'holes' via #hasGlyphOf: test such as StrikeFont's internal xTable."
+ 	
+ 	^ 0!

Item was changed:
  ----- Method: FixedFaceFont>>maxAscii (in category 'accessing') -----
  maxAscii
+ 
+ 	self flag: #deprecated.
+ 	^ self maxCodePoint!
- 	^ SmallInteger maxVal!

Item was added:
+ ----- Method: FixedFaceFont>>maxCodePoint (in category 'accessing') -----
+ maxCodePoint
+ 	"Overwritten for robustness. The receiver MUST BE a reliable source of glyphs if all else fails. Font rendering must never stop."
+ 	
+ 	^ SmallInteger maxVal!

Item was changed:
  ----- Method: StrikeFont>>hasGlyphForCode: (in category 'multibyte character methods') -----
  hasGlyphForCode: aCharacterCode
+ 	"Note that missing glyphs are encoded as -1 in the xTable but to speed up the #widthOf: check, the next offset must be adjacent and thus be duplicated. For example: #(-1 -1 0 24 -1 -1 -1 24 48 -1 ...). Since aCharacterCode is 0-based, that codes offset is at +1 while its width needs to consult +2, too. See #widthOf:." 
  
  	(aCharacterCode between: self minAscii and: self maxAscii)
  		ifFalse: [^ false].
+ 	(xTable at: aCharacterCode + 2) >= 0
- 	(xTable at: aCharacterCode + 1) positive
  		ifFalse: [^ false].
+ 	^ true!
- 	^ true.
- !

Item was changed:
  ----- Method: StrikeFont>>maxAscii (in category 'accessing') -----
  maxAscii
- 	"Answer the integer that is the last Ascii character value of the receiver."
  
+ 	self flag: #deprecated.
+ 	^ self maxCodePoint!
- 	^maxAscii!

Item was added:
+ ----- Method: StrikeFont>>maxCodePoint (in category 'accessing') -----
+ maxCodePoint
+ 	"Overwritten to configure ranges of glyphs per pre-rendered font."
+ 
+ 	^maxAscii!

Item was changed:
  ----- Method: StrikeFont>>minAscii (in category 'accessing') -----
  minAscii
- 	"Answer the integer that is the first Ascii character value of the receiver."
  
+ 	self flag: #deprecated.
+ 	^ self minCodePoint!
- 	^minAscii!

Item was added:
+ ----- Method: StrikeFont>>minCodePoint (in category 'accessing') -----
+ minCodePoint
+ 	"Overwritten to configure ranges of glyphs per pre-rendered font."
+ 
+ 	^minAscii!



More information about the Squeak-dev mailing list