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

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

问题描述

我已经在Ubuntu 9.10上的ImageMagick上播放图像了。我希望能够识别字体,以便我可以通过它的昵称来调用它。

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

  identify -list font  



在那个列表中,我看到Times-Bold。因此

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

将生成一个带有Times New Roman粗体字体的gif文件。

我知道我可以将路径传递给字体而不是它的昵称,但我需要能够使用它的昵称,所以我从系统移动到系统时有更少的错误。我试图特别工作的字体是一种真正的字体,称为 Segoe UI



我的系统中已经安装了Segoe UI。如果我将路径传递给它的字体,但是我希望能够使用类似于

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

谢谢!

解决方案

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



有一个名为 imagick_type_gen 将使用locate数据库在您的系统上查找字体,生成这些配置文件之一,然后您可以使用它来配置imagemagick;对于一个普通的用户,我认为这是在〜/ .magick / type.xml 中,尽管你可以把它放在某个系统级别。这通常是

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".

I can find the list of fonts ImageMagick recognizes by typing

identify -list font

In that list I see Times-Bold. Therefore

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

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

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.

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

Thanks!

解决方案

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.

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.

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天全站免登陆