Fonts information

Note: You can not change the style of a font as in html; if you want an italic font you can not change a standard font to italic.
( I have found you can modify the fonts when using -draw )
You are not restricted to the fonts installed with ImageMagick but can use any True type Font, PostScript font, X11 font and use the path to the font in the code

You can find which fonts are available to you in your standard installation by using the code below. ( NB: that "font" replaced "type" in the latest release due to a name clash for the '-type' options list ).

This code will use the correct method automaticaly depending on the version of ImageMagick installed.

<?php 
// Select the version number from the configeration file
preg_match('/^LIB_VERSION_NUMBER ([0-9,]+)$/m'shell_exec("convert -list configure "), $vnums);

// Seperate the numbers at the ,
$number explode","$vnums[1] );

// Format the version from 6,3,4,1 format to 06030401
$version "";

for(
$i=0;$i<4;$i++)
{
$version .= str_pad$number[$i], 2'0'STR_PAD_LEFT );


// The 'list' method used to get the fonts changed in IM v6.3.5-7
$font_list = ( $version "06030507" ) ? "font" "type";

// Display the version of Imagemagick, the method to read the fonts and the list of fonts
echo "<h2>IM version: ".$version." </h2>\n
<h3>Method used: convert -list $font_list</h3>\n
<hr>\n<pre>"
;
system("convert -list $font_list");
echo 
"</pre>\n<hr>";
?>

Output:

IM version: 06030506 
Method used: convert -list type

--------------------------------------------------------------------------------

Path: /usr/lib/ImageMagick-6.3.5/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

Path: System Fonts

Name                             Family                 Style   Stretch   Weight
--------------------------------------------------------------------------------
Bitstream-Charter-Bold           Bitstream Charter      Normal  Normal       700
Bitstream-Charter-Bold-Italic    Bitstream Charter      Italic  Normal       700
Bitstream-Charter-Italic         Bitstream Charter      Italic  Normal       400
Bitstream-Charter-Regular        Bitstream Charter      Normal  Normal       400
Century-Schoolbook-Bold          Century Schoolbook     Normal  Normal       700
Century-Schoolbook-Bold-Italic   Century Schoolbook     Italic  Normal       700
Century-Schoolbook-Italic        Century Schoolbook     Italic  Normal       400
Century-Schoolbook-Roman         Century Schoolbook     Normal  Normal       400
Dingbats-Regular                 Dingbats               Normal  Normal       400
Nimbus-Mono-Bold                 Nimbus Mono            Normal  Normal       700
Nimbus-Mono-Bold-Oblique         Nimbus Mono            Oblique Normal       700
Nimbus-Mono-Regular              Nimbus Mono            Normal  Normal       400
Nimbus-Mono-Regular-Oblique      Nimbus Mono            Oblique Normal       400
Nimbus-Roman-No9-Bold            Nimbus Roman No9       Normal  Normal       700
Nimbus-Roman-No9-Bold-Italic     Nimbus Roman No9       Italic  Normal       700
Nimbus-Roman-No9-Regular         Nimbus Roman No9       Normal  Normal       400
Nimbus-Roman-No9-Regular-Italic  Nimbus Roman No9       Italic  Normal       400
Nimbus-Sans-Bold                 Nimbus Sans            Normal  Normal       700
Nimbus-Sans-Bold-Italic          Nimbus Sans            Italic  Normal       700
Nimbus-Sans-Condensed-Bold       Nimbus Sans Condensed  Normal  Normal       700
Nimbus-Sans-Condensed-Bold-Itali Nimbus Sans Condensed  Italic  Normal       700
Nimbus-Sans-Condensed-Regular    Nimbus Sans Condensed  Normal  Normal       400
Nimbus-Sans-Condensed-Regular-It Nimbus Sans Condensed  Italic  Normal       400
Nimbus-Sans-Regular              Nimbus Sans            Normal  Normal       400
Nimbus-Sans-Regular-Italic       Nimbus Sans            Italic  Normal       400
Standard-Symbols-Regular         Standard Symbols       Normal  Normal       400
URW-Bookman-Demi-Bold            URW Bookman            Normal  Normal       700
URW-Bookman-Demi-Bold-Italic     URW Bookman            Italic  Normal       700
URW-Bookman-Light                URW Bookman            Normal  Normal       400
URW-Bookman-Light-Italic         URW Bookman            Italic  Normal       400
URW-Chancery-Medium-Italic       URW Chancery           Italic  Normal       500
URW-Gothic-Book                  URW Gothic             Normal  Normal       300
URW-Gothic-Book-Oblique          URW Gothic             Oblique Normal       300
URW-Gothic-Demi                  URW Gothic             Normal  Normal       600
URW-Gothic-Demi-Oblique          URW Gothic             Oblique Normal       600
URW-Palladio-Bold                URW Palladio           Normal  Normal       700
URW-Palladio-Bold-Italic         URW Palladio           Italic  Normal       700
URW-Palladio-Italic              URW Palladio           Italic  Normal       400
URW-Palladio-Roman               URW Palladio           Normal  Normal       400
Utopia-Bold                      Utopia                 Normal  Normal       700
Utopia-Bold-Italic               Utopia                 Italic  Normal       700
Utopia-Italic                    Utopia                 Italic  Normal       400
Utopia-Regular                   Utopia                 Normal  Normal       400

Viewing your fonts as they actualy are, images of each in one large image. I have reduced the image size. To create a larger image alter the values on this line:

There is a blank space for "Dingbats-Regular" which I assume as it will not work for this example it will not work in any code; the same for "Standard-Symbols-Regular" which just displays ????

<?php
exec
("convert -size 250x15 xc:lightblue -font $Font -pointsize 13 -draw \"gravity West fill black text 0,0 $Font \" $Image");
?>



<?php 
// Select the version number from the configeration file
    
preg_match('/^LIB_VERSION_NUMBER ([0-9,]+)$/m'shell_exec("convert -list configure "), $vnums);

// Seperate the numbers at the ,
    
$number explode","$vnums[1] );

// Format the version from 6,3,4,1 format to 06030401
    
$version "";
    for(
$i=0;$i<4;$i++)
    {
    
$version .= str_pad$number[$i], 2'0'STR_PAD_LEFT );
    } 

// The 'list' method used to get the fonts changed in IM v6.3.5-7
    
$font_list = ( $version "06030507" ) ? "font" "type";

// Populate the array only - do not display it
    
exec("convert -list $font_list"$IMarray$code);

// Sort the array alphabeticly
    
sort$IMarray );

// Setup some default values
    
$delete = array();
    
$image_list "";

// Function to remove items from array
    
function array_delete$array$filterfor ){ 
        
$thisarray = array (); 
        foreach( 
$array as $value 
        if( 
stristr$value$filterfor )===false && strlen$value )>0
        
$thisarray[] = $value
        return 
$thisarray
    } 

// Remove items containing Name from the arrary
    
$NoName array_delete$IMarray"Name" ); 

// Remove items containing Path: from the array
    
$NoPath array_delete$NoName"Path:" ); 

// Find the amount of items in the array
    
$count count$NoPath );

// Reduce the count by one as the array starts at 0
    
$count $count-1;

// Start the loop to generate the images
    
for ( $i=2$i<=$count$i++ ) {

// Get the font name from the array
        
$FirstPart explode(' '$NoPath[$i]);
        
$Font $FirstPart['0'];
        
$Image $Font.".png";
        
// Create the images
        
exec("convert -size 250x15 xc:lightblue -font $Font -pointsize 13 -draw \"gravity West fill black text 0,0 $Font \" $Image");

// Generate the list of images for use in the large image
        
$image_list $image_list." ".$Image;

// Generate the array of tempory images to delete
        
$delete[] = $Image;
    }

// Create the large image
    
exec("convert -background white -gravity Center $image_list -append fonts.png");

// Delete the tempory images
    
foreach ( $delete as $value ) { 
        
unlink$value ); }
?>