Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import fontforge to python in windows 7

Environment: Win 7, Python 3.4, Sublime Text 2

I am trying to use fontforge as in following example, by importing fontforge in *.py:

import fontforge
font = fontforge.open('blank.sfd')
...

However, I haven't found any help for win 7 on where (or which subset) to include fontforge binary in my project to make it work. Any ideas, please? Thanks

Edit: I was trying to build it with pyextension in win 7 as described here:

http://fontforge.org/source-build.html#MS

via cygwin it fails on executing ./configure --enable-pyextension

throwing
checking for gcc
result: no    
checking for cc
result: no
checking for cl.exe
result: no
error: in `/cygdrive/c/fontforge':
no acceptable C compiler found in $PATH

Edit 2: By installing C compiler I've managed to ./configure it but my attempts have failed on executing make install command. I got following error, preceding another countless lines:

Makefile:91: recipe for target '../libfontforge.la' failed
make[1]: *** [../libfontforge.la] Error 1
make[1]: Leaving directory '/cygdrive/c/fontforge/fontforge'
Makefile:28: recipe for target 'fontforge' failed
make: *** [fontforge] Error 2
like image 618
zap Avatar asked Apr 29 '14 12:04

zap


1 Answers

Install fontforge for windows, then search your install for a fontforge-console.bat, and double-click it. From there you have a python environment that includes fontforge via the command:

ffpython

e.g.:

ffpython yourPythonFontForgeScript.py

You may need to cd to whatever directory has your python script before running that command, or otherwise make sure that the script is in your %PATH%.

like image 191
Alex Hall Avatar answered Nov 07 '22 06:11

Alex Hall