[squeak-dev] The Trunk: Morphic-mt.1927.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Mar 7 10:16:27 UTC 2022


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

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

Name: Morphic-mt.1927
Author: mt
Time: 7 March 2022, 11:16:21.167204 am
UUID: c193033d-9ac4-4f4e-a26d-9d0875cdb34e
Ancestors: Morphic-mt.1926

FontImporterTool:
- Select the default TrueType font when opening the tool
- Rely on #selectedFont never being 'nil'
- Auto-select parent when collapsing a subtree of subfamilies in font tree on the left.

=============== Diff against Morphic-mt.1926 ===============

Item was changed:
  ----- Method: FontImporterTool>>currentSelection: (in category 'font list/tree') -----
  currentSelection: fontHandleOrNil
  
+ 	fontHandleOrNil = currentSelection ifTrue: [
+ 		^ self].
- 	fontHandleOrNil = currentSelection ifTrue: [^ self].
- 	currentSelection := fontHandleOrNil.
- 	self changed: #currentSelection.
  	
  	fontHandleOrNil
+ 		ifNil: [
+ 			"User probably collapsed subtree with prior selection."
+ 			self selectTextStyleNamed: self selectedFont textStyleName]
+ 		ifNotNil: [
+ 			currentSelection := fontHandleOrNil.
+ 			self changed: #currentSelection].
+ 	
+ 	fontHandleOrNil
  		ifNotNil: [self editModeEnabled: self currentSelection isModified].
  	
+ 	self selectedFont: nil. "Refresh preview"
+ 	
+ 	!
- 	self selectedFont: nil. "Refresh preview"!

Item was changed:
  ----- Method: FontImporterTool>>initialize (in category 'initialize') -----
  initialize
  
  	super initialize.
  
+ 	previewTextSelector := #textSample.
+ 	self selectTextStyleNamed: self selectedFont textStyleName.!
- 	previewTextSelector := #textSample.!

Item was changed:
  ----- Method: FontImporterTool>>previewText (in category 'preview text') -----
  previewText
  	"Answer the current preview text. Avoid using a text with font-reference attributes so that any not-yet-installed font does not get spreaded across the system. See #selectedFontTextStyle to learn how the preview is rendered using the selected font."
  
- 	self selectedFont ifNil: [^ ''].
  	self customPreviewText ifNotEmpty: [:text | ^ text withCRs].
  	
  	previewTextSelector = #fontSample ifTrue: [
  		^ self selectedFont ttcDescription sampleText
  			ifEmpty: [self errorText: 'This font does not provide a sample text.' translated]].
  
  	(previewTextSelector ~= #textSample and: [self selectedFont isSymbolFont])
  		ifTrue: [^ self errorText: 'This symbol font does not support the preview text.\Please use ''Text/Symbol'' or type a custom text.' translated withCRs].
  
  	self selectedFont isSymbolFont
  		ifTrue: [^ self selectedFont symbolSample asString].
  	(Text respondsTo: previewTextSelector)
  		ifTrue: [^ (Text perform: previewTextSelector) asString].
  	previewTextSelector = #widgetSample
  		ifTrue: [^ self widgetSample].
  		
  	^ ''!

Item was added:
+ ----- Method: FontImporterTool>>selectTextStyleNamed: (in category 'initialize') -----
+ selectTextStyleNamed: textStyleName
+ 
+ 	currentSelection := (self allFonts detect: [:handle | handle textStyleName = self selectedFont textStyleName]).
+ 	self changed: #currentSelection.!

Item was changed:
  ----- Method: FontImporterTool>>selectedFont (in category 'accessing') -----
  selectedFont
  	
  	^ selectedFont ifNil: [selectedFont := self currentSelection
+ 		ifNil: [TextStyle defaultTTFont]
- 		ifNil: [TextStyle defaultFont]
  		ifNotNil: [:o | o fontOfPointSize: self pointSize] ]!

Item was changed:
  ----- Method: FontImporterTool>>selectedFontTextStyle (in category 'accessing') -----
  selectedFontTextStyle
  	"Construct a new text style from the #selectedFont."
  	
+ 	^( self currentSelection
+ 		ifNil: [TextStyle defaultTT copy]
+ 		ifNotNil: [:handle | handle textStyleOfPointSize: self pointSize])
+ 			lineSpacing: ((lineSpacing isNil and: [self selectedFont isSymbolFont])
+ 				ifTrue: [ 0.3 ]
+ 				ifFalse: [ self lineSpacing ]);
+ 			yourself
- 	^ (TextStyle fontArray: {self selectedFont})
- 		lineSpacing: ((lineSpacing isNil and: [self selectedFont isSymbolFont])
- 			ifTrue: [ 0.3 ]
- 			ifFalse: [ self lineSpacing ]);
- 		yourself
  		
  		!

Item was changed:
  ----- Method: FontImporterTool>>windowTitle (in category 'ui - building') -----
  windowTitle
  
+ 	^ 'Font Importer: ', self selectedFont familyName!
- 	^ 'Font Importer', (self currentSelection
- 		ifNil: ['']
- 		ifNotNil: [:desc | ': ', desc familyName])!



More information about the Squeak-dev mailing list