[Cuis-dev] learning about fonts
Hilaire Fernandes
hfern at free.fr
Sat Jul 20 13:52:51 PDT 2024
Things to explore, code extracted from DrGeo:
TrueTypeFontFamily readTrueTypeFontEntry: self fontPath // languageFont
file.
PreferenceSet setDefaultFont: languageFont family.
Preferences at: #defaultFontSize put: 12.
PreferenceSet setDefaultFont: 'DejaVu Sans'.
Preferences at: #defaultFontSize put: 11.
fontOfSize: anInteger
^ FontFamily defaultFamilyPointSize: (Theme current scale: anInteger)
You will have to fill the hole and experiment. I have not explored much
font usage beside these code snippet.
Try loading a font, then from the inspector find how to change its size.
There are clues in Ken message.
Hilaire
Le 20/07/2024 à 19:55, Mark Volkmann via Cuis-dev a écrit :
> Thanks Ken!
> Is there a shorter way to just get the "default" font?
>
> On Sat, Jul 20, 2024 at 12:39 PM <ken.dickey at whidbey.com> wrote:
>
> 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
>
>
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240720/8425d08b/attachment.htm>
More information about the Cuis-dev
mailing list