PDF 字体 - .afm 文件“bad /BBox”错误
我正在使用 R&OS PDF 类 (http://www.ros.co.nz/pdf" rel="nofollow noreferrer">http://www.ros.co.nz/pdf" 在 PHP 中创建 PDF 文件。 ros.co.nz/pdf)尝试向输出添加更多字体。它需要 TTF 文件和 AFM 文件作为指标,但我无法解决本文中提到的“bad /BBox”错误:从 .ttf 生成 .afm
起初我以为是我没有使用正确制作的 ttf 文件,但我尝试转换一些字体我知道是合法的(Arial),但我仍然收到错误,所以现在我认为它一定是 AFM 转换。
上面的 Stack 帖子提到 http://fpdf.fruit-lab.de/ 作为一个很好的转换工具-也许我只是使用了错误的映射? PDF 是否有偏好的特定地图格式?
I'm working on creating PDF files in PHP with the R&OS PDF class (http://www.ros.co.nz/pdf) trying to add some more fonts to the output. It requires a TTF file and an AFM file for the metrics, but I can't get around the "bad /BBox" error as referred to in this post: Generating .afm from .ttf
At first I thought it was that I wasn't using properly made ttf files, but I've tried converting some fonts that I know are legit (Arial) and I still get the error, so now I think it must be the AFM conversion.
The Stack post above refers to http://fpdf.fruit-lab.de/ as a good conversion tool- maybe I'm just using the wrong mapping? Is there a specific map format the PDF prefers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用 dompdf http://code.google.com/p/dompdf/ 使用 R&OS PDF 类进行渲染,因此这可能会对您有所帮助。
如果您有 .ttf 字体,请跳到步骤 2。
我遇到了空格问题,所以我使用驼峰命名法,我的 .ttf 扩展名是大写,我的 .afm 扩展名是小写。一旦我确保我的 .afm 和 .ttf 以 CamelCase 命名,没有空格和小写扩展名,它就可以工作了!
这可能是 dompdf 特定的,然后我必须更新 dompdf_font_family_cache.dist.php 并将我的字体包含在数组中,如下所示:
注意:我只想要一种版本的字体 - 不是粗体、斜体等,所以我只是让它们全部指向相同的字体文件。
I ran into the same problem using dompdf http://code.google.com/p/dompdf/ which uses R&OS PDF Class for rendering so this may help you.
If you have a .ttf font skip to step 2.
I had problems with spaces so I used CamelCase and my .ttf extension was uppercase and my .afm extension was lower case. Once I made sure I had the .afm and .ttf named in CamelCase with no spaces and lower case extensions it worked!
This is probably dompdf specific, I then had to update dompdf_font_family_cache.dist.php and include my font in the array like so:
Note: I only wanted one version of the font - not bold, italic etc so I just made them all point to the same font file.