How to import fontforge to python in windows 7

与世无争的帅哥 提交于 2020-07-05 07:50:10

问题


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

回答1:


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%.



来源:https://stackoverflow.com/questions/23365299/how-to-import-fontforge-to-python-in-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!