annotate utf8 magick++

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
nicolas1

annotate utf8 magick++

Post by nicolas1 »

Hello,

I have a problem to make "annotate" produce right russian symbols. Input string is in utf8 encoding, the output results in not correct symbols. Seems as ansi of utf8.

How can to output symbols correct in magick++ or magick core?

Thanks
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: annotate utf8 magick++

Post by anthony »

Make sure you have a font that included the UTF characters, and that your environment 'locale' is set to use UTF.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
nicolas1

Re: annotate utf8 magick++

Post by nicolas1 »

simple call:

Code: Select all

image->font("arial");
image->textEncoding("UTF-8");
image->annotate(annotate_text, text_geometry);
and no success...
nicolas1

Re: annotate utf8 magick++

Post by nicolas1 »

SOLVED:

It is required full path specification to unicode font.
for example:

Code: Select all

  magick_image->font("/usr/share/fonts/truetype/unfonts/tahoma.ttf");
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: annotate utf8 magick++

Post by anthony »

Yes, unless the font is added to either the system "type.xml" or the users "type.xml" file. See notes about this on the top level of IM examples. (I really should move this into the 'fonts' section).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply