开发者

Programming library for editing ttf fonts [closed]

Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 6 years ago.

开发者_开发知识库 Improve this question

I am looking for a library that allows me to edit true type fonts.

basically i want to replace certain glyps with my custom vector graphics programmatically/

the language doesnt matter so much, i'm pretty flexible.

thanks!


If you don't mind Python, there are a couple of good possibilities

I'd suggest having a look at FontForge. It can be built both to embed a Python interpreter, and to run as a library from within Python. Another nice feature is that its native file format, the spline font database is ascii and fairly well documented and quite easy to manipulate with your own programs.

Another alternative that I have less experience with is TTX and TTLib. The later is a Python library and the former is wrapper around it which roundtrips TTF to XML and back.


As you are flexible with regard to the programming language, you can use Fontforge, like @Boojum said, and you will have available to you two interfaces: both its native language (called in the manual the "legacy" interface) and a python interface that is very carefully detailed.

Fontforge is available in many Linux distributions, including Debian and Ubuntu, among others (disclaimer: I am a member of the team that maintains fontforge in Debian, and, by transition, in Ubuntu).

It is also available for Macs and, perhaps, Windows, but I'm not sure if they are available as ready, built executables.

OK, back to Fontforge.

Fontforge is able to read and write fonts in many formats, and, its "native" format (called Spline Font Database) is a plain-text format that is very easy to read and manipulate with a text editor, if you do that carefully.

From the programming side, you can see a very basic Python script that creates an OpenType font from a spline font database file (SFD) with the script listed at https://github.com/rbrito/urw-garamond/blob/master/scripts/generate.py. But fear not: the very same way (functions) that you use to read an SFD file is the way that you would read a TrueType, OpenType, Postscript etc. font.

As another example of a simple manipulation of fonts, you can see one script that takes a font as input and creates a slanted version of that font: https://github.com/rbrito/urw-garamond/blob/master/scripts/to-slant.py.

Regarding "learnability", you have plenty of projects that make their scripts available and you can easily learn by example from them. For example, the DejaVu project and Barry Schwartz's sortsmill scripts.

So, only your creativity is the limit.


This website allows you to add your svg, edit them, or include more and then export it as a Font, choosing name size etc.

https://icomoon.io/app/#/select/font

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜