diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-20 15:51:07 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-20 15:51:07 +0100 |
| commit | cef46e6c40fed0089a20e44ff2f251c06878891c (patch) | |
| tree | a4f12ced1441a014f0446f5b01e3f0f87bdd21b5 /src/font.rs | |
| parent | 70c0dd767452772d29167e39b1c4f919519422ce (diff) | |
Strokes
Diffstat (limited to 'src/font.rs')
| -rw-r--r-- | src/font.rs | 14 |
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 { |
