From 074eedfc51c112d60dcb9e3e047dca0ea99cb4f8 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl <47084093+LaurenzV@users.noreply.github.com> Date: Thu, 27 Mar 2025 16:41:47 +0100 Subject: [PATCH] Don't draw if no paint is active --- crates/typst-pdf/src/shape.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/typst-pdf/src/shape.rs b/crates/typst-pdf/src/shape.rs index a4b487e17..8bbf98bf8 100644 --- a/crates/typst-pdf/src/shape.rs +++ b/crates/typst-pdf/src/shape.rs @@ -56,9 +56,12 @@ pub(crate) fn handle_shape( None }; - surface.set_fill(fill); - surface.set_stroke(stroke); - surface.draw_path(&path); + // Otherwise, krilla will by default fill with a black paint. + if fill.is_some() || stroke.is_some() { + surface.set_fill(fill); + surface.set_stroke(stroke); + surface.draw_path(&path); + } } surface.pop();