ABU 16-Jul-2017
extrafont is a multi-platform binary package providing a way for loading "private fonts" in a Tk apps.
"Private fonts" are fonts usually delivered with an app.
They don't need to be installed in some 'standard' system-wide directories; once these fonts are loaded, they can be used in the same way of pre-installed fonts.
These loaded fonts are only visible by the process (app) who loaded'em, and then disappear when the app terminates.
The extrafont package provides one core command
extrafont::load
and two convenience commands
extrafont::isAvailable extrafont::availableFamilies
e.g.
extrafont::availableFamilies co* returns Courier {Comic Sans MS} .....
One important distinction to keep in mind is among
Font-filename is used just for loading an external font:
extrafont::load "c:/tmp/Monoton-regular.ttf"
This font will be then available as "Monoton" font-family (note that the family-name may be very different from the font-filename).
extrafont::isAvailable "Monoton" ;# true
Finally, when you want to use this new font, you should create or configure a fontname (using the standard 'font' command)
set myfontname "tk_monoton" ;# ... choose the name you want .. font create $myfontname -family "monoton" -size 20 # or, let tk choose a fontname for you ... set myfontname [font create -family "monoton" -size 20] # then use $myfontname for a new widget ... label .mylabel -font $myfontname .......