让 ImageMagick 识别字体 [英] Make ImageMagick recognize a font

查看:48
本文介绍了让 ImageMagick 识别字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在 Ubuntu 9.10 上的 ImageMagick 上玩图像生成.我希望能够让它识别一种字体,以便我可以用它的昵称"来称呼它.

I've been playing image generation on ImageMagick on Ubuntu 9.10. I want to be able to get it to recognize a font so that I may call it by it's "nickname".

我可以通过键入找到 ImageMagick 识别的字体列表

I can find the list of fonts ImageMagick recognizes by typing

identify -list font

在该列表中,我看到了 Times-Bold.因此

In that list I see Times-Bold. Therefore

convert -font Times-Bold label:abcdef times.gif

将生成 Times New Roman Bold 字体的 gif 文件.

will generate a gif file with the Times New Roman Bold font.

我知道我可以传递字体的路径而不是它的昵称,但我需要能够使用它的昵称,这样我在从一个系统移动到另一个系统时错误更少.我正在尝试使用的字体是一种名为 Segoe 的真字体用户界面.

I know I can pass the path to the font instead of it's nickname, but I need to be able to use its nickname so I have less errors when moving from system to system. The font I'm trying to get to work in particular is a true type font called Segoe UI.

我的系统中已经安装了 Segoe UI.如果我将路径传递给字体,它就可以工作.但我希望能够使用类似

I already have Segoe UI installed in my system. If I pass the path to the font it works. But I want to be able to use something like

convert -font Segoe-UI label:abcdef segoe.gif

谢谢!

推荐答案

据我所知,identify 使用一个名为 type.xml 的配置文件来按名称定位字体.您可以在系统级别更改 imagemagick 自己的此文件副本,或在用户级别添加额外字体.

From what I remember, identify uses a configuration file, called type.xml, to locate fonts by name. You can alter imagemagick's own copy of this file at a system level, or add extra fonts in a user-level one.

有一个名为 imagick_type_gen 的脚本使用定位"数据库在您的系统上查找字体并生成这些配置文件之一,然后您可以使用它来配置 imagemagick;对于普通用户,我认为这在 ~/.magick/type.xml 中,尽管您可以将其放在系统级别的某个位置.这通常是 我过去用过的东西.

There's a script called imagick_type_gen that will use the "locate" database to find fonts on your system and generate one of these configuration files, which you can then use to configure imagemagick; for an ordinary user I think this goes in ~/.magick/type.xml, though you can put it at a system level somewhere. This is generally what I've used in the past.

所以,基本上我认为你需要配置你的系统 type.xml 文件或添加一个用户级别的文件.只要您在迁移到新系统时可以执行此操作,对于将运行 imagemagick 的任何用户,如果字体路径不同,您至少应该能够不更改代码.

So, basically I think you need to configure your system type.xml file or add a user-level one. As long as you can do this when you move to a new system, for whichever user will be running imagemagick, you should at least be able to get away with not changing your code if the path to the font is different.

这篇关于让 ImageMagick 识别字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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