Lorp / samsa

Variable font inspector
https://lorp.github.io/samsa/
Apache License 2.0
243 stars 23 forks source link

SamsaGlyph.prototype.svg has hardcoded width and height #73

Closed Typogram closed 2 years ago

Typogram commented 2 years ago

Some fonts are not based on 1000 units, it would be better if the width and height of the SVG can be set dynamically, based on the font data, such as unitsPerEm Right now it is being hardcoded as width="1000" height="1000"

SamsaGlyph.prototype.svg = function (style={}) {
    ...
    return `<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1000" height="1000">
    <g${style.transform ? ` transform="${style.transform}"` : ""}>
        <path d="${this.svgPath()}"${extra}></path>
    </g>
</svg>`;
}