Skip to content

Centering dashed strokes (like TikZ's dash expand off) #976

Description

@cAttte

hi! it would be cool to have an equivalent of TikZ's dash expand off that "centers" the dashes of a stroke such that both of its edges have equal spacing, which can result in nicer lines (e.g. the bottom line here looks a little weird)

code
#import "@preview/cetz:0.4.2"

#cetz.canvas({
  import cetz.draw: *
  set-style(mark: (symbol: "|", stroke: (dash: none)), stroke: (dash: "dashed"))
  line((0pt, .2), (53pt, .2))
  line((0pt, 0), (62pt, 0))
})
Image

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions