Skip to content

mark: fix handling of stroke: none#1058

Closed
NicoWeio wants to merge 1 commit intocetz-package:masterfrom
NicoWeio:fix-mark-stroke-none
Closed

mark: fix handling of stroke: none#1058
NicoWeio wants to merge 1 commit intocetz-package:masterfrom
NicoWeio:fix-mark-stroke-none

Conversation

@NicoWeio
Copy link
Copy Markdown
Contributor

The following minimal example results in an error:

#import "@preview/cetz:0.4.2": canvas, draw, matrix, vector

#set page(width: auto, height: auto, margin: .5cm)

#canvas({
  import draw: *

  mark((0, 0), 90deg, symbol: "circle", fill: blue, stroke: none)
})

expected color, gradient, tiling, or auto, found none

I found that this is because we do not actually pass stroke: none to std.curve in canvas.typ. Instead, util.resolve-stroke will create a dict with invalid (in Typst) values:

#let resolve-stroke(stroke) = {
  if stroke == none {
    return (paint: none, thickness: 0pt, join: none, cap: none, miter-limit: 4)
  }
  …

Within CeTZ, resolve-stroke is only used in the mark.typ file, so it should be safe to change its behavior.

I can think of many ways to solve this, but since my testing environment is broken right now, I just wanted to put this out for discussion.

@johannes-wolf johannes-wolf self-requested a review March 19, 2026 21:43
johannes-wolf added a commit that referenced this pull request Mar 19, 2026
When passing `none` to a `stroke:` style, cetz
did create an invalid stroke object.

ref #1058
johannes-wolf added a commit that referenced this pull request Mar 19, 2026
When passing `none` to a `stroke:` style, cetz
did create an invalid stroke object.

ref #1058
@johannes-wolf
Copy link
Copy Markdown
Member

Thank you for bringing this up. I've merged a different fix for this issue.

johannes-wolf added a commit that referenced this pull request Mar 19, 2026
When passing `none` to a `stroke:` style, cetz
did create an invalid stroke object.

ref #1058
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants