[squeak-dev] The Trunk: System-mt.1301.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Feb 5 14:54:33 UTC 2022
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1301.mcz
==================== Summary ====================
Name: System-mt.1301
Author: mt
Time: 5 February 2022, 3:54:29.258491 pm
UUID: c97689f7-27f8-614d-92c0-4eea9a79b97a
Ancestors: System-mt.1300
Various fixes around UI-theme switching. Especially when switching to 75% scale factor, ask the user to install pre-rendered (and sharper) fonts again if necessary. Also inform the user when UI themes get converted to TrueType fonts automatically when that user changes the system's default font to a TrueType font. And there was a bug when the user tried to scale to 75/100/125/150 again while using TrueType fonts all over the place already.
=============== Diff against System-mt.1300 ===============
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 resetAfter: [
- aFont isTTCFont ifTrue: [
- self flag: #discuss. "mt: Should we issue a warning here?"
- (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.
+ 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 makeTTCBased]] ]].
self allThemes do: [:uit |
+ uit setFont: symbolicName to: fontToUse].!
- uit setFont: symbolicName to: aFont].!
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'].
- ifFalse: [^ self error: 'Can only set 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.!
Item was changed:
----- Method: UserInterfaceTheme>>canFakeScaleFactor: (in category 'private - display scale') -----
canFakeScaleFactor: aFloat
"Answer whether we can fake the given scale factor with pre-rendered fonts."
self isTTCBased ifFalse: [^ true "Need to #makeTTCBased anyway."].
+ self isFullyTTCBased ifTrue: [^ false "Without a fake 100%, we go all-in with TrueType fonts."].
- (self lookupScaleFactor: 1.0) ifNil: [^ false "Without a fake 100%, we go all-in with TrueType fonts."].
aFloat = 0.75 ifTrue: [^ true].
aFloat = 1.0 ifTrue: [^ true].
aFloat = 1.25 ifTrue: [^ true].
aFloat = 1.5 ifTrue: [^ true].
^ false!
Item was changed:
----- Method: UserInterfaceTheme>>doScale075 (in category 'private - display scale') -----
doScale075
"Private. Use #applyScaled:. This is actually about 71% because of which font sizes we have available."
self flag: #hack. "mt: A different scale factor should not result in different point sizes being selected BUT the same point size resulting in a different pixel height."
self setFonts: #(
standardSystemFont 7.5
+ standardFixedFont (Accumon 8.5)
- standardFixedFont 7.5
standardCodeFont 7.5
standardListFont 7.5
standardButtonFont 7.5
standardMenuFont 7.5
standardFlapFont 7.5
windowTitleFont 7.5
balloonHelpFont 7.5
haloLabelFont 7.5
wizardStandardFont 10.5
wizardButtonFont 10.5
wizardHelpFont 7.5
wizardTitleFont 16.5) forceTTC: false.
self apply.
TextStyle pixelsPerInch: 96.0. "Restore Squeak's default PPI for 100%."!
Item was added:
+ ----- Method: UserInterfaceTheme>>isFullyTTCBased (in category 'private - display scale') -----
+ isFullyTTCBased
+ "Answer whether all themes have been converted to TrueType."
+
+ ^ (self lookupScaleFactor: 1.0) isNil!
Item was changed:
----- Method: UserInterfaceTheme>>setFonts:forceTTC: (in category 'private - display scale') -----
setFonts: specs forceTTC: forceTTC
"Change fonts. Do not apply the receiver. Replace StrikeFont with TTCFont if forceTTC or target pointSize not available."
| theme100 |
theme100 := self checkTheme100.
+ specs groupsDo: [:symbolicFontName :newPointSize | | pointSizeToUse familyNameToUse font100 fontScaled |
- specs groupsDo: [:symbolicFontName :newPointSize | | font100 fontScaled |
font100 := theme100 get: symbolicFontName.
+ newPointSize isArray
+ ifFalse: [
+ familyNameToUse := font100 familyName.
+ pointSizeToUse := newPointSize]
+ ifTrue: [ "Switch font family"
+ familyNameToUse := newPointSize first.
+ pointSizeToUse := newPointSize second].
+ fontScaled := (font100 isTTCFont and: [familyNameToUse = font100 familyName "Hacky..."])
+ ifTrue: [TTCFont familyName: familyNameToUse pointSize: pointSizeToUse emphasis: font100 emphasis]
+ ifFalse: [StrikeFont familyName: familyNameToUse pointSize: pointSizeToUse emphasized: font100 emphasis].
+ (fontScaled pointSize ~= pointSizeToUse or: [forceTTC and: [fontScaled isTTCFont not]])
+ ifTrue: [fontScaled := TTCFont familyName: self ttcFallbackName pointSize: pointSizeToUse emphasis: font100 emphasis].
+ self assert: [fontScaled pointSize = pointSizeToUse].
- fontScaled := font100 isTTCFont
- ifTrue: [TTCFont familyName: font100 familyName pointSize: newPointSize emphasis: font100 emphasis]
- ifFalse: [StrikeFont familyName: font100 familyName pointSize: newPointSize emphasized: font100 emphasis].
- (fontScaled pointSize ~= newPointSize or: [forceTTC and: [fontScaled isTTCFont not]])
- ifTrue: [fontScaled := TTCFont familyName: self ttcFallbackName pointSize: newPointSize emphasis: font100 emphasis].
- self assert: [fontScaled pointSize = newPointSize].
self set: symbolicFontName to: fontScaled].!
Item was changed:
----- Method: UserInterfaceTheme>>setScaleFactor: (in category 'private - display scale') -----
setScaleFactor: aFloat
"Private. Use #applyScaled:. In the receiver, change the fonts to have a scale of aFloat. Change all fonts to be TrueType fonts if no pre-rendered fonts exist. Never change the 100% reference theme but make a copy. Apply the receiver to the system."
(self isTTCBased not and: [aFloat = self localScaleFactor])
ifTrue: [self apply. ^ self].
(self isTTCBased not and: [self localScaleFactor = 1.0]) "!!!! Never change the reference theme !!!!"
ifTrue: [^ self lookupSimilar ifNil: [self copyWithScaleFactor: aFloat] ifNotNil: [:other | other setScaleFactorPreApply: aFloat]].
+ self isFullyTTCBased ifFalse: [
+ aFloat = 0.75 ifTrue: [^ self doScale075].
+ aFloat = 1.0 ifTrue: [^ self doScale100].
+ aFloat = 1.25 ifTrue: [^ self doScale125].
+ aFloat = 1.5 ifTrue: [^ self doScale150]].
- aFloat = 0.75 ifTrue: [^ self doScale075].
- aFloat = 1.0 ifTrue: [^ self doScale100].
- aFloat = 1.25 ifTrue: [^ self doScale125].
- aFloat = 1.5 ifTrue: [^ self doScale150].
"And now transition from the pre-rendered world into the TrueType world. Or re-use an existing TrueType-based theme with new values. See #lookupSimilar above."
TextStyle pixelsPerInch: 96.0 * RealEstateAgent scaleFactor "current, based on pixels".
self makeTTCBased.
self applyAfter: [TextStyle pixelsPerInch: 96.0 * aFloat "new, not rounded"].!
More information about the Squeak-dev
mailing list
|