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

commits at source.squeak.org commits at source.squeak.org
Mon May 25 08:53:45 UTC 2020


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

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

Name: Morphic-mt.1661
Author: mt
Time: 25 May 2020, 10:53:39.154474 am
UUID: 4adc6920-02b1-7f44-929b-a8291944dff2
Ancestors: Morphic-mt.1660

Makes StringMorph >> #font:emphasis: more robust and clear. Thanks to Martin Kuball and Subbu (kks)!

=============== Diff against Morphic-mt.1660 ===============

Item was changed:
  ----- Method: StringMorph>>font:emphasis: (in category 'accessing - convenience') -----
+ font: aFontOrNil emphasis: emphasisCodeOrNil
+ 	"For convenience only. Try to use #font: and #emphasis: instead.
+ 	
+ 	Changes font and/or emphasis. If both are given, the font's current emphasis will be discarded. If only the emphasis is given, the system's default font will be used. If only the font is given, the font's emphasis will be cached so that future calls to #font: will keep the emphasis."
- font: aFont emphasis: emphasisCode
  
  	self
+ 		assert: aFontOrNil notNil | emphasisCodeOrNil notNil
+ 		description: 'Either font or emphasis must be non-nil.'.
+ 		
+ 	self
+ 		setFont: ((aFontOrNil isNil or: [aFontOrNil emphasis = emphasisCodeOrNil] or: [emphasisCodeOrNil isNil])
+ 			ifTrue: [aFontOrNil]
+ 			ifFalse: [aFontOrNil emphasized: emphasisCodeOrNil])
+ 		emphasis: (emphasisCodeOrNil ifNil: [aFontOrNil emphasis]).
+ 		
+ 	"self assert: self font emphasis = self emphasis. --- mt: Does not always work because of how StrikeFont treats emphasis 0 in #emphasized:."!
- 		setFont: ((aFont isNil or: [aFont emphasis = emphasisCode] or: [emphasisCode isNil])
- 			ifTrue: [aFont]
- 			ifFalse: [aFont emphasized: emphasisCode])
- 		emphasis: (emphasisCode ifNil: [aFont emphasis]).!



More information about the Squeak-dev mailing list