从.ttf生成.afm [英] Generating .afm from .ttf

查看:1260
本文介绍了从.ttf生成.afm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这个库从PHP生成.pdf: http://www.fpdf.org/

虽然我现在挂断了添加新字体的工作,特别是从.ttf字体文件生成.afm文件的步骤。



我按照这里的指示: http://www.fpdf.org/en/tutorial/tuto7.htm
哪种状态:


TrueType的第一步是生成AFM文件。存在一个实用程序来执行此任务:ttf2pt1。 Windows二进制文件在这里可用。要使用的命令行如下:

ttf2pt1 -a font.ttf font



例如,for Comic Sans MS Regular:

ttf2pt1 -ac:\windows\fonts\comic.ttf comic

两个文件被创建;我们感兴趣的是comic.afm。

我不能 - 或者不确定如何 - 加载ttf2pt1。我在一个mac上,但通过vmware运行Win XP的...当我在Windows中运行ttf2pt1.exe文件,它加载命令行,然后迅速关闭。是否有一些我需要做的安装程序?我不太熟悉Win命令行。

解决方案

您也可以使用 FontForge 。这是一个成熟的字体编辑器,可以让你在多种格式之间进行转换。如果你打开你的TrueType字体,你可以使用Generate Font生成一个AFM文件,然后选择PFA或PFB,并选中生成AFM。

I'm working with generating .pdf's from PHP using this library: http://www.fpdf.org/

I am currently hung up, though, on adding new fonts, specifically the step on generating the .afm file from a .ttf font file.

I'm following the instructions here: http://www.fpdf.org/en/tutorial/tuto7.htm Which state:

The first step for a TrueType consists in generating the AFM file. A utility exists to do this task: ttf2pt1. The Windows binary is available here. The command line to use is the following:

ttf2pt1 -a font.ttf font

For example, for Comic Sans MS Regular:

ttf2pt1 -a c:\windows\fonts\comic.ttf comic

Two files are created; the one we are interested in is comic.afm.

I can't - or am unsure how to - get ttf2pt1 to load. I'm on a mac but running Win XP via vmware... and when I run the ttf2pt1.exe file over in Windows it loads command line and then quickly closes. Is there some procedure I need to do to install it? I'm not well versed in Win command line.

解决方案

You can also do that using FontForge. It's a full-fledged font editor, that lets you convert between many formats. If you open your TrueType font in it, you can generate an AFM file by using Generate Font and choosing PFA or PFB, and checking "generate AFM".

这篇关于从.ttf生成.afm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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