Custom fonts with ImageMagick and Apache
Posted: 2019-07-09T03:23:44-07:00
I have installed some custom TTF fonts for use with ImageMagick in order to convert an SVG file to a PNG.
The fonts are recognized by ImageMagick when the following command is run:
The output from this command shows that the file /home/matt/.magick/type.xml has been read. The script I use to generate and convert the SVG file works and the output image correctly uses these fonts.
I am building a site that will convert dynamically generated SVG files so need the fonts to be available when the script is called from apache, via PHP exec.
I have copied the same type.xml file to /var/www/.magick but it is not picked up by ImageMagick.
When the same script is called via the site the custom fonts are substituted. Running the same command as above as the www-data user shows that the custom fonts I have added are not listed.
Does anyone know why this might be happening or how I can make custom fonts available to ImageMagick when called via the apache user?
The fonts are recognized by ImageMagick when the following command is run:
Code: Select all
convert -list font
I am building a site that will convert dynamically generated SVG files so need the fonts to be available when the script is called from apache, via PHP exec.
I have copied the same type.xml file to /var/www/.magick but it is not picked up by ImageMagick.
When the same script is called via the site the custom fonts are substituted. Running the same command as above as the www-data user shows that the custom fonts I have added are not listed.
Code: Select all
sudo -u www-data convert -list font