Page 1 of 1

Wrong output of Unicode grapheme cluster

Posted: 2019-04-25T08:27:34-07:00
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.

Re: Wrong output of Unicode grapheme cluster

Posted: 2019-04-25T08:56:57-07:00
by snibgo
What version of IM? If you build it yourself, what version of freetype?

Re: Wrong output of Unicode grapheme cluster

Posted: 2019-04-25T09:26:42-07:00
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

Re: Wrong output of Unicode grapheme cluster

Posted: 2019-04-25T12:44:27-07:00
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

Re: Wrong output of Unicode grapheme cluster

Posted: 2019-04-25T12:55:27-07:00
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.

Re: Wrong output of Unicode grapheme cluster

Posted: 2019-04-25T16:04:19-07:00
by magick
Do you have the RAQM library installed? It is needed for complex text layout.

Re: Wrong output of Unicode grapheme cluster

Posted: 2019-04-26T08:03:09-07:00
by gerhard
Thanks! It worked after installing the latest version of RAQM.

Image