svgwrite icon indicating copy to clipboard operation
svgwrite copied to clipboard

Is vector-effect="non-scaling-stroke" supported?

Open shrx opened this issue 6 years ago • 1 comments

I'd like to add the vector-effect="non-scaling-stroke" property to an object. Is this supported?

shrx avatar Jan 11 '19 20:01 shrx

It's not supported via the API surface, but you can set vector-effect via a style sheet. You'll need to add a style to your drawing, which defines a class in it that has the property, and then set that class on the desired object.

Basically:

dwg.defs.add(dwg.style("""
.vectorEffectClass {
    vector-effect: non-scaling-stroke;
}
"""))

dwg.add(dwg.path(d="M 0 0 L 1 1", class_='vectorEffectClass'))

jasonreisman avatar Jan 27 '19 15:01 jasonreisman