danmarshall / google-font-to-svg-path

Create an SVG path from a Google font
https://danmarshall.github.io/google-font-to-svg-path
MIT License
754 stars 128 forks source link

Make stroke scaling configurable #33

Closed cebamps closed 2 years ago

cebamps commented 2 years ago

Hello!

I ran into an issue with the stroke widths produced by the tool. The exported SVG paths had the vector-effect="non-scaling-stroke" attribute set on them.

Inkscape supports this for rendering, but does not expose the setting in its UI. This has the effect of producing surprisingly inconsistent stroke widths on display an export. For example, the stroke width relative to the drawing varies when the zoom level changes (see screenshots below).

Non-scaling strokes are the default in Maker.js. I assume this is because it makes sense for plotters. But for digital use, I could really use a setting that lets me remove that non-scaling-stroke attribute.

This PR allows the user to control the stroke scaling through a "Non-scaling Stroke" checkbox. The default setting of true is preserved to avoid a breaking change, although it might make sense to make the default false instead, depending on the primary use case for this tool.

Here's some example output as seen in Inkscape. The first line, "Scaling stroke", is what this PR makes possible. The second line, "Non-scaling stroke", is what the tool produces today. 1-wide 2-zoomed

Thanks for publishing this tool by the way, it's super handy!

danmarshall commented 2 years ago

Thanks!!