font not shown

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
life4what

font not shown

Post by life4what »

I am new to IM. I got the below problem about annotate or font related.

We I using convert and font/text related. All the text cannot come out from the target image file.

I searched in this forum and found it may coz by the ttf file on the server ??

I tried to find the arial.ttf from my window XP and then upload to my host server. But it still failed. My command using is as below:

/usr/bin/convert -font $full_path_to_public_program/arial.ttf $aFromfile -append -pointsize 30 -gravity North -annotate 0 'Hello' $Tofile

Anyone can give me some advice? Thank you.


P.s. when I run system("exec 2>&1; /usr/local/bin/identify -debug configure -list type");
I got the below messages:

2007-02-25T21:07:41+08:00 0:01 0.000u 6.3.1 Configure identify[9576]: utility.c/unknown/805/Configure
Command line: /usr/local/bin/identify{-debug}{configure}{-list}{type}
2007-02-25T21:07:41+08:00 0:01 0.000u 6.3.1 Configure identify[9576]: configure.c/unknown/482/Configure
Searching for configure file: "/usr/local/lib/ImageMagick-6.3.1/config/type.xml"
2007-02-25T21:07:41+08:00 0:01 0.000u 6.3.1 Configure identify[9576]: configure.c/unknown/482/Configure
Searching for configure file: "/usr/local/share/ImageMagick-6.3.1/config/type.xml"
2007-02-25T21:07:41+08:00 0:01 0.000u 6.3.1 Configure identify[9576]: configure.c/unknown/482/Configure
Searching for configure file: "/usr/local/share/doc/ImageMagick-6.3.1/type.xml"
2007-02-25T21:07:41+08:00 0:01 0.000u 6.3.1 Configure identify[9576]: configure.c/unknown/482/Configure
Searching for configure file: "/usr/local/share/ImageMagick-6.3.1/type.xml"
2007-02-25T21:07:41+08:00 0:01 0.000u 6.3.1 Configure identify[9576]: configure.c/unknown/482/Configure
Searching for configure file: "type.xml"
2007-02-25T21:07:41+08:00 0:01 0.000u 6.3.1 Configure identify[9576]: type.c/unknown/928/Configure
Loading type map "/usr/local/lib/ImageMagick-6.3.1/config/type.xml" ...
2007-02-25T21:07:41+08:00 0:01 0.000u 6.3.1 Configure identify[9576]: type.c/unknown/928/Configure
Loading type map "/usr/local/lib/ImageMagick-6.3.1/config/type-ghostscript.xml" ...

Path: /usr/local/lib/ImageMagick-6.3.1/config/type-ghostscript.xml

Name Family Style Stretch Weight
--------------------------------------------------------------------------------
AvantGarde-Book AvantGarde Normal Normal 400
AvantGarde-BookOblique AvantGarde Oblique Normal 400
AvantGarde-Demi AvantGarde Normal Normal 600
AvantGarde-DemiOblique AvantGarde Oblique Normal 600
Bookman-Demi Bookman Normal Normal 600
Bookman-DemiItalic Bookman Italic Normal 600
Bookman-Light Bookman Normal Normal 300
Bookman-LightItalic Bookman Italic Normal 300
Courier Courier Normal Normal 400
Courier-Bold Courier Normal Normal 700
Courier-BoldOblique Courier Oblique Normal 700
Courier-Oblique Courier Oblique Normal 400
fixed Helvetica Normal Normal 400
Helvetica Helvetica Normal Normal 400
Helvetica-Bold Helvetica Normal Normal 700
Helvetica-BoldOblique Helvetica Italic Normal 700
Helvetica-Narrow Helvetica Narrow Normal Condensed 400
Helvetica-Narrow-Bold Helvetica Narrow Normal Condensed 700
Helvetica-Narrow-BoldOblique Helvetica Narrow Oblique Condensed 700
Helvetica-Narrow-Oblique Helvetica Narrow Oblique Condensed 400
Helvetica-Oblique Helvetica Italic Normal 400
NewCenturySchlbk-Bold NewCenturySchlbk Normal Normal 700
NewCenturySchlbk-BoldItalic NewCenturySchlbk Italic Normal 700
NewCenturySchlbk-Italic NewCenturySchlbk Italic Normal 400
NewCenturySchlbk-Roman NewCenturySchlbk Normal Normal 400
Palatino-Bold Palatino Normal Normal 700
Palatino-BoldItalic Palatino Italic Normal 700
Palatino-Italic Palatino Italic Normal 400
Palatino-Roman Palatino Normal Normal 400
Symbol Symbol Normal Normal 400
Times-Bold Times Normal Normal 700
Times-BoldItalic Times Italic Normal 700
Times-Italic Times Italic Normal 400
Times-Roman Times Normal Normal 400
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: font not shown

Post by Bonzo »

As you say you do not have arial in the imagemagick build ? I think arial is a windows standard font.

You can either upload arial.ttf to your server :

Code: Select all

// arial.ttf in the same folder or use the path to arial.ttf
/usr/bin/convert -font arial.ttf $aFromfile -append -pointsize 30 -gravity North -annotate 0 'Hello' $Tofile
or use another font from your list.

Code: Select all

/usr/bin/convert -font Helvetica $aFromfile -append -pointsize 30 -gravity North -annotate 0 'Hello' $Tofile
life4what

Re: font not shown

Post by life4what »

Still not work....

did I need to specify the location/path of Helvetica.ttf ?

How do IM know where is the path of Hevetica.ttf if I am not specify
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: font not shown

Post by Bonzo »

Try this and see if it works; it will create an image with some text on it:

Code: Select all

<?php 
exec("/usr/local/bin/convert -background lightblue -fill blue -font Courier -pointsize 72 label:Hello label.gif "); 
?> 
<img src="label.gif ">
In some of your example code you are using user/local/bin/convert and in others user/bin/convert Which is correct ?

Helvetica is in the build so the code will know where it is; if the font is not in the build you have to specify the path.
life4what

Re: font not shown

Post by life4what »

Yes it is /usr/local/bin/convert , just type missing before. I can use all convert function except the label/fonts related. :(
Failed to create the label.gif...........

Additional information: (after searched some old posts here)
When I am using identify -list format,

I found the freetype is not installed in it.
So, is the font failure is due to the in-existence of freetype??
life4what

Re: font not shown

Post by life4what »

I tried another host which show there have Freetype 2.1.9 installed.

But still failed to do the text adding ........
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: font not shown

Post by Bonzo »

I did have problems on my server with all text at one point. My hosts updated ImageMagick and added the Ghostscript code that cured it.
life4what

Re: font not shown

Post by life4what »

My host added the free type already

But see got the error below:

convert: unable to get type metrics `1234'

anyone have the idea how to solve it?
Post Reply