Wrong output of Unicode grapheme cluster

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
gerhard
Posts: 4
Joined: 2019-04-25T08:05:31-07:00
Authentication code: 1152

Wrong output of Unicode grapheme cluster

Post by gerhard »

I'm trying to output a Bengali grapheme cluster (সিং) which consists of 3 codepoints.

Image

When I write input that text in LibreOffice Writer and use the "Noto Sans Bengali Medium" font it looks like this:
Image

But when I output it with the following ImageMagick command it looks wrong:

Code: Select all

convert -font NotoSansBengali-Medium.ttf -pointsize 72  label:"সিং" test.png
You need to download the Noto Sans Bengali font and extract the NotoSansBengali-Medium.ttf into your working directory for this to work.

Image

Do you have any ideas what could be wrong? It looks like a bug to me.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Wrong output of Unicode grapheme cluster

Post by snibgo »

What version of IM? If you build it yourself, what version of freetype?
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Wrong output of Unicode grapheme cluster

Post by fmw42 »

You cannot put the glyph directly into label:. You need to type the glyph into a UTF-8 compatible text editor and then use @textfile.txt to load the glyph, assuming the font supports those glyphs.

See https://imagemagick.org/Usage/text/#unicode
gerhard
Posts: 4
Joined: 2019-04-25T08:05:31-07:00
Authentication code: 1152

Re: Wrong output of Unicode grapheme cluster

Post by gerhard »

snibgo wrote: 2019-04-25T08:56:57-07:00 What version of IM? If you build it yourself, what version of freetype?
Sorry, I forgot to mention this. I testet with ImageMagick 7.0.8-42 and freetype 2.9.1
gerhard
Posts: 4
Joined: 2019-04-25T08:05:31-07:00
Authentication code: 1152

Re: Wrong output of Unicode grapheme cluster

Post by gerhard »

fmw42 wrote: 2019-04-25T09:26:42-07:00 You cannot put the glyph directly into label
No, but I can copy & paste. It works for a lot of other Unicode characters just fine and the webpage you linked suggests the same.
Even if you can not directly type unicode characters, one simple solution is to just 'copy-n-paste' the desired characters
The problem isn't that it doesn't work, but that it doesn't correctly combine the codepoints to render the correct grapheme cluster. Please take a closer look at the images in my first post. The last image was generated with ImageMagick by executing the command I mentioned.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Wrong output of Unicode grapheme cluster

Post by magick »

Do you have the RAQM library installed? It is needed for complex text layout.
gerhard
Posts: 4
Joined: 2019-04-25T08:05:31-07:00
Authentication code: 1152

Re: Wrong output of Unicode grapheme cluster

Post by gerhard »

Thanks! It worked after installing the latest version of RAQM.

Image
Post Reply