TransWikia.com

Metafont glyph description processed by Metapost to return svg paths

TeX - LaTeX Asked by baptiste on June 26, 2021

I’m hoping to generate SVG paths for a large number of characters, and I wonder if this could be automated via Metapost. From what I’ve read,

mpost ’&mfplain’ cmr10

will let mpost process a Metafont description of font characters, and output one postscript file for each character. I’m looking for something similar — interpreting Metafont path descriptions and returning vector shapes — but producing open paths, as opposed to filled outlines. Basically just the trajectory of the pen, as opposed to the trace it leaves on paper.

Does this sound doable with Metapost? I’m very unfamiliar with the system, so I prefer to ask before going too deep and realising this is hopeless.

One Answer

MetaPost does not change the kind of path you pass into it. So if you have a font like logo10 which is defined using open paths, then the output from MetaPost will also use open paths (both in PostScript and in SVG). If on the other hand you use font like cmr10 which is defined using filled outlines, then the SVG or PostScript output will use the same. (Actually cmr10 uses the combination: Almost all glyphs use both fill and stroke, which is also copied into the SVG or PostScript output)

The only exception is if you use a pen which is not round, then MetaPost has to transform the strokes into filled outlines.

By the way, to get mpost to output SVG files you can pass the argument -s outputformat="svg".

Answered by Marcel Krüger on June 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP