struct

Tryst::UI::Font

Inherits Struct < Value < Object

A Tk font, spelled without needing Tk's own font-list syntax or Tcl's brace quoting by hand - "{Comic Sans MS} 14 bold" silently mis-parses if the braces are wrong (or missing) around a family with spaces; #to_tcl (via Tryst.make_list, real Tcl list quoting, never string interpolation) makes that impossible.

family: nil means "the running default" - Tk's own TkDefaultFont named font, used as the family element of a size/style override the same way the raw string "{TkDefaultFont} 24" always has (Tk allows a named font's name to stand in for family: in the description-list form, which is exactly how a bare size change without a family change gets spelled).

Constructors

new(family : String | Nil = nil, size : Int32 | Nil = nil, bold : Bool = false, italic : Bool = false, underline : Bool = false)
Source

Instance methods

bold
clone
Source
copy_with(family _family = @family, size _size = @size, bold _bold = @bold, italic _italic = @italic, underline _underline = @underline)
Source
emboldened

A bold copy.

Source
family
italic
size
sized(new_size : Int32) : Font

A copy at a different size - everything else (family, bold, italic, underline) unchanged.

Source
to_tcl

The real Tk font-list string this value represents.

size: 0 is rejected here rather than left for Tk to interpret: Tk accepts it silently and the result is a broken or invisible font at Tk's own discretion, with nothing pointing back at the actual mistake.

Source
underline