Module rstk::font

source ·
Expand description

Font - support for defining and customising fonts.

Tk provides a lot of control over font objects.

Fonts are created using the struct, specifying those properties we want to set, and relying on its defaults for the remaining fields. For example, creating a bold Helvetica font with size 12:

let font = rstk::TkFont { family: "Helvetica".to_string(),
                            size: 12,
                            weight: rstk::Weight::Bold,
                            ..Default::default() // completes the remaining values
};

Fonts can be provided to many widgets which display text, e.g. a label:

let label = rstk::make_label(&root);
label.font(&font);
label.text("Label text");

Structs

Enums

  • Defines possible slants for font: roman and italic. See Tk manual
  • Defines possible weights for font: normal and bold. See Tk manual

Functions