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

commits at source.squeak.org commits at source.squeak.org
Mon Mar 28 09:01:32 UTC 2022


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

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

Name: Graphics-mt.505
Author: mt
Time: 28 March 2022, 11:01:24.78109 am
UUID: 21fb6966-c70d-344e-9435-0a46778a197b
Ancestors: Graphics-mt.504

Tweaks the commentary around #uiScaleFactor.

=============== Diff against Graphics-mt.504 ===============

Item was changed:
  ----- Method: DisplayScreen>>uiScaleFactor (in category 'scale factor') -----
  uiScaleFactor
+ 	"Answers the current scale factor used to configure all widgets, tools, or windows to be prepared for the current rendering system, i.e., BitBlt. Note that 1.0 is usually the design space for pixel-based metrics such as #borderWidth or #layoutInset (if not based on font metrics)."
- 	"Answers the current scale factor used to configure all widgets, tools, or windows to be prepared for the current rendering system, i.e., BitBlt. Note that 1.0 means 'pixel perfect'."
  	
  	^ UserInterfaceTheme current isTTCBased
  		ifTrue: [TextStyle pixelsPerInch / 96.0 "Hide rounding errors in TTCFont >> #height."]
  		ifFalse: [RealEstateAgent scaleFactor roundTo: 0.25 "Force 25% steps. See, e.g., #doScale150."].!

Item was changed:
  ----- Method: DisplayScreen>>uiScaleFactor: (in category 'scale factor') -----
  uiScaleFactor: aFloat
+ 	"Sets the effective scale factor for the user interface, i.e., all widgets, tools, and windows. Note that the user can override the #platformScaleFactor, which is just a hint recommended by the platform."
- 	"Sets the effective scale factor for the user interface, i.e., all widgets, tools, and windows. The user can override the CurrentScaleFactor recommended by the platform."
  
+ 	| oldPixelFactor newPixelFactor newScaleFactor |
+ 	newScaleFactor := aFloat max: 0.75.
+ 	
+ 	(UserInterfaceTheme current canFakeScaleFactor: newScaleFactor) ifTrue: [
- 	| oldFactor newFactor |
- 	(UserInterfaceTheme current canFakeScaleFactor: aFloat) ifTrue: [
  		self flag: #isTTCBased.
+ 		^ UserInterfaceTheme current applyScaled: newScaleFactor].
+ 	
+ 	newScaleFactor = 0.75 ifTrue: [(Project uiManager
+ 		confirm: ('You are currently using <b>TrueType fonts</b>. Your requested scale factor of <b>{1}%</b> looks better using pre-rendered <b>pixel fonts</b>.<br><br>Do you want to switch to pixel fonts now?' translated format: {(newScaleFactor * 100) rounded}) asTextFromHtml
- 		^ UserInterfaceTheme current applyScaled: aFloat].
- 
- 	aFloat = 0.75 ifTrue: [(Project uiManager
- 		confirm: ('You are currently using <b>TrueType fonts</b>. Your requested scale factor of <b>{1}%</b> looks better using pre-rendered <b>pixel fonts</b>.<br><br>Do you want to switch to pixel fonts now?' translated format: {(aFloat * 100) rounded}) asTextFromHtml
  		title: 'Blurry Fonts Detected' translated) == true
+ 			ifTrue: [UserInterfaceTheme cleanUpAndReset. ^ self uiScaleFactor: newScaleFactor]].
- 			ifTrue: [UserInterfaceTheme cleanUpAndReset. ^ self uiScaleFactor: aFloat]].
  	
+ 	"Do nothing if the factor is unchanged. For comparison, use actual pixel-based scale factor to account for rounding errors, instead of #uiScaleFactor."
+ 	oldPixelFactor := RealEstateAgent scaleFactor. 
+ 	newScaleFactor = oldPixelFactor ifTrue: [^ self].
+ 		
+ 	"Update system's PPI to then compute the new pixel-based scale factor."
+ 	TextStyle pixelsPerInch: 96.0 * newScaleFactor.
+ 	newPixelFactor := RealEstateAgent resetScaleFactor; scaleFactor.
- 	oldFactor := RealEstateAgent scaleFactor. "Use effective, pixel-based factor to account for rounding errors. See #isTTCBased and #uiScaleFactor."
- 	newFactor := aFloat max: 0.75.
- 	newFactor = oldFactor ifTrue: [^ self].
  	
+ 	"Let the current project (kind) decide how to update the system."
+ 	Project current ifNotNil: [:p | p displayScaleChangedFrom: oldPixelFactor to: newPixelFactor].!
- 	TextStyle pixelsPerInch: 96.0 * aFloat.
- 	newFactor := RealEstateAgent resetScaleFactor; scaleFactor. "Again, account for rounding errors."
- 	Project current ifNotNil: [:p | p displayScaleChangedFrom: oldFactor to: newFactor].!



More information about the Squeak-dev mailing list