diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-08-02 22:05:49 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-08-02 22:05:49 +0200 |
| commit | 266d457292e7461d448f9141030028ea68b573d1 (patch) | |
| tree | ff3ff3cc289d34040db421b6a7faa1f2aa402b05 /src/export/pdf.rs | |
| parent | cbbc46215fe0a0ad8a50e991ec442890b8eadc0a (diff) | |
Refactor model into tree 🛒
Diffstat (limited to 'src/export/pdf.rs')
| -rw-r--r-- | src/export/pdf.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/export/pdf.rs b/src/export/pdf.rs index 71665149..84023c71 100644 --- a/src/export/pdf.rs +++ b/src/export/pdf.rs @@ -15,7 +15,7 @@ use fontdock::FaceId; use ttf_parser::{name_id, GlyphId}; use crate::SharedFontLoader; -use crate::layout::{MultiLayout, Layout}; +use crate::layout::{MultiLayout, BoxLayout}; use crate::layout::elements::LayoutElement; use crate::length::Length; @@ -117,8 +117,8 @@ impl<'a, W: Write> PdfExporter<'a, W> { let rect = Rect::new( 0.0, 0.0, - Length::raw(page.dimensions.x).as_pt() as f32, - Length::raw(page.dimensions.y).as_pt() as f32, + Length::raw(page.size.x).as_pt() as f32, + Length::raw(page.size.y).as_pt() as f32, ); self.writer.write_obj( @@ -141,7 +141,7 @@ impl<'a, W: Write> PdfExporter<'a, W> { } /// Write the content of a page. - fn write_page(&mut self, id: u32, page: &Layout) -> io::Result<()> { + fn write_page(&mut self, id: u32, page: &BoxLayout) -> io::Result<()> { // Moves and face switches are always cached and only flushed once // needed. let mut text = Text::new(); @@ -161,7 +161,7 @@ impl<'a, W: Write> PdfExporter<'a, W> { } let x = Length::raw(pos.x).as_pt(); - let y = Length::raw(page.dimensions.y - pos.y - size).as_pt(); + let y = Length::raw(page.size.y - pos.y - size).as_pt(); text.tm(1.0, 0.0, 0.0, 1.0, x as f32, y as f32); text.tj(shaped.encode_glyphs()); } |
