[squeak-dev] The Trunk: System-mt.1317.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Mar 2 10:55:05 UTC 2022


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

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

Name: System-mt.1317
Author: mt
Time: 2 March 2022, 11:55:00.421065 am
UUID: f005548a-6d1b-f244-b033-8bc84eba7121
Ancestors: System-mt.1316

Finally decouple #standardDefaultTextFont from how #scaleFactor is computed in RealEstateAgent.

=============== Diff against System-mt.1316 ===============

Item was changed:
  ----- Method: RealEstateAgent class>>scaleFactor (in category 'display scale') -----
  scaleFactor
  	"Use the default font height to calculate some factor. Note that, in a distant future, we will be able to use a method that is not based on pixels once we only use TrueType fonts all over the image and have a rendering system other than BitBlt. Then, TextStyle class >> #pixelsPerInch will suffice, considering that 96 PPI represents a scale factor of 1.0. Until then, rendering is based on pixel geometry."
  	
+ 	^ ScaleFactor ifNil: [ScaleFactor := (TextStyle referenceHeight / StrikeFont referenceHeight)]!
- 	^ ScaleFactor ifNil: [ScaleFactor := (TextStyle defaultFont height / StrikeFont referenceHeight)]!

Item was changed:
  ----- Method: UserInterfaceTheme class>>setFont:to: (in category 'tools - fonts') -----
  setFont: symbolicName to: aFont
+ 	"Set symbolicName to aFont in all known UI themes. If aFont is a TrueType font, transform all themes into TTC-based ones."
- 	"Set symbolicName to aFont in all known UI themes. If aFont is a TrueType font, transform all themes into TTC-based ones and re-apply the current theme by name."
  
+ 	(symbolicName = #standardSystemFont and: [aFont isTTCFont])
+ 		ifTrue: [self makeAllTTCBased].
- 	| fontToUse |
- 	fontToUse := aFont.
- 	(symbolicName = #standardSystemFont and: [aFont isTTCFont]) ifTrue: [
- 		(self allThemes anySatisfy: [:uit | uit isTTCBased not])
- 			ifTrue: [
- 				self makeAllTTCBased.
- 				aFont pointSize ~= TTCFont referencePointSize ifTrue: [	
- 					"Do not change current #scaleFactor by accident. Use standard point size."
- 					fontToUse := aFont asPointSize: TTCFont referencePointSize.
- 					self inform: ((('Your system is now using <b>TrueType</b> fonts. The point size you specified was reset to <b>{1}pt</b> to retain the system''s current scale factor of <b>{2}%.</b>\\You can repeat this if you really want to use <b>{3}pt</b>. However, it is advised to change the <b>system''s scale factor</b> if you want to make all fonts look smaller or larger on your current display.\See the menu <b>Extras > Scale Factor</b>.' translated withCRs format: {fontToUse pointSize. (Display relativeUiScaleFactor * 100) rounded. aFont pointSize}) withNoLineLongerThan: 70) copyReplaceAll: String cr with: '<br>') asTextFromHtml]]
- 			ifFalse: [ "The user tried to increase the system's overall font size. Increase the scale factor instead. See RealEstateAgent class >> #scaleFactor, which is what all client code uses if it does not scale through font metrics."
- 				| scaleFactorDelta |
- 				scaleFactorDelta := ((aFont pointSize asFloat / TTCFont referencePointSize) roundTo: 0.25) - 1.0.
- 				fontToUse := aFont asPointSize: TTCFont referencePointSize.
- 				scaleFactorDelta = 0 ifFalse: [
- 					Display uiScaleFactor: Display uiScaleFactor + scaleFactorDelta.
- 					self inform: ((('You tried to change the system''s standard font size from <b>{1}pt</b> to <b>{2}pt</b>, which is an increase of about <b>{3}%</b>. As a result, the system''s scale factor was changed to <b>{4}%</b>.\\Other fonts will now appear smaller or larger as well. The system''s standard font size remains at <b>{1}pt</b>. Note that you may also edit the font''s <b>extra glyph scale</b> to make it look smaller or larger at the same point size.'translated withCRs format: {TTCFont referencePointSize. aFont pointSize. (scaleFactorDelta * 100) rounded. (Display relativeUiScaleFactor * 100) rounded.}) withNoLineLongerThan: 70) copyReplaceAll: String cr with: '<br>') asTextFromHtml]] ].
  
  	self allThemes do: [:uit |
+ 		uit setFont: symbolicName to: aFont].!
- 		uit setFont: symbolicName to: fontToUse].!

Item was changed:
  ----- Method: UserInterfaceTheme class>>setSystemFontTo: (in category 'tools - fonts') -----
  setSystemFontTo: aFont
  	"Establish the default text font and style"
  
  	aFont isTTCFont not ifTrue: [
  		Display uiScaleFactor = 1.0
  			ifFalse: [^ self error: 'You may only set a pre-rendered font for 100% scale factor'].
  		aFont height = StrikeFont referenceHeight
  			ifFalse: [^ self error: ('Incompatible pre-rendered font for 100% scale factor. Height must be {1} px' format: {StrikeFont referenceHeight})]].
  
- "Documentation only. Users can increase the default font size to any value. Yet, RealEstateAgent class >> #scaleFactor will change and the system effectively render stuff larger. So, it would be a good idea to keep #pixelSize/#height of system font, list font, and menu font similar.
- 
- 	(aFont isTTCFont and: [aFont pointSize ~= TTCFont referencePointSize])
- 		ifTrue: [self notify: ('The standard system/text font should be {1} pt. If you want to increase the overall font size, please change the screen scale factor instead. You may proceed without harm.' format: {TTCFont referencePointSize})].
- "
  	self setFont: #standardSystemFont to: aFont.!



More information about the Squeak-dev mailing list