Unicode support for DrawableText()

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
jsanterre
Posts: 31
Joined: 2014-05-09T10:39:21-07:00
Authentication code: 6789

Unicode support for DrawableText()

Post by jsanterre »

Hi!

I need to create a DrawableText() object in C++ that support Unicode characters. I noticed that the constructor for DrawableText() is taking an encoding as an optional parameter. I tried the following: converting a wstring to an utf8 encoded string, pass this string as the text parameter and pass "UTF-8" as the encoding parameter. But it didn't work -- it displays an ? on screen instead of each Unicode character.

Would you have some advice for me?

Many thanks!

Julie
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Unicode support for DrawableText()

Post by dlemstra »

Can you post a small code example? You don't need to specify the encoding parameter. Just make sure you pass an utf8 encoded string. And make sure that the font you are using supports those characters.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
jsanterre
Posts: 31
Joined: 2014-05-09T10:39:21-07:00
Authentication code: 6789

Re: Unicode support for DrawableText()

Post by jsanterre »

Thank you very much for your help Dirk!

It turned out that I just needed to make sure the font I'm using support Unicode Characters. (From Dirk: "setting the font to 'Arial-Unicode-MS'")

I thought I should post the solution to my problem here so someone else could benefit from this.

Thank you again for your wonderful support! :D

Julie
Post Reply