[squeak-dev] The Trunk: Morphic-mt.1918.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Mar 2 08:43:53 UTC 2022
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1918.mcz
==================== Summary ====================
Name: Morphic-mt.1918
Author: mt
Time: 2 March 2022, 9:43:47.009783 am
UUID: 37cc13dd-cc57-4847-a3de-a133a6094c95
Ancestors: Morphic-mt.1917
FontImporterTool: Adds a simple way to apply the selected font (family) to all places in the system.
=============== Diff against Morphic-mt.1917 ===============
Item was changed:
----- Method: FontImporterTool>>applyFont (in category 'actions') -----
applyFont
| fontSymbols fontLabels choice |
fontSymbols := self fontSymbolsToUse.
fontLabels := fontSymbols collect: [:ea | (ea findFeatures joinSeparatedBy: ' ') capitalized].
+
+ fontSymbols := #(all allScaled), fontSymbols.
+ fontLabels := #('All fonts' 'All fonts (only font family)'), fontLabels.
+
choice := Project uiManager chooseFrom: fontLabels values: fontSymbols title: 'Apply font as...' translated.
choice ifNil: [^ self].
+
+ choice caseOf: {
+ [#all] -> [self applyFontToAll].
+ [#allScaled] -> [self applyFontToAllScaled]
+ } otherwise: [self applyFontTo: choice].!
- self applyFontTo: choice.!
Item was added:
+ ----- Method: FontImporterTool>>applyFontToAll (in category 'actions') -----
+ applyFontToAll
+
+ | fontSymbolsToApply fontToUse scaleFactorDelta |
+ (Project uiManager
+ confirm: 'Do you really want to overwrite individual\point sizes and emphases such as in\buttons and window titles?' translated withCRs
+ title: 'Apply Font to Everything' translated)
+ ifFalse: [^ self].
+
+ self currentSelection isInstalled ifFalse: [self installFont].
+
+ fontSymbolsToApply := self selectedFont hasFixedWidth
+ ifTrue: [self fontSymbolsToUse]
+ ifFalse: [
+ self inform: 'This font is not monospaced. It will\not replace the current one.' translated withCRs.
+ self fontSymbolsToUse copyWithout: #standardFixedFont].
+
+ fontToUse := self selectedFont.
+ scaleFactorDelta := 0.
+ self selectedFont pointSize ~= TTCFont referencePointSize ifTrue: [
+ scaleFactorDelta := ((fontToUse pointSize asFloat / TTCFont referencePointSize) roundTo: 0.25) - 1.0.
+ fontToUse := fontToUse asPointSize: TTCFont referencePointSize].
+
+ Cursor wait showWhile: [
+ UserInterfaceTheme makeAllTTCBased.
+ UserInterfaceTheme current applyAfter: [
+ fontSymbolsToApply do: [:fontSymbol |
+ UserInterfaceTheme setFont: fontSymbol to: fontToUse] ]].
+
+ scaleFactorDelta ~= 0 ifTrue: [
+ Display uiScaleFactor: Display uiScaleFactor + scaleFactorDelta.
+ self flag: #todo. "mt: Inform the user? See UserInterfaceTheme class >> #setFont:to:"].!
Item was added:
+ ----- Method: FontImporterTool>>applyFontToAllScaled (in category 'actions') -----
+ applyFontToAllScaled
+ "Like #applyFontToAll but keep the respective point sizes and emphases."
+
+ | fontSymbolsToApply |
+ self currentSelection isInstalled ifFalse: [self installFont].
+
+ fontSymbolsToApply := self selectedFont hasFixedWidth
+ ifTrue: [self fontSymbolsToUse]
+ ifFalse: [
+ self inform: 'This font is not monospaced. It will\not replace the current one.' translated withCRs.
+ self fontSymbolsToUse copyWithout: #standardFixedFont].
+
+ Cursor wait showWhile: [
+ UserInterfaceTheme makeAllTTCBased.
+ UserInterfaceTheme current applyAfter: [
+ fontSymbolsToApply do: [:fontSymbol | | fontToUse |
+
+ (UserInterfaceTheme current get: fontSymbol)
+ ifNil: [fontToUse := self selectedFont]
+ ifNotNil: [:usedFont |
+ fontToUse := (self selectedFont
+ asPointSize: usedFont pointSize)
+ emphasized: usedFont emphasis].
+
+ UserInterfaceTheme setFont: fontSymbol to: fontToUse] ]].!
More information about the Squeak-dev
mailing list
|