Page 1 of 1

Render more UTF-8 symbols when making Labels with convert

Posted: 2017-08-31T03:19:39-07:00
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:

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

Posted: 2017-08-31T04:00:09-07:00
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.

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

Posted: 2017-08-31T04:34:32-07:00
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 ? )

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

Posted: 2017-08-31T04:58:08-07:00
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?

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

Posted: 2017-08-31T05:06:55-07:00
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.

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

Posted: 2017-08-31T11:14:12-07:00
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)