1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
use zng_layout::unit::Length;

/// Text font size.
///
/// The [`Default`] value is the *root* font size, usually the one set in the window widget.
///
/// [`Default`]: Length::Default
pub type FontSize = Length;

/// Text line height.
///
/// The [`Default`] value is computed from the font metrics, `ascent - descent + line_gap`, this is
/// usually similar to `1.2.em()`. Relative values are computed from the default value, so `200.pct()` is double
/// the default line height.
///
/// [`Default`]: Length::Default
pub type LineHeight = Length;

/// Extra spacing added in between text letters.
///
/// Letter spacing is computed using the font data, this unit represents
/// extra space added to the computed spacing.
///
/// A "letter" is a character glyph cluster, e.g.: `a`, `â`, `1`, `-`, `漢`.
///
/// The [`Default`] value signals that letter spacing can be tweaked when text *justification* is enabled, all other
/// values disable automatic adjustments for justification. Relative values are computed from the length of the space `' '` character.
///
/// [`Default`]: Length::Default
pub type LetterSpacing = Length;

/// Extra spacing added to the Unicode `U+0020 SPACE` character.
///
/// Word spacing is done using the space character "advance" as defined in the font,
/// this unit represents extra spacing added to that default spacing.
///
/// A "word" is the sequence of characters in-between space characters. This extra
/// spacing is applied per space character not per word, if there are three spaces between words
/// the extra spacing is applied thrice. Usually the number of spaces between words is collapsed to one,
/// see [`WhiteSpace`](crate::WhiteSpace).
///
/// The [`Default`] value signals that word spacing can be tweaked when text *justification* is enabled, all other
/// values disable automatic adjustments for justification. Relative values are computed from the length of the space `' '` character,
/// so a word spacing of `100.pct()` visually adds *another* space in between words.
///
/// [`Default`]: Length::Default
pub type WordSpacing = Length;

/// Extra spacing in-between text lines.
///
/// The [`Default`] value is zero. Relative values are calculated from the [`LineHeight`], so `50.pct()` is half
/// the computed line height.
///
/// [`Default`]: Length::Default
pub type LineSpacing = Length;

/// Extra spacing in-between paragraphs.
///
/// The initial paragraph space is `line_height + line_spacing * 2`, this extra spacing is added to that.
///
/// A "paragraph" is a sequence of lines in-between wgt lines (empty or spaces only). This extra space is applied per wgt line
/// not per paragraph, if there are three wgt lines between paragraphs the extra spacing is applied trice.
///
/// The [`Default`] value is zero.
///
/// [`Default`]: Length::Default
pub type ParagraphSpacing = Length;

/// Length of a `TAB` space.
///
/// Relative lengths are computed from the normal space character "advance" plus the [`WordSpacing`].
/// So a `200%` length is 2 spaces.
///
/// The [`Default`] value is `400.pct()`, 4 spaces.
///
/// [`Default`]: Length::Default
pub type TabLength = Length;

/// Height of the text underline decoration.
///
/// Relative lengths are computed from `1.em()`, with a minimum of one pixel.
///
/// The [`Default`] value is defined by the font.
///
/// [`Default`]: Length::Default
pub type UnderlineThickness = Length;

/// Height of the text overline or strikethrough decoration.
///
/// Relative lengths are computed from `1.em()`, with a minimum of one pixel.
///
/// The [`Default`] value is `10.pct()`.
pub type TextLineThickness = Length;