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?".
I am trying to set the font option within a convert command to use the server path to a windows true type font file (.ttf) and it is not working. I have done this before on servers that I control but this is a remote server and I do not have access to ssh and cannot modify the server fonts library, hence the need to upload the .ttf files and point directly to them.
In the following command, can you see why the -font option is not working?
Thanks for the info. I have read over the scripts and they are great for adding ttf files to the IM fonts library but my issue is that I am using the full path to the ttf file in my convert command which is supposed to work and does work on other applications that I have written and on this particular application (uses the convert command listed in my previous post) , full paths to the ttf files does not work which leads me to believe that it will continue to fail even after the ttf file is added to the IM fonts library.
Also, it is not a simple thing for me to run commands like :
convert -font list
and view the output as I do not have access to ssh on the remote server and am running my IM commands from within a web app where the output can not be easily sent to the browser.
<?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>";
?>
Loads of other information on my site with php examples and how to find setup information.
The \ is a leftover escape character that I forgot to edit out before printing the command in the forum. I am actually using the perl 'system' function from within my web app to issue the IM commands and the double quotes need to be escaped.
I actually just found out that I do have a limited ssh login to the server so I can see the convert -list fonts output.
The fonts that I want to use are not listed of course but they should still work from the absolute paths, no ?
OK. When I try to run my convert command from the shell I get an error that convert cant read the ttf file
I checked the path to the ttf file and it is correct and the file was 755 so it should have worked. I changed the ttf file to 777 and convert still cant read it.
Does your version of ImageMagick include support for Freetype? Type
identify -list configure
The DELEGATES tag should mention freetype.
Can you post a URL to your Postscript image. Its possible Ghostscript is choking on an embedded font. We need to reproduce the problem to be of any help.
When we were troubleshooting paths before, I got it to work using a relative path and the same ttf file that is choking now.
Here is the output requested:
I really need to get this ghostscript error resolved in order to complete my project.
If I run the following command at the shell as one user, it works. If I run the same command as another user, I get the ghostscript error. I use the same TTF font file for both tests. Is it possible that it is a permissions error? I know I have permission to the TTF but is it possible that I do not have a ghostscript permission as the user that gets the error?
command: convert -background white -fill black -font Coopbl.TTF -pointsize 35 label:'text' test.gif
Well, I figured it out and thought I would share the solution. I don't know what the permissions error was since my account on this server is so limited but I moved the ttf files to another area of my server space and set the permissions on the ttf files to 755 and it works perfectly using absolute or relative paths so for whatever reason, my user and the apache server account could not read the files from the other directory even though the ttf files were 755.