Skip to content

Commit

Permalink
Typst 0.13.1 fixes (#834)
Browse files Browse the repository at this point in the history
* canvas: Fix the fix

* tests: Update

* mark: Fix symbol regression #830
  • Loading branch information
johannes-wolf authored Mar 9, 2025
1 parent 328d2fe commit de9e82d
Show file tree
Hide file tree
Showing 34 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/canvas.typ
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
for i in range(1, pts.len()) {
vertices.push(curve.line(pts.at(i)))
}
last-point = pts.at(1)
last-point = pts.last()
}
}

Expand Down
11 changes: 9 additions & 2 deletions src/mark.typ
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,17 @@
if style == none {
style = (start: none, end: none, symbol: none)
}
let both-symbol = style.at("symbol", default: none)
let start-symbol = style.at("start",
default: style.at("symbol", default: none))
default: both-symbol)
if start-symbol == none {
start-symbol = both-symbol
}
let end-symbol = style.at("end",
default: style.at("symbol", default: none))
default: both-symbol)
if end-symbol == none {
end-symbol = both-symbol
}

let (path, is-transformed) = if not style.at("transform-shape", default: true) and transform != none {
(drawable.apply-transform(transform, path).first(), true)
Expand Down
Binary file modified tests/anchor-centroid/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/angle/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/arrows/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 20 additions & 10 deletions tests/arrows/test.typ
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#import "/tests/helper.typ": *

#box(stroke: 2pt + red, canvas({
#test-case({
import draw: *

let next(mark) = {
Expand Down Expand Up @@ -31,9 +32,9 @@
for m in marks {
next((start: m))
}
}))
} )

#box(stroke: 2pt + red, canvas({
#test-case({
import draw: *

line((0,0), (9,0), stroke: blue + 1pt)
Expand All @@ -48,9 +49,9 @@
line((x * .5, -1), (x * .5, 0), mark: (start: ">", end: ">",
width: (x / 50 + .05)))
}
}))
})

#box(stroke: 2pt + red, canvas({
#test-case({
import draw: *

line((0,0), (9,0), stroke: blue + 1pt)
Expand All @@ -65,9 +66,9 @@
line((x * .5, -1), (x * .5, 0), mark: (start: "<", end: "<",
width: (x / 50 + .05)))
}
}))
})

#box(stroke: 2pt + red, canvas({
#test-case({
import draw: *

line((0,0), (9,0), stroke: blue + 1pt)
Expand All @@ -82,9 +83,9 @@
line((x * .5, -1), (x * .5, 0), mark: (start: "<", end: ">",
width: (x / 50 + .05)))
}
}))
})

#box(stroke: 2pt + red, canvas({
#test-case({
import draw: *

line((0,0), (9,0), stroke: blue + 1pt)
Expand All @@ -99,4 +100,13 @@
line((x * .5, -1), (x * .5, 0), mark: (start: "<", end: ">",
width: (x / 50 + .05)))
}
}))
})

// Issue #830
#test-case({
import draw: *
line((0, 0), (1, 0), mark: (start: "stealth"))
line((0, -1), (1, -1), mark: (end: "stealth"))
line((0, -2), (1, -2), mark: (start: "stealth", end: "stealth"))
line((0, -3), (1, -3), mark: (symbol: "stealth",))
})
Binary file modified tests/circle-through/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/content-intersection/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/content-padding/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/content-rtl/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/content-span/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/content/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/cube/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/gradient/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/intersection/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/line-element-element-intersection/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/line-fill-rule/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/mark-anchors/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/mark-auto-offset/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/mark-position/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/mark-shape-transform/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/mark-single/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/mark-style/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/mark-z-axis/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/merge/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/multiple-marks/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/polygon/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/projection-default/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/projection-ortho/ref/1.png
Binary file modified tests/rect-rounded/ref/1.png
Binary file modified tests/rotate-around/ref/1.png
Binary file modified tests/set-get-ctx/ref/1.png
Binary file modified tests/style/ref/1.png
Binary file modified tests/tree/ref/1.png

0 comments on commit de9e82d

Please sign in to comment.