Re: using symbols with gm convert draw text

Bob Friesenhahn <[email protected]> Tue, 14 Feb 2023 13:41:21 -0600 (CST)
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
On Tue, 14 Feb 2023, Gerhard Roediger wrote:

> Hello,
>
> how can one use the
>
>    gm convert -draw 'text posx,posy "TEXT" file1.jpg file2.jpg
>
> command, when TEXT contains symbols like the diameter symbol? I tried to use \U+2300 or double escaping it with \\U+2300 and other combinations. Nothing seems to bring up the wanted diameter symbol.
>
> Is this possible and if, how?

Since GraphicsMagick is an old C program, the text it handles needs to 
be simple ASCII, or UTF-8 (multi-character representation of Unicode 
supporting NULL termination), or an an encoding which matches the 
encoding of the selected font (-font).  This means that if you paste 
in the diameter symbol into TEXT and TEXT is a valid UTF-8 string, and 
the symbol is available in the selected font, then it should work. 
Not all font files will contain the symbol.

To make matters more confusing, TrueType fonts may have different 
characters encodings in order to support something other than Unicode. 
This is handled via the -encoding option, which may be one of 
"AdobeCustom, AdobeExpert, AdobeStandard, AppleRoman, BIG5, GB2312, 
Latin 2, None, SJIScode, Symbol, Unicode, Wansung".

Make sure that your font file has what is needed.  The GNU Unifont 
TrueType font file (https://unifoundry.com/unifont/) may be useful for 
testing.

It seems like a useful enhancement to support Unicode markups as you 
are attempting to use.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt