diff options
| author | Eric Biedert <github@ericbiedert.de> | 2024-04-01 22:37:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-01 20:37:05 +0000 |
| commit | 72c5b42a30128c07c83fc9281b705a6c2a139103 (patch) | |
| tree | 44736a97b4639670e961071aec13ac8dc4c7ce74 | |
| parent | eef3c3c5ff2e628317fdec5b07ea751bd55d9fca (diff) | |
Fix patterns with spacing in PDF (#3793)
| -rw-r--r-- | crates/typst-pdf/src/pattern.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/typst-pdf/src/pattern.rs b/crates/typst-pdf/src/pattern.rs index 0829ef32..6dfb0f66 100644 --- a/crates/typst-pdf/src/pattern.rs +++ b/crates/typst-pdf/src/pattern.rs @@ -73,7 +73,9 @@ pub(crate) fn write_patterns(ctx: &mut PdfContext) { resources_map.finish(); tiling_pattern .matrix(transform_to_array( - transform.pre_concat(Transform::scale(Ratio::one(), -Ratio::one())), + transform + .pre_concat(Transform::scale(Ratio::one(), -Ratio::one())) + .post_concat(Transform::translate(Abs::zero(), pattern.spacing().y)), )) .filter(Filter::FlateDecode); } @@ -82,7 +84,7 @@ pub(crate) fn write_patterns(ctx: &mut PdfContext) { /// A pattern and its transform. #[derive(Clone, PartialEq, Eq, Hash)] pub struct PdfPattern { - /// The transform to apply to the gradient. + /// The transform to apply to the pattern. pub transform: Transform, /// The pattern to paint. pub pattern: Pattern, |
