Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
493 views
in Technique[技术] by (71.8m points)

installation - Make ImageMagick recognize a font

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...