Page 1 of 1

PHP -> ImageMagick -> Pango with custom font

Posted: 2020-02-21T14:54:31-07:00
by rlindner
I'm trying to use a custom font in PHP with Imagick via Pango and I'm unsure how to specify the location of the font file. Can anyone help with a few example lines of PHP code showing how to render "Test String" using myfont.otf without the need for myfont.otf to be registered as a system font?

Thanks in advance!

Re: PHP -> ImageMagick -> Pango with custom font

Posted: 2020-02-21T15:45:08-07:00
by fmw42
I do not believe you can specify custom fonts. See https://imagemagick.org/Usage/text/#pango
Fonts
Pango can change fonts in the middle of rendering. It already does so easily for bold and italic text. However the font specification is from GTK, and as such uses a different system to ImageMagick in general.
You can find out more about fonts using GTK, by running the "gtk-demo" program, and double clicking "Pickers" and the "Text Widget".