Render more UTF-8 symbols when making Labels with convert

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
gwpl
Posts: 4
Joined: 2017-08-31T03:09:11-07:00
Authentication code: 1151

Render more UTF-8 symbols when making Labels with convert

Post by gwpl »

Hello,

Label - Simple Text Label:
http://www.imagemagick.org/Usage/text/#label
teaches us how to make labels with command line convert utility.

However, I come across following issue: only some utf-8 gets rendered, most does not render.

Here is example, for :

Code: Select all

convert -background white -fill black \
 -density 600x600 -size 1346x756 -font DejaVu-Sans -gravity center \
 'label:⌁ Electricity\n🔌 Chargers\n🔋 Powerbanks' \
 out.pdf # or out.png
I get only first symbol rendered, like here:

Image

How to render more utf-8 symbols when making labels with imagemagick?

Cross references:
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Render more UTF-8 symbols when making Labels with convert

Post by snibgo »

You need to specify a font that contains the glyphs you need, eg Segoe UI Symbol. IM won't find the most suitable font for you.
snibgo's IM pages: im.snibgo.com
gwpl
Posts: 4
Joined: 2017-08-31T03:09:11-07:00
Authentication code: 1151

Re: Render more UTF-8 symbols when making Labels with convert

Post by gwpl »

It works in other places: LibreOffice (screenshot), Terminal, Browser... Do I guess correctly that those use rendering engines that failover to another font, when symbol is missing?

(btw. Is there a way I could find out to what font do they resolve? )

More importantly, what if I would like to achieve similar rendering in ImageMagick like in other places, i.e. use font of choice for text and let symbols be rendered with other one? (Does feature request of "--failover-fonts=" imagemagick option (with default value of some fount containing list of fonts with utf-8 symbols) sound like a sound feature request ? )
gwpl
Posts: 4
Joined: 2017-08-31T03:09:11-07:00
Authentication code: 1151

Re: Render more UTF-8 symbols when making Labels with convert

Post by gwpl »

Thanks!

It worked with Symbola font, I captured here results: https://unix.stackexchange.com/a/389474/9689
Still, automatic failover would be great for imagemagic. Does it sound like sound feature request?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Render more UTF-8 symbols when making Labels with convert

Post by snibgo »

I pasted your text into a text processor (Microsoft Wordpad). It showed me the symbols, and gave the name of the font: Segoe UI Symbol.

IM calls some library for rendering glyphs. I don't know what facility that library has for automatic selection of a font that contains glyphs that are missing from the requested font, or if IM could use that facility.

It would be a good idea, if it's feasible.
snibgo's IM pages: im.snibgo.com
gwpl
Posts: 4
Joined: 2017-08-31T03:09:11-07:00
Authentication code: 1151

Re: Render more UTF-8 symbols when making Labels with convert

Post by gwpl »

I wondered about workaround, i.e. how to "combine multiple fonts" so you have most symbols from desired one, and missing taken from others. Let me cross-link to this idea: How to combine multiple fonts into one)
Post Reply