[GRASS-user] d.text greek letters.

Vaclav Petras wenzeslaus at gmail.com
Wed May 18 07:05:03 PDT 2016


Hello Martin,

On Wed, May 18, 2016 at 8:30 AM, Martin Album Ytre-Eide <
Martin.Album.Ytre-Eide at nrpa.no> 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/20160518/3e1eada3/attachment.html>


More information about the grass-user mailing list