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

commits at source.squeak.org commits at source.squeak.org
Thu Jan 20 13:17:30 UTC 2022


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

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

Name: Graphics-mt.464
Author: mt
Time: 20 January 2022, 2:17:04.839835 pm
UUID: b5aedbe2-7763-1447-bdfa-52c599097e08
Ancestors: Graphics-mt.462

Cleans up the init code for fallback fonts. Always fall back by replacing the codepoint with a $? character. See #fallbackFont. Preserve sources to actually set a fallback font that has glyphs for more codepoints than the current one. See #setupDefaultFallbackTextStyleTo:.

=============== Diff against Graphics-mt.462 ===============

Item was added:
+ ----- Method: AbstractFont class>>defaultFallbackTextStyle (in category 'fallback') -----
+ defaultFallbackTextStyle
+ 	"Answer a text style that has fonts that support a lot of codepoints."
+ 	
+ 	^ TextConstants at: #DefaultFallbackTextStyle ifAbsent: [TextStyle default]!

Item was added:
+ ----- Method: AbstractFont class>>localeChanged (in category 'fallback') -----
+ localeChanged
+ 	self setupDefaultFallbackTextStyle.!

Item was added:
+ ----- Method: AbstractFont class>>setupDefaultFallbackFontTo: (in category 'fallback') -----
+ setupDefaultFallbackFontTo: aFont
+ 
+ 	self setupDefaultFallbackTextStyleTo: (TextStyle fontArray: {aFont}).!

Item was added:
+ ----- Method: AbstractFont class>>setupDefaultFallbackTextStyle (in category 'fallback') -----
+ setupDefaultFallbackTextStyle
+ 
+ 	| defaultStyle |
+ 	defaultStyle := self defaultFallbackTextStyle.
+ 	TextStyle knownTextStylesWithoutDefault do: [:styleName |
+ 		(TextStyle named: styleName) fontArray do: [:each |
+ 			each setupDefaultFallbackTextStyleTo: defaultStyle]].!

Item was added:
+ ----- Method: AbstractFont class>>setupDefaultFallbackTextStyleTo: (in category 'fallback') -----
+ setupDefaultFallbackTextStyleTo: aTextStyle
+ 
+ 	TextConstants at: #DefaultFallbackTextStyle put: aTextStyle.
+ !

Item was added:
+ ----- Method: AbstractFont>>fallbackFont (in category 'accessing') -----
+ fallbackFont
+ 	"Answers the fallbackFont for the receiver. The fallback font must be some derivative of the receiver since it will not be asked to install itself properly on the target BitBlt so rendering a completely different font here is simply not possible. The default implementation uses a synthetic font that maps all characters to question marks."
+ 
+ 	^ FixedFaceFont new errorFont baseFont: self!

Item was added:
+ ----- Method: AbstractFont>>fallbackFont: (in category 'initialize-release') -----
+ fallbackFont: aFont
+ 	"Reset fallback font. Ignore. See #fallbackFont."!

Item was added:
+ ----- Method: AbstractFont>>reset (in category 'initialize-release') -----
+ reset
+ 	"Clear all caches."!

Item was added:
+ ----- Method: AbstractFont>>setupDefaultFallbackTextStyleTo: (in category 'initialize-release') -----
+ setupDefaultFallbackTextStyleTo: aTextStyle
+ 
+ "	| fonts f |
+ 	fonts := aTextStyle fontArray.
+ 	f := fonts first.
+ 	f familyName = self familyName ifTrue: [^ self].
+ 	1 to: fonts size do: [:i |
+ 		self height > (fonts at: i) height ifTrue: [f := fonts at: i].
+ 	]."
+ 
+ 	self derivativeFonts do: [:each |
+ 		each setupDefaultFallbackTextStyleTo: aTextStyle].
+ 
+ 	self flag: #todo. "mt: Figure out a way to lookup useful fallback fonts."
+ 
+ 	self fallbackFont: nil.
+ 	self reset.!

Item was removed:
- ----- Method: StrikeFont class>>localeChanged (in category 'font creation') -----
- localeChanged
- 	self setupDefaultFallbackFont!

Item was changed:
  ----- Method: StrikeFont>>fallbackFont (in category 'accessing') -----
  fallbackFont
+ 	"Overwritten to add a cache."
+ 	
+ 	^ fallbackFont ifNil: [fallbackFont := super fallbackFont]!
- 	"Answers the fallbackFont for the receiver. The fallback font must be some derivative of the receiver since it will not be asked to install itself properly on the target BitBlt so rendering a completely different font here is simply not possible. The default implementation uses a synthetic font that maps all characters to question marks."
- 	^ fallbackFont
- 		ifNil: [fallbackFont := FixedFaceFont new errorFont baseFont: self]!

Item was removed:
- ----- Method: StrikeFont>>setupDefaultFallbackFont (in category 'emphasis') -----
- setupDefaultFallbackFont
- 	"This used to be the default textstyle, but it needs to be a StrikeFont and not a TTCFont and sometimes the default textstyle is a TTCFont.  So, we use a typical StrikeFont as the default fallback font."
- 	self fallbackFont: (StrikeFont defaultSized: self height).
- 	self reset.
- 
- !

Item was changed:
  ----- Method: TextStyle class>>defaultFamilyNames (in category 'TextConstants access') -----
  defaultFamilyNames
+ 	^#(DefaultTextStyle DefaultFixedTextStyle DefaultMultiStyle DefaultFallbackTextStyle)!
- 	^#(DefaultTextStyle DefaultFixedTextStyle DefaultMultiStyle)!



More information about the Squeak-dev mailing list