summaryrefslogtreecommitdiff
path: root/src/export/pdf
diff options
context:
space:
mode:
authorPg Biel <9021226+PgBiel@users.noreply.github.com>2023-04-28 05:02:51 -0300
committerGitHub <noreply@github.com>2023-04-28 10:02:51 +0200
commitd5e68c731c95b5fe366de718a4898e50e5e0525a (patch)
tree488cafa39c6d03b2298891fee1face014c3d0502 /src/export/pdf
parent1235d52c52998e3fde6a34db8b18cb448a1e73a6 (diff)
fix 0pt stroke for PDF export (#1020)
Diffstat (limited to 'src/export/pdf')
-rw-r--r--src/export/pdf/page.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/export/pdf/page.rs b/src/export/pdf/page.rs
index e15f3750..acf5062e 100644
--- a/src/export/pdf/page.rs
+++ b/src/export/pdf/page.rs
@@ -417,7 +417,15 @@ fn write_text(ctx: &mut PageContext, x: f32, y: f32, text: &TextItem) {
/// Encode a geometrical shape into the content stream.
fn write_shape(ctx: &mut PageContext, x: f32, y: f32, shape: &Shape) {
- if shape.fill.is_none() && shape.stroke.is_none() {
+ let stroke = shape.stroke.as_ref().and_then(|stroke| {
+ if stroke.thickness.to_f32() > 0.0 {
+ Some(stroke)
+ } else {
+ None
+ }
+ });
+
+ if shape.fill.is_none() && stroke.is_none() {
return;
}
@@ -425,7 +433,7 @@ fn write_shape(ctx: &mut PageContext, x: f32, y: f32, shape: &Shape) {
ctx.set_fill(fill);
}
- if let Some(stroke) = &shape.stroke {
+ if let Some(stroke) = stroke {
ctx.set_stroke(stroke);
}
@@ -448,7 +456,7 @@ fn write_shape(ctx: &mut PageContext, x: f32, y: f32, shape: &Shape) {
}
}
- match (&shape.fill, &shape.stroke) {
+ match (&shape.fill, stroke) {
(None, None) => unreachable!(),
(Some(_), None) => ctx.content.fill_nonzero(),
(None, Some(_)) => ctx.content.stroke(),