diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-07 18:04:29 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-07 18:04:29 +0200 |
| commit | 4bb6240b401605ef6d905273db07545e14f9a21f (patch) | |
| tree | b01163a5fce3fe62d16abcbdabf37bc373617ff1 /src/library/text | |
| parent | 1192132dc0a9e991953fd29e93f87c8437a53ea0 (diff) | |
Make `Relative` generic
Diffstat (limited to 'src/library/text')
| -rw-r--r-- | src/library/text/deco.rs | 12 | ||||
| -rw-r--r-- | src/library/text/mod.rs | 2 | ||||
| -rw-r--r-- | src/library/text/par.rs | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/library/text/deco.rs b/src/library/text/deco.rs index a81f0374..da1a1141 100644 --- a/src/library/text/deco.rs +++ b/src/library/text/deco.rs @@ -26,13 +26,13 @@ impl<const L: DecoLine> DecoNode<L> { /// Thickness of the line's strokes (dependent on scaled font size), read /// from the font tables if `None`. #[property(shorthand)] - pub const THICKNESS: Option<Relative> = None; + pub const THICKNESS: Option<Relative<Length>> = None; /// Position of the line relative to the baseline (dependent on scaled font /// size), read from the font tables if `None`. - pub const OFFSET: Option<Relative> = None; + pub const OFFSET: Option<Relative<Length>> = None; /// Amount that the line will be longer or shorter than its associated text /// (dependent on scaled font size). - pub const EXTENT: Relative = Relative::zero(); + pub const EXTENT: Relative<Length> = Relative::zero(); /// Whether the line skips sections in which it would collide /// with the glyphs. Does not apply to strikethrough. pub const EVADE: bool = true; @@ -66,9 +66,9 @@ impl<const L: DecoLine> Show for DecoNode<L> { pub struct Decoration { pub line: DecoLine, pub stroke: Option<Paint>, - pub thickness: Option<Relative>, - pub offset: Option<Relative>, - pub extent: Relative, + pub thickness: Option<Relative<Length>>, + pub offset: Option<Relative<Length>>, + pub extent: Relative<Length>, pub evade: bool, } diff --git a/src/library/text/mod.rs b/src/library/text/mod.rs index 975a4805..4a139fb3 100644 --- a/src/library/text/mod.rs +++ b/src/library/text/mod.rs @@ -188,7 +188,7 @@ castable! { /// The size of text. #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub struct FontSize(pub Relative); +pub struct FontSize(pub Relative<Length>); impl Fold for FontSize { type Output = Length; diff --git a/src/library/text/par.rs b/src/library/text/par.rs index a05aff44..2d31cd11 100644 --- a/src/library/text/par.rs +++ b/src/library/text/par.rs @@ -42,11 +42,11 @@ impl ParNode { /// will will be hyphenated if and only if justification is enabled. pub const HYPHENATE: Smart<bool> = Smart::Auto; /// The spacing between lines (dependent on scaled font size). - pub const LEADING: Relative = Ratio::new(0.65).into(); + pub const LEADING: Relative<Length> = Ratio::new(0.65).into(); /// The extra spacing between paragraphs (dependent on scaled font size). - pub const SPACING: Relative = Ratio::new(0.55).into(); + pub const SPACING: Relative<Length> = Ratio::new(0.55).into(); /// The indent the first line of a consecutive paragraph should have. - pub const INDENT: Relative = Relative::zero(); + pub const INDENT: Relative<Length> = Relative::zero(); fn construct(_: &mut Context, args: &mut Args) -> TypResult<Content> { // The paragraph constructor is special: It doesn't create a paragraph |
