Page 1 of 1

Text with special characters (ღ for example)

Posted: 2012-06-08T07:19:19-07:00
by sheepherd
There are numerous images which I should annotate with text, some phrases have some special characters such as ღ and some others.

Code: Select all

convert label:ღтестღ image.jpg
тест - is test in Russian
as a result of this command i get image with text
?тест?
how can I make imagemagick draw such characters on images?

Re: Text with special characters (ღ for example)

Posted: 2012-06-08T21:13:39-07:00
by fmw42
I am not an expert on this, but perhaps the font you are using does not support that character.

also see
http://www.imagemagick.org/Usage/text/#unicode

Re: Text with special characters (ღ for example)

Posted: 2012-06-09T00:39:34-07:00
by sheepherd
I tried to create image with such character in GIMP image editor using font 'Ubuntu' - it works. Then I tried to do same with imagemagick:

Code: Select all

$ convert -list font |grep -i ubuntu
  Font: Ubuntu-Bold
    family: Ubuntu
    glyphs: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf
  Font: Ubuntu-Bold-Italic
    family: Ubuntu
    glyphs: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-BI.ttf
  Font: Ubuntu-Condensed-Regular
    family: Ubuntu Condensed
    glyphs: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-C.ttf
  Font: Ubuntu-Italic
    family: Ubuntu
    glyphs: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-RI.ttf
  Font: Ubuntu-Light
    family: Ubuntu
    glyphs: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-L.ttf
  Font: Ubuntu-Light-Italic
    family: Ubuntu
    glyphs: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-LI.ttf
  Font: Ubuntu-Mono-Bold
    family: Ubuntu Mono
    glyphs: /usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-B.ttf
  Font: Ubuntu-Mono-Bold-Italic
    family: Ubuntu Mono
    glyphs: /usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-BI.ttf
  Font: Ubuntu-Mono-Italic
    family: Ubuntu Mono
    glyphs: /usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-RI.ttf
  Font: Ubuntu-Mono-Regular
    family: Ubuntu Mono
    glyphs: /usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf
  Font: Ubuntu-Regular
    family: Ubuntu
    glyphs: /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf

Code: Select all

printf "тест \U10E6" | convert -font Ubuntu-Regular -background lightblue -fill blue -pointsize 36 label:@-  label_quotes.gif
still getting: тест?

\U10E6 - is unicode value of ღ
http://en.wikipedia.org/wiki/List_of_Unicode_characters

Re: Text with special characters (ღ for example)

Posted: 2012-06-09T10:43:57-07:00
by fmw42
It fails for me using Arial and label: or caption:, but works if I use PANGO:. IM 6.7.7.6 Q16 Mac OSX SnowLeopard

convert -font Arial Pango:ღтестღ image.jpg

But you have to install the PANGO delegate. I have

convert -list format
...
PANGO* PANGO r-- Pango Markup Language (Pangocairo 1.30.0)


So it could be a bug in label: and captions:. The IM developers would have to assess that.

Re: Text with special characters (ღ for example)

Posted: 2012-06-09T18:45:19-07:00
by magick
You need a font that has a glyph defined for \U10E6. We use Arial Unicode MS and the character renders properly:
  • convert -pointsize 48 -font arial-unicode.ttf label:ღтестღ label.png

Re: Text with special characters (ღ for example)

Posted: 2012-06-13T01:44:28-07:00
by sheepherd
magick wrote:You need a font that has a glyph defined for \U10E6. We use Arial Unicode MS and the character renders properly:
  • convert -pointsize 48 -font arial-unicode.ttf label:ღтестღ label.png
Now it works with this font. Thank you very much :)