[Cuis-dev] Proposed LabelMorph update

ken.dickey at whidbey.com ken.dickey at whidbey.com
Thu Feb 5 13:27:52 PST 2026


As long as we are testing ;^)

I have seen drawing artifacts with LabelMorph and FontMorph instances 
where the text is at the edge of the Morph.

I did a push to the UI-DragAndDrop package for FontMorph, but LabelMorph 
is used much more widely.

Please try the attached changeSet and report anything 
strange/odd/broken.

Thanks much!
-KenD
-------------- next part --------------
'From Cuis7.7 [latest update: #7827] on 5 February 2026 at 1:08:51 pm'!

!LabelMorph methodsFor: 'geometry' stamp: 'KenD 5/Feb/2026 12:28:35'!
adjustExtent 
	"Some aspect of my font has changed. Don't shrink beyond minimum"

	self morphExtent: (self extentInOwner max: self minimumExtent)! !


!LabelMorph methodsFor: 'font' stamp: 'KenD 5/Feb/2026 12:12:55'!
emphasis: aNumber
	"Set the receiver's emphasis as indicated. aNumber is a bitmask with the following format:

	bit	attribute
	1	bold
	2	italic
	4	underlined
	8	struckThrough
	16	withUnderscoreGlyphs
	"

	"examples: 0 -> plain.  
	1 -> bold.  2 -> italic.  3 -> bold italic.  4 -> underlined  
	5 -> bold underlined.  6 -> italic underlined.   7 -> bold italic underlined   
	etc...

	Prefer AbstractFont method category: 'derivatives - emphasis' 
	to raw numbers:
	    self emphasis: AbstractFont boldItalic.
	etc."

	self font: font emphasis: aNumber.
	self morphExtent: self minimumExtent! !

!LabelMorph methodsFor: 'font' stamp: 'KenD 5/Feb/2026 12:13:07'!
font: aFont
	"Set the font my text will use. The emphasis remains unchanged."

	self font: aFont emphasis: emphasis.
	self morphExtent: self minimumExtent! !

!LabelMorph methodsFor: 'font' stamp: 'KenD 5/Feb/2026 12:13:29'!
fontFamily: aFontFamily
	"Set the font my text will use. The emphasis remains unchanged."

	self
		font: (aFontFamily atPointSize: (font
			ifNotNil: [ font pointSize ]
			ifNil: [ FontFamily defaultPointSize ]))
		emphasis: emphasis.
	self morphExtent: self minimumExtent! !

!LabelMorph methodsFor: 'initialization' stamp: 'KenD 5/Feb/2026 12:54:21'!
initialize
	super initialize.
	font := nil.
	emphasis := 0.
	padding := 12 at 2.
	self contents: 'Label Morph'
! !

!LabelMorph methodsFor: 'geometry' stamp: 'KenD 5/Feb/2026 12:55:32'!
minimumExtent

	^ self measureContents + (2 * self interiorOrigin) ! !



More information about the Cuis-dev mailing list