[Fonts] Load a font dynamically

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
t-servi

[Fonts] Load a font dynamically

Post by t-servi »

Hello,
I have ImageMagick 6.2.3 and I want to load font for IM. How can I do that?
Best regards.
Jean Tinguely Awais.

Edit : I'm on Linux.
Edit : In fact is it possible to dynamicaly load a font like this :
convert -font font1.ttf ....
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: [Fonts] Load a font dynamically

Post by anthony »

You either use the font directly using -font path/to/font/file.ttf Or you specify the font in the system "type.xml" or personal "type.xml" file.

A script is on the IM Example home page for linux/mac systems that will generate a "type.xml" file containing all fonts that it can find on a machine using the 'locate' command.

http://imagemagick.org/Usage/#font
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
t-servi

Re: [Fonts] Load a font dynamically

Post by t-servi »

Hello,
Thank you.
Well I try it :

Code: Select all

convert -font  /media/druckerbereich/fonts/gillsans.ttf  -pointsize 72 label:Test test.gif
but IM says :
convert: unable to read font `/media/druckerbereich/fonts/gillsans.ttf'.
I have missinstalled something but I don't know what. Do you know what it could be?
Best regards.
Jean Tinguely Awais.
t-servi

Re: [Fonts] Load a font dynamically

Post by t-servi »

Hello,
Now It's working. My path was false :oops:
Best regards.
Jean Tinguely Awais.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: [Fonts] Load a font dynamically

Post by anthony »

Of course if you update one of the type.xml files you don't need a path. You can have a personal type.xml that will add more fonts to the ones defined in the system type.xml
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
t-servi

Re: [Fonts] Load a font dynamically

Post by t-servi »

Hello,
OK, I understand the system of the type.xml, I have tried it. But in this fall, the programm needs to call dynamicaly the font. And it works. Thank you ImageMagick and thank you for your answer.
Best regards.
Jean Tinguely Awais.
Post Reply