diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-06-12 17:16:14 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-06-12 17:26:18 +0200 |
| commit | 6e3b1a2c80428d581d00b9d65e1c45401df2e210 (patch) | |
| tree | 34d4b1c200851aa77af66b737bfe445e2da11f44 /src/export/pdf.rs | |
| parent | ed6550fdb08eae92bffab6b6b137b1e0eebf62c6 (diff) | |
Make all fields of `Frame` private
Diffstat (limited to 'src/export/pdf.rs')
| -rw-r--r-- | src/export/pdf.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/export/pdf.rs b/src/export/pdf.rs index 4495bceb..cc84dbc3 100644 --- a/src/export/pdf.rs +++ b/src/export/pdf.rs @@ -611,19 +611,24 @@ impl<'a, 'b> PageExporter<'a, 'b> { } fn export(mut self, frame: &Frame) -> Page { + let size = frame.size(); + // Make the coordinate system start at the top-left. - self.bottom = frame.size.y.to_f32(); + self.bottom = size.y.to_f32(); self.transform(Transform { sx: Ratio::one(), ky: Ratio::zero(), kx: Ratio::zero(), sy: Ratio::new(-1.0), tx: Length::zero(), - ty: frame.size.y, + ty: size.y, }); + + // Encode the page into the content stream. self.write_frame(frame); + Page { - size: frame.size, + size, content: self.content, id: self.page_ref, links: self.links, @@ -648,7 +653,7 @@ impl<'a, 'b> PageExporter<'a, 'b> { } } - for &(pos, ref element) in &frame.elements { + for &(pos, ref element) in frame.elements() { let x = pos.x.to_f32(); let y = pos.y.to_f32(); match *element { @@ -669,8 +674,9 @@ impl<'a, 'b> PageExporter<'a, 'b> { self.transform(translation.pre_concat(group.transform)); if group.clips { - let w = group.frame.size.x.to_f32(); - let h = group.frame.size.y.to_f32(); + let size = group.frame.size(); + let w = size.x.to_f32(); + let h = size.y.to_f32(); self.content.move_to(0.0, 0.0); self.content.line_to(w, 0.0); self.content.line_to(w, h); |
