From 659248d52ff9e6be4dad7c4555bd62899671ad55 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 1 Aug 2020 19:15:55 +0200 Subject: =?UTF-8?q?Raw=20lengths=20=F0=9F=9A=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace unitless length with raw f64 and introduce length type with unit. --- tests/src/render.py | 5 +++-- tests/src/typeset.rs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/src') diff --git a/tests/src/render.py b/tests/src/render.py index 3b6c96f8..80f165a1 100644 --- a/tests/src/render.py +++ b/tests/src/render.py @@ -170,8 +170,9 @@ class BoxRenderer: return self.img -def pix(points): - return int(4 * points) +# the number of pixels per raw unit +def pix(raw): + return int(4 * raw) def overlap(a, b): return (a[0] < b[2] and b[0] < a[2]) and (a[1] < b[3] and b[1] < a[3]) diff --git a/tests/src/typeset.rs b/tests/src/typeset.rs index af73bd02..ccce8820 100644 --- a/tests/src/typeset.rs +++ b/tests/src/typeset.rs @@ -14,8 +14,9 @@ use futures_executor::block_on; use typstc::Typesetter; use typstc::font::DynProvider; +use typstc::geom::{Size, Value4}; use typstc::layout::MultiLayout; -use typstc::length::{Length, Size, Value4}; +use typstc::length::Length; use typstc::style::PageStyle; use typstc::paper::PaperClass; use typstc::export::pdf; @@ -85,7 +86,7 @@ fn test(name: &str, src: &str, index: &FsIndex) -> DynResult<()> { typesetter.set_page_style(PageStyle { class: PaperClass::Custom, - dimensions: Size::with_all(Length::pt(250.0)), + dimensions: Size::with_all(Length::pt(250.0).as_raw()), margins: Value4::with_all(None), }); -- cgit v1.2.3