From 80e076814dde330fb2136172580f11e939bc6601 Mon Sep 17 00:00:00 2001 From: Martin Haug Date: Sat, 6 Feb 2021 12:30:44 +0100 Subject: =?UTF-8?q?Merge=20`rect`=20and=20`box`=20=F0=9F=A6=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/export/pdf.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/export') diff --git a/src/export/pdf.rs b/src/export/pdf.rs index 7556e370..e5124c21 100644 --- a/src/export/pdf.rs +++ b/src/export/pdf.rs @@ -156,19 +156,19 @@ impl<'a> PdfExporter<'a> { c.b as f32 / 255., ); } - Fill::Image(_) => unimplemented!(), + Fill::Image(_) => todo!(), } + let x = pos.x.to_pt() as f32; + match &geometry.shape { Shape::Rect(r) => { - content.rect( - pos.x.to_pt() as f32, - (page.size.height - pos.y - r.size.height).to_pt() as f32, - r.size.width.to_pt() as f32, - r.size.height.to_pt() as f32, - false, - true, - ); + let w = r.width.to_pt() as f32; + let h = r.height.to_pt() as f32; + let y = (page.size.height - pos.y - r.height).to_pt() as f32; + if w > 0.0 && h > 0.0 { + content.rect(x, y, w, h, false, true); + } } } -- cgit v1.2.3