PHP ImageMagick - Draw Indic text using font file, not from system fonts

397 views Asked by At

I am trying to draw Devanagari text on image using PHP ImageMagick. ImageMagick renders text correctly if I use font available in the system, but not when loading a font from a file. For exmaple if use

$imagick->setFont('Lohit Marathi');// installed font

works correctly but if I use

$imagick->setFont("fonts/lohit_mr.ttf");//load from file

Font does not loads and it renders using default font.

code I am trying is as follows

<?php
$imagick = new Imagick();
$imagick->setFont('ANY_SYSTEM_FONT') // works; 
$imagick->setFont('somefont.ttf') // does not work;  
?>

Can someone point out anything I am missing?

0

There are 0 answers