diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-10-28 16:43:38 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-10-28 16:43:38 +0200 |
| commit | 95e9134a3c7d7a14d8c8928413fdffc665671895 (patch) | |
| tree | 822b5f6c2d23aba33cfe4d199405e493e37c3d70 /src/library/math | |
| parent | 66030ae5d73d85a0463562230b87f8ec7554c746 (diff) | |
Refactor `geom` module
Diffstat (limited to 'src/library/math')
| -rw-r--r-- | src/library/math/mod.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/library/math/mod.rs b/src/library/math/mod.rs index 7d0fecb4..df00cb71 100644 --- a/src/library/math/mod.rs +++ b/src/library/math/mod.rs @@ -92,7 +92,7 @@ impl Show for MathNode { Ok(if self.display() { Content::block( LayoutNode::new(self.clone()) - .aligned(Spec::with_x(Some(Align::Center.into()))), + .aligned(Axes::with_x(Some(Align::Center.into()))), ) } else { Content::inline(self.clone()) @@ -171,9 +171,9 @@ fn layout_tex( // Determine the metrics. let (x0, y0, x1, y1) = renderer.size(&layout); - let width = Length::pt(x1 - x0); - let mut top = Length::pt(y1); - let mut bottom = Length::pt(-y0); + let width = Abs::pt(x1 - x0); + let mut top = Abs::pt(y1); + let mut bottom = Abs::pt(-y0); if style != Style::Display { let metrics = font.metrics(); top = styles.get(TextNode::TOP_EDGE).resolve(styles, metrics); @@ -204,7 +204,7 @@ fn layout_tex( /// A ReX rendering backend that renders into a frame. struct FrameBackend { frame: Frame, - baseline: Length, + baseline: Abs, font: Font, fill: Paint, lang: Lang, @@ -222,7 +222,7 @@ impl FrameBackend { /// Convert a cursor to a point. fn transform(&self, cursor: Cursor) -> Point { - Point::new(Length::pt(cursor.x), self.baseline + Length::pt(cursor.y)) + Point::new(Abs::pt(cursor.x), self.baseline + Abs::pt(cursor.y)) } } @@ -232,7 +232,7 @@ impl Backend for FrameBackend { self.transform(pos), Element::Text(Text { font: self.font.clone(), - size: Length::pt(scale), + size: Abs::pt(scale), fill: self.fill(), lang: self.lang, glyphs: vec