summaryrefslogtreecommitdiff
path: root/src/font.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/font.rs')
-rw-r--r--src/font.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/font.rs b/src/font.rs
index fb93d5c9..5afd1aca 100644
--- a/src/font.rs
+++ b/src/font.rs
@@ -187,11 +187,11 @@ pub struct Face {
/// Metrics for a decorative line.
#[derive(Debug, Copy, Clone)]
pub struct LineMetrics {
- /// The thickness of the line.
- pub strength: Em,
/// The vertical offset of the line from the baseline. Positive goes
/// upwards, negative downwards.
pub position: Em,
+ /// The thickness of the line.
+ pub thickness: Em,
}
impl Face {
@@ -218,22 +218,22 @@ impl Face {
let underline = ttf.underline_metrics();
let strikethrough = LineMetrics {
- strength: strikeout
+ position: strikeout.map_or(Em::new(0.25), |s| to_em(s.position)),
+ thickness: strikeout
.or(underline)
.map_or(Em::new(0.06), |s| to_em(s.thickness)),
- position: strikeout.map_or(Em::new(0.25), |s| to_em(s.position)),
};
let underline = LineMetrics {
- strength: underline
+ position: underline.map_or(Em::new(-0.2), |s| to_em(s.position)),
+ thickness: underline
.or(strikeout)
.map_or(Em::new(0.06), |s| to_em(s.thickness)),
- position: underline.map_or(Em::new(-0.2), |s| to_em(s.position)),
};
let overline = LineMetrics {
- strength: underline.strength,
position: cap_height + Em::new(0.1),
+ thickness: underline.thickness,
};
Some(Self {