Expand description
Font - support for defining and customising fonts.
- also see the Tk manual
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
- Error returned if expected font definition is incorrectly formatted.
- Error returned if expected font-metrics are incorrectly formatted.
- A font definition.
- Information on a font’s metrics.
Enums
- Defines possible slants for font: roman and italic. See Tk manual
- Defines possible weights for font: normal and bold. See Tk manual
Functions
- Return list of font families available on current platform.
- Retrieves copy of standard caption font: see tk manual.
- Retrieves copy of standard default font: see tk manual.
- Retrieves copy of standard fixed font: see tk manual.
- Retrieves copy of standard heading font: see tk manual.
- Retrieves copy of standard icon font: see tk manual.
- Retrieves copy of standard menu font: see tk manual.
- Retrieves copy of standard small-caption font: see tk manual.
- Retrieves copy of standard text font: see tk manual.
- Retrieves copy of standard tooltip font: see tk manual.