Question

So, as the title says, my task is to convert a given phrase to an image on server side (php GD) with a selected .otf font. The phrase can include not only latin characters but also greek and cyrillic.

PHP's imagettftext (http://php.net/manual/en/function.imagettftext.php) won't work with non-latin characters on .otf fonts (works ok with .ttf as it seems).

Any clues?

EDIT: Font needs to be .otf

Was it helpful?

Solution 2

Posting rough answer that seems to work for future people bumping on this post:

Solution seemed to be: 1) open OTF with LATEX server side 2) produce PDF 3) convert to image with ImageMagick library.

OTHER TIPS

Use imagefttext function instead. It has the same arguments and usage as imagettftext, but uses the FreeType 2 library which supports OpenType and plenty of other font formats.

It doesn't support OpenType's layout tables however. See FreeType 2's FAQ for more info.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top