Unicode bites again :-(

Hi All,

    I thought I had grasped a bit of the unicode mess, but I have been
bitten again and I don't even know how.

As a starter, I would like to display a particular symbol in a
matplotlib axis label. But, as I can't do it, I thought to try it with
wxPython (by drawing it in an OnPaint handler) to find out where my
problem is.

The symbol I am trying to display is the "NEUTER" unicode character:

Python code: u"\u26B2"
Reference: http://www.fileformat.info/info/unicode/char/26b2/index.htm

There are not that many fonts supporting that symbol, but I do have
the one I need (Deja Vu Sans), as explained here:

http://www.fileformat.info/info/unicode/char/26b2/fontsupport.htm

However, when I try to draw it, I only get a square symbol. I attach a
very simple script that demonstrate the problem. What am I doing
wrong?
This is on Windows XP SP2, Python 2.5.2, wxPython 2.8.10.1 (msw-unicode).

Thank you for your suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/

neuter.py (1.28 KB)

Hello,

···

On Fri, Jun 12, 2009 at 9:29 AM, Andrea Gavana<andrea.gavana@gmail.com> wrote:

Hi All,
However, when I try to draw it, I only get a square symbol. I attach a
very simple script that demonstrate the problem. What am I doing
wrong?

Looks like its a small typo in the font name changing to:

        font = wx.Font(60, wx.DECORATIVE, wx.NORMAL, wx.NORMAL,
                       False, "DejaVu Sans")

makes it work. Notice no space between 'Deja 'and 'Vu'

Cody

Hello,

Hello,

Hi All,
However, when I try to draw it, I only get a square symbol. I attach a
very simple script that demonstrate the problem. What am I doing
wrong?

Looks like its a small typo in the font name changing to:

   font = wx\.Font\(60, wx\.DECORATIVE, wx\.NORMAL, wx\.NORMAL,
                  False, &quot;DejaVu Sans&quot;\)

makes it work. Notice no space between 'Deja 'and 'Vu'

Ah, thank you Cody (and Matthias, who replied in a private message)...
I thought I was missing something unicode-related. Now it works fine
in wxPython, but matplotlib refuses to display the correct character
:frowning:

Thank you!

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Fri, Jun 12, 2009 at 3:54 PM, Cody Precord wrote:

On Fri, Jun 12, 2009 at 9:29 AM, Andrea Gavana<andrea.gavana@gmail.com> wrote: