Apply aspect ratio correction for linear gradients in PDF export (#6689)

This commit is contained in:
Laurenz Stampfl 2025-08-04 11:59:10 +02:00 committed by GitHub
parent 0fe8f09ba9
commit 2809dac6a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 1 deletions

View File

@ -152,11 +152,12 @@ fn convert_gradient(
RelativeTo::Parent => state.container_size(),
};
let angle = gradient.angle().unwrap_or_else(Angle::zero);
let mut angle = gradient.angle().unwrap_or_else(Angle::zero);
let base_transform = correct_transform(state, gradient.unwrap_relative(on_text));
let stops = convert_gradient_stops(gradient);
match &gradient {
Gradient::Linear(_) => {
angle = Gradient::correct_aspect_ratio(angle, size.aspect_ratio());
let (x1, y1, x2, y2) = {
let (mut sin, mut cos) = (angle.sin(), angle.cos());

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View File

@ -692,3 +692,6 @@ $ A = mat(
(blue, 100%),
)
)
--- issue-6680-gradient-linear-with-aspect-correction ---
#set page(width: 200pt, height: auto, margin: 10pt, fill: gradient.linear(red, blue, angle: 45deg).sharp(2))