Page 1 of 1

Convert and Pango Issues

Posted: 2019-01-25T12:06:02-07:00
by Jeremy
I'm attempting to run a convert command from the command line. The font I'm using has ligatures so I need to use pango. However pango doesn't seem to want to work or recognize the font where label or caption does. My command is:

convert -font test-Regular.ttf -pointsize 124 PANGO:"ac" pango.png - doesn't work

convert -font test-Regular.ttf -pointsize 124 label:"ac" label.png - works

When I run convert -version I get:

Version: ImageMagick 6.9.10-24 Q16 x86_64 2019-01-12 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype jng jp2 jpeg lcms ltdl lzma openexr pangocairo png rsvg tiff webp wmf x xml zlib


Any ideas?

Thanks!

Re: Convert and Pango Issues

Posted: 2019-01-25T12:14:01-07:00
by fmw42
Where can we get test-Regular.ttf to test? If that is a custom font, the please post a link to a copy of it.

Try specifying the font inside the PANGO markup language. See https://imagemagick.org/Usage/text/#pango

Re: Convert and Pango Issues

Posted: 2019-01-25T12:26:46-07:00
by Jeremy
Check your pms

Re: Convert and Pango Issues

Posted: 2019-01-25T13:18:15-07:00
by fmw42
Sorry, I am not having any success either with your font and Pango.

I tried:

Code: Select all

convert -font jeremy-Regular.ttf -pointsize 124 PANGO:"ac" pango.png

and

convert PANGO:'<span font="jeremy-Regular.ttf" size="126976">ac</span>' pango.png

and

convert -font jeremy-Regular.ttf -pointsize 124 PANGO:"@test.txt" pango.png

where test.txt was a UTF-8 compatible text file contains and showing your actual characters.

Using IM 6.9.10.24 Q16 Mac OSX.

However, this works:

Code: Select all

convert -font /Library/fonts/jeremy-Regular.ttf -pointsize 124 CAPTION:"@test.txt" pango.png

Re: Convert and Pango Issues

Posted: 2019-01-25T13:35:02-07:00
by Jeremy
Yeah maybe I made the font wrong. I'm going to take a closer look at it. I'll report back once I find out anything out. Thanks for your help!

Re: Convert and Pango Issues

Posted: 2019-01-25T13:37:52-07:00
by snibgo
As far as I know, pango needs the font to be installed at the system level, rather than simply using a font file.

Re: Convert and Pango Issues

Posted: 2019-01-25T13:51:35-07:00
by fmw42
Your font is fine. See my additional comment above and here. Put the text showing your characters in a UTF-compatible text editor file and then specify the file in the CAPTION with the @ symbol as below. The following works for me.

Code: Select all

convert -font /Library/fonts/jeremy-Regular.ttf -pointsize 124 CAPTION:"@test.txt" pango.png
See https://imagemagick.org/Usage/text/#unicode

Re: Convert and Pango Issues

Posted: 2019-01-25T14:35:13-07:00
by Jeremy
Alright, I'm narrowing it down, I think Pango isn't installed right as it doesn't seem to work with any fonts at all for me.

Re: Convert and Pango Issues

Posted: 2019-01-25T17:38:43-07:00
by fmw42
Did you follow my command using CAPTION? Did that work? You should not need PANGO as CAPTION does work if you specify a UTF-8 compatible text file with your text in your actual font.

Note snigbo's last comment about installing fonts into the System.

Re: Convert and Pango Issues

Posted: 2019-01-28T08:26:42-07:00
by Jeremy
Caption didn't really work for me and PANGO doesn't seem to work with Imagick. I need to spend sometime digging into convert and exec.

Re: Convert and Pango Issues

Posted: 2019-01-28T10:52:45-07:00
by fmw42
To use CAPTION properly, you need to put your text into UTF-8 compatible text file that shows your characters properly. Then use @textfile.txt to load that text into CAPTION. See the link I provided.

Re: Convert and Pango Issues

Posted: 2019-01-28T11:10:46-07:00
by Jeremy
Thanks!

Anyway this works:
convert PANGO:"<span font_family="jeremy" size="126976">ac</span>" pango.png.

It doesn't however seem to work from a PHP exec. I'm sure I'm just missing something small.

Re: Convert and Pango Issues

Posted: 2019-01-28T12:41:15-07:00
by fmw42
PHP uses different environment variables than your OS. So you might try putting the full path to convert in your exec() command