font create

font create ?fontname? ?option value ...?

Creates a new named font and returns its name. fontname specifies the name for the font; if it is omitted, then Tk generates a new name of the form fontx, where x is an integer. There may be any number of option-value pairs, which provide the desired attributes for the new named font. See FONT OPTIONS for a list of the possible attributes.

A common pattern is to create a new font based on an existing one. E.g., you can create a bold font that is exactly the same as TkTextFont, just being bold:

font create boldFont {*}[font configure TkTextFont] -weight bold

If you want to use the actual attributes that are obtained when the font is used on window's display, you can use font actual instead of font configure. Note: this will only work with Tcl 8.5 and higher due to the {*} word.

See also