• telling TK where to find fonts

    From Bill Poser@21:1/5 to All on Fri Jun 30 14:49:47 2023
    I'm sure I used to know the answer to this question, but can't remember, and haven't found it by searching. How do I tell TK where to look for fonts? I have installed Tcl on a new Linux machine, on which I have installed a number of fonts, which are
    available to, e.g. LibreOffice, but not in TK.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Gollwitzer@21:1/5 to All on Sat Jul 1 07:58:47 2023
    Am 30.06.23 um 23:49 schrieb Bill Poser:
    I'm sure I used to know the answer to this question, but can't remember, and haven't found it by searching. How do I tell TK where to look for fonts? I have installed Tcl on a new Linux machine, on which I have installed a number of fonts, which are
    available to, e.g. LibreOffice, but not in TK.

    Have you compiled Tk on your own? Because, there is a compile-time
    option "--enable-xft", which is the standard library now for finding
    fonts the same way as LibreOffice does it. If it is disabled or if the
    headers for xft are not available, then Tk will use an older method to
    render fonts.

    Christian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bill Poser@21:1/5 to Christian Gollwitzer on Sat Jul 1 09:26:40 2023
    On Friday, June 30, 2023 at 10:58:52 PM UTC-7, Christian Gollwitzer wrote:
    Am 30.06.23 um 23:49 schrieb Bill Poser:
    I'm sure I used to know the answer to this question, but can't remember, and haven't found it by searching. How do I tell TK where to look for fonts? I have installed Tcl on a new Linux machine, on which I have installed a number of fonts, which are
    available to, e.g. LibreOffice, but not in TK.
    Have you compiled Tk on your own? Because, there is a compile-time
    option "--enable-xft", which is the standard library now for finding
    fonts the same way as LibreOffice does it. If it is disabled or if the headers for xft are not available, then Tk will use an older method to render fonts.

    Christian

    Interesting. No, I installed from ActiveState.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [email protected]@21:1/5 to All on Wed Jul 5 12:20:28 2023
    With the "extrafont" package you can use on-fly any font you like.
    See https://wiki.tcl-lang.org/page/extrafont

    Example:
    set fontfamilies [extrafont::load "c:/tmp/Monoton-regular.ttf"]
    # just get the 1st font-familiy
    set myNewFontFamily [lindex $fontfamilies 0] ;# --> "Monoton"
    set myfontname [font create -family $myNewFontFamily -size 20]

    # then use $myfontname for a new widget ...
    label .mylabel -font $myfontname -text "Hello World"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)