Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open OTF fonts with php - greek characters included

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

like image 924
magtak Avatar asked Jan 04 '12 08:01

magtak


1 Answers

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.

like image 130
Hossein Avatar answered Oct 29 '22 10:10

Hossein