[GRASS-user] d.text greek letters.

Martin Album Ytre-Eide Martin.Album.Ytre-Eide at nrpa.no
Thu May 19 00:49:47 PDT 2016


Great! Thanks a lot Vaclov! :)

os.environ['GRASS_FONT']='Ubuntu:Regular'

did the trick for me - of course I am on Ubuntu :)

Thanks for the wxPython text explanation - I was wondering if there where some other d.text-function I might use in my scripting.

Actually d.text in the gui crashed when I tried it (several times.... without any greek letters)

Thanks again!

Hope to see you in Bonn

Cheers

Martin

________________________________
Fra: Vaclav Petras [wenzeslaus at gmail.com]
Sendt: 18. mai 2016 16:05
Til: Martin Album Ytre-Eide
Kopi: grass-user at lists.osgeo.org
Emne: Re: [GRASS-user] d.text greek letters.

Hello Martin,

On Wed, May 18, 2016 at 8:30 AM, Martin Album Ytre-Eide <Martin.Album.Ytre-Eide at nrpa.no<redir.aspx?REF=0ttkY6nIrJupCR7XQZZ8PTzl5wgHhbzIWrqK6QB9Lr0KnZJCt3_TCAFtYWlsdG86TWFydGluLkFsYnVtLll0cmUtRWlkZUBucnBhLm5v>> wrote:
I am struggling with using the greek letter µ in my d.text from a python script:

I trying something like this

Module('d.text',text='µ',at=('85','20') charset='utf8')

you need to set GRASS_FONT to some font which supports Greek letters. Use d.fontlist or d.font -l to get the proper names of fonts. This works for me in command line on Ubuntu:

export GRASS_FONT=Ubuntu:Regular
d.mon wx0
d.text text=θωερτψυιοπασδφγηςκλζχξωβνμάέήίϊΐόύϋΰώ at=5,95


I know that the issue is with the encoding of the characters..... but I do not know how to fix it.

I'm not sure which operating system you are using but on Linux, you usually don't need to set the font, everything is UTF-8.


In the gui i can use µ with add text layer - so I guess this is a python to grass issue.

The behavior is different (for good or bad) - in GUI, d.text is actually not used and wxPython text drawing is used instead.

Vaclav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20160519/899703df/attachment.html>


More information about the grass-user mailing list