我试图使用 bin2h 转换字体文件(font.ttf)成C文件,但它不会工作。
I'm trying to use bin2h to convert a font file (font.ttf) into a C file but it won't work.
有人可以告诉我的语法将输出保存到文本文件?
Can someone please tell me the syntax to save the output to a text file?
我一直在试图找出这一点,但没有什么工作,它的驾驶我疯了。我真的很沮丧,因为我知道这个工具也是工作(我得到了它像一年前的工作),但我不记得我是如何使用的。
I've been trying to figure this out but nothing is working, and it's driving me insane. I'm really frustrated because I know the tool is working (I got it to work like a year ago) but I can't remember how I used it.
在该网站上的例子语法并不能真正帮助...
The example syntax on that site doesn't really help...
请
由于亮度种族在轨道的评论下面我终于得到了语法正确的!
Thanks to Lightness Races in Orbit's comment below I finally got the syntax right!
bin2h -CZ字体< font.ttf> output.h
bin2h -cz font < font.ttf > output.h
这是工作,谢谢
推荐答案也许你正在寻找在网站上使用的例子,并没意识到这是你的shell执行程序?这不是C code的一条线。
Perhaps you are looking at the usage example on the website and not realising that it is a program that you execute from shell? It is not a line of C code.
所以,如果你想使用这个从C程序,你需要通过函数如系统能够执行或 EXEC 。然而,由于其输出是C code的一条线,你会更好,从构建脚本中运行它的 的创建C脚本,你会再链接到其余的程序的。
So if you want to use this from a C program, you will need to execute it through a function like system or exec. However, since its output is a line of C code, you'd be better off running it from within your build script to create a C script, that you'd then link in to the rest of your program.
#include <iostream> #include "eula.h" int main() { std::cout << std::string(eula, eula_size) << std::endl; }构建命令
$ bin2h -cz eula < eula.txt > eula.h $ g++ main.cpp -o myProgram执行命令
$ ./myProgram更多推荐
如何使用bin2h?
发布评论