I need to convert some ttf file to svg file I know I can use fontforge by script,but I wish I can do this in python I assume there is some protocols of the ttf file so I can parser it from binary to human readable svg,but I couldn't find the protocol any where(I use bing searched) Is there is some way I can do this?The protocol or a already made python lib would be ok
Asked
Active
Viewed 2,192 times
2 Answers
0
I found a similar question for the command-line: Command-line tool for converting TTF/OTF fonts to SVG You could simply call it in a subprocess.

Community
- 1
- 1
-
2As I said,I know I can use fontforge,I wish to find a pure python way to do this – Tarjintor Apr 27 '17 at 03:05
0
Since this can be done with FontForge, you can simply use the fontforge
library in Python.
It can be installed using this command in Linux: (idk how to install it on other OSes)
sudo apt-get install python3-fontforge
Then, in pure Python:
import fontforge
def ttf2svg(i,o):
font = fontforge.open(i)
font.generate(o)
font.close()
After this, just call the function like this:
ttf2svg([input filename], [output_filename])

HGStyle
- 13
- 5