如何在 Windows 7 中将 fontforge 导入 python [英] How to import fontforge to python in windows 7

查看:37
本文介绍了如何在 Windows 7 中将 fontforge 导入 python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:Win 7、Python 3.4、Sublime Text 2

我正在尝试 使用 fontforge 如下例,通过在 *.py 中导入 fontforge:

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

但是,我还没有找到任何关于在我的项目中包含 fontforge 二进制文件以使其工作的地方(或哪个子集)的帮助.有什么想法吗?谢谢

我试图在 win 7 中使用 pyextension 构建它,如下所述:

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

通过 cygwin 执行失败./configure --enable-pyextension

投掷检查 gcc结果:没有检查抄送结果:没有检查 cl.exe结果:没有错误:在/cygdrive/c/fontforge"中:在 $PATH 中找不到可接受的 C 编译器

通过安装 C 编译器,我设法对其进行了 ./configure,但我的尝试在执行 make install 命令时失败了.我收到以下错误,在无数行之前:

Makefile:91: 目标 '../libfontforge.la' 的配方失败make[1]: *** [../libfontforge.la] 错误 1make[1]: 离开目录 '/cygdrive/c/fontforge/fontforge'Makefile:28: 目标fontforge"的配方失败制作:*** [fontforge] 错误 2

解决方案

安装 windows 的 fontforge,然后在您的安装中搜索 fontforge-console.bat,然后双击它.从那里你有一个 python 环境,通过命令包含 fontforge:

ffpython

例如:

ffpython yourPythonFontForgeScript.py

在运行该命令之前,您可能需要 cd 到任何包含您的 Python 脚本的目录,或者确保脚本在您的 %PATH% 中.

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

解决方案

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

这篇关于如何在 Windows 7 中将 fontforge 导入 python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆