Glyph.toSVG or Path.toSVG?
See original GitHub issueIs there any API for converting glyphs or paths to SVG, instead of drawing them onto a context? Especially on the Node side of things these are relatively necessary (glyph lookup REST servers, for instance).
I can trivially implement one as
function toSVG(path) {
return path.commands.map(function(v) { return [v.type, v.x, v.y].join(' '); }).join(' ');
}
but having it built in would be very nice, especially if it came with an option to round outline fractionals to however-many-decimal-places.
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Convert Glyph path to SVG - Stack Overflow
Take the raw drawing data, put it in a path element, remove the glyph specific attributes, add an appropriate viewBox.
Read more >SVG Glyphs to Paths Converter
Convert SVG font glyphs to SVGs in a SPRITE2 or ZIP file. Visit this Scratch forum post for instructions. Type the charset you...
Read more >how to convert font's glyphs to svg or png ? · Issue #492 - GitHub
I find the ttf file has 13 glyphs ,which is the same both in opentype.js and other ttf editor software (eg. FontCreator).
Read more >How to convert icons from fonts to separate svg files
How to convert icons from fonts to separate svg files · 1) Use the same font in the newly created rich editor. ·...
Read more ><glyph> - SVG: Scalable Vector Graphics - MDN Web Docs
A <glyph> defines a single glyph in an SVG font. Usage context. Categories, Text content element. Permitted content, Any number of the following...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As per https://github.com/nodebox/opentype.js/issues/128, the above function doesn’t work. However, this does:
And then feeding that into a
draw
call, to draw “to string” rather than to a canvas:https://gist.github.com/VivaRado/9606e9c0be095241a903dc716c7b596c