Marcel Taeumel uploaded a new version of System to project The Trunk: http://source.squeak.org/trunk/System-mt.1314.mcz
==================== Summary ====================
Name: System-mt.1314 Author: mt Time: 1 March 2022, 3:16:48.93235 pm UUID: 2d44416b-ecc6-4615-aa00-f7f663e15d7a Ancestors: System-mt.1313
TrueType fonts: When the user tries to change the system's default point size from 10.5pt to something else, change the #uiScaleFactor instead and inform the user. This way, we ensure that tools' pixel-based components (e.g., grip size or border width) don't have a strange scale relative to what #uiScaleFactor reports. See commentary in #referencePointSize and #referenceHeight.
Note that we currently have pixel-based scaling for small units (i.e., < 4 "px") and point-based scaling for many other things but not all (i.e., myFont widthOf: $m). For example, #initialExtent is also scaled based on pixels because tools are typically a compound mixed of pixel stuff and text/font stuff.
=============== Diff against System-mt.1313 ===============
Item was added: + ----- Method: UserInterfaceTheme class>>makeAllTTCBased (in category 'tools') ----- + makeAllTTCBased + "Converts all known themes to only use TrueType fonts. Use #cleanUpAndReset if you want to undo this later." + + self resetAfter: [ + self allThemes copy do: [:uit | uit isGenuine ifFalse: [uit unregister]]. + self allThemes do: [:uit | uit makeTTCBased]].!
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 and re-apply the current theme by name."
| 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. - (symbolicName = #standardSystemFont and: [aFont isTTCFont]) - ifTrue: [(self allThemes anySatisfy: [:uit | uit isTTCBased not]) ifTrue: [ - self resetAfter: [ - self allThemes copy do: [:uit | uit isGenuine ifFalse: [uit unregister]]. - self allThemes do: [:uit | uit makeTTCBased]]. - aFont pointSize ~= TTCFont referencePointSize ifTrue: [ - "Do not change current #scaleFactor by accident. Use standard point size." 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 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]]].
self allThemes do: [:uit | uit setFont: symbolicName to: fontToUse].!
Item was changed: ----- Method: UserInterfaceTheme>>installFixedFont: (in category 'private - fonts') ----- installFixedFont: aFont "Establish the default fixed text font and style"
| aStyle | self flag: #todo. "mt: Support derivatives such as bold and italic." + aStyle := aFont textStyleOrNil. "mt: Must be installed and thus never be nil!!" - aStyle := aFont textStyle. aStyle defaultFontIndex: (aStyle fontIndexOfPointSize: aFont pointSize "drop emphasis"). TextStyle setDefaultFixed: aStyle.!
Item was changed: ----- Method: UserInterfaceTheme>>installSystemFont: (in category 'private - fonts') ----- installSystemFont: aFont "Establish the default text font and style. Update the #defaultFontIndex in all known text styles to reflect the system's new default point size."
| aStyle | self flag: #todo. "mt: Support derivatives such as bold and italic." + aStyle := aFont textStyleOrNil. "mt: Must be installed and thus never be nil!!" - aStyle := aFont textStyle. aStyle defaultFontIndex: (aStyle fontIndexOfPointSize: aFont pointSize "drop emphasis").
TextStyle setDefault: aStyle. TextStyle actualTextStyles "no defaults" do: [:ea | ea isTTCStyle ifTrue: [ea defaultFont asPointSize: aFont pointSize "May generate new pointSize"]. ea defaultFontIndex: (ea fontIndexOfPointSize: aFont pointSize)]. RealEstateAgent resetScaleFactor. Flaps replaceToolsFlap. ScriptingSystem resetStandardPartsBin.!
squeak-dev@lists.squeakfoundation.org