[GRASS-user] Using non-ASCII characters in Legend display

Markus Neteler neteler at osgeo.org
Fri Aug 12 19:35:00 EDT 2011


2011/8/12 António Rocha <antonio.rocha at deimos.com.pt>:
> Greetings
>
> I'm not being able to display non-ascii characters in Legend (e.g. á à ã â
> ç). Instead of the chatracter a blank space is displayed. (but with query
> tool, I can display labels full name in Command Output window)
> I know that I shall select encoding and Font type that supports these
> characters. I have tried several of them and no LUCK. Has anyone tried this
> before? Or anyone has any suggestion?


I have to use a freetype font, for example "Vera":
Then this:
 echo "ciao: +èò" | d.text
works, also d.legend in the X monitor.

Note: Showing the legend fails in wxGUI because it
falls back to the Hershey fonts.

Suggestion: add from d.text these parameters to d.legend:
         font   Font name
         path   Path to font file
      charset   Text encoding (only applicable to TrueType fonts)

... then the user can set also here directly the freetype font.


I ran into a problem creating a test map:

In the wxGUI, in the "enter values interactively" I cannot
enter special characters:

  File "/home/neteler/grass64/dist.x86_64-unknown-linux-gnu/etc/wxpython/gui_modules/menuform.py",
line 1461, in OnFileText
    f.write(text)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in
position 2: ordinal not in range(128)

However, on command line that works:
GRASS 6.4.2svn (nc_spm_08):~ > echo "1: +èò" | r.category dummy rules=-
GRASS 6.4.2svn (nc_spm_08):~ > r.category dummy
1       +èò

So I think that there is one wish and one bug.

Markus


More information about the grass-user mailing list