[Cuis-dev] learning about fonts

ken.dickey at whidbey.com ken.dickey at whidbey.com
Sat Jul 20 10:39:44 PDT 2024


On 2024-07-20 10:30, Mark Volkmann via Cuis-dev wrote:

> - get a list of all the installed fonts
> - get an instance of a given font with a specific point size
> 
> Can someone share how to do those?

Sure.  The UI-MetaProperties package -- soon to be renamed 
UI-VisualMetaProperties has code to "edit" a font.

The code (copied below) first sets a font and then its size.

I suspect you can further unravel from this thread..  ;^)

	props at: #acceptsFont
		    put: (MetaProperty
				kind: AbstractFont
				editProc: [ :morph :metaProp :menuItem |
					| oldFont fontFamily fontSize newFont |
					oldFont := menuItem propertyValue.
					fontSize := oldFont pointSize.
					fontFamily := FontFamily promptUser.
					fontSize := FontFamily promptUserForSize: fontSize fontFamily: 
fontFamily.
					newFont := fontFamily atPointSize: fontSize.
					newFont ifNotNil: [ :f | menuItem propertyValue: f. morph 
redrawNeeded ] ]  ).

Good on ya,
-KenD


More information about the Cuis-dev mailing list