problem with certain unicode characters

It's possible someone else has had this problem and there is a post
which resolved it for them, but I've searched and can't find a
solution.

I'm having difficulty with displaying certain unicode characters. It
could be a font issue, but I've tried changing fonts with no positive
results.

In several places in my program I want to be able to display uppercase
letters as superscripts, in particular "H" (U+1D34), "L" (U+1D38), and
"N" (U+1D3A). When I was using Tkinter, these displayed properly on
my Windows XP machine but they showed up as Chinese characters on my
Mac. I've been rewriting my program to use wxPython instead and now
they show up properly on my Mac but are displayed as narrow, empty
boxes (unprintable characters) on my Windows XP machine.

Any thoughts?

Hi,
I guess, this migt be a font issue; I also noticed that Tkinter is
more robust (or does more magic) in displaying fonts.

You may try to explicitely set a font supporting this character.
I was able to display such letters, e.g.
ᴴ (dec.: 7476) (hex.: 0x1d34) # ᴴ MODIFIER LETTER CAPITAL H (Letter,
Modifier) (Phonetic Extensions [7424-7551] [0x1d00-0x1d7f])

using DejaVu in a wx.TextCtrl widget.
http://dejavu-fonts.org/wiki/Main_Page

However, at the same time, it was enough to just paste this character
into Idle to display it correctly without explicit adjustments.
(both on Win XPp SP3)

hth,
  vbr

···

2010/6/23 Cú Chulainn <jamesrogermartin@gmail.com>:

It's possible someone else has had this problem and there is a post
which resolved it for them, but I've searched and can't find a
solution.

I'm having difficulty with displaying certain unicode characters. It
could be a font issue, but I've tried changing fonts with no positive
results.

In several places in my program I want to be able to display uppercase
letters as superscripts, in particular "H" (U+1D34), "L" (U+1D38), and
"N" (U+1D3A). When I was using Tkinter, these displayed properly on
my Windows XP machine but they showed up as Chinese characters on my
Mac. I've been rewriting my program to use wxPython instead and now
they show up properly on my Mac but are displayed as narrow, empty
boxes (unprintable characters) on my Windows XP machine.

Any thoughts?

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hi,

unicodeIssue.py (1.35 KB)

···

On 23/06/2010 04:30, C� Chulainn wrote:

It's possible someone else has had this problem and there is a post
which resolved it for them, but I've searched and can't find a
solution.

I'm having difficulty with displaying certain unicode characters. It
could be a font issue, but I've tried changing fonts with no positive
results.

In several places in my program I want to be able to display uppercase
letters as superscripts, in particular "H" (U+1D34), "L" (U+1D38), and
"N" (U+1D3A). When I was using Tkinter, these displayed properly on
my Windows XP machine but they showed up as Chinese characters on my
Mac. I've been rewriting my program to use wxPython instead and now
they show up properly on my Mac but are displayed as narrow, empty
boxes (unprintable characters) on my Windows XP machine.

Any thoughts?
   

What is your actual code doing all this?

I just tried it without doing anything special on my Windows 7 machine with Py 2.5 and wxPython 2.8.10.0 - see attached.

Werner

Thanks, Vlastimil! DejaVu Sans works great! I just had to add a
couple lines in which I check if sys.platform == 'win32' and then
self.font.SetFaceName('DejaVu Sans'). Worked beautifully.

···

On Jun 23, 2:09 am, Vlastimil Brom <vlastimil.b...@gmail.com> wrote:

2010/6/23 Cú Chulainn <jamesrogermar...@gmail.com>:

> It's possible someone else has had this problem and there is a post
> which resolved it for them, but I've searched and can't find a
> solution.

> I'm having difficulty with displaying certain unicode characters. It
> could be a font issue, but I've tried changing fonts with no positive
> results.

> In several places in my program I want to be able to display uppercase
> letters as superscripts, in particular "H" (U+1D34), "L" (U+1D38), and
> "N" (U+1D3A). When I was using Tkinter, these displayed properly on
> my Windows XP machine but they showed up as Chinese characters on my
> Mac. I've been rewriting my program to use wxPython instead and now
> they show up properly on my Mac but are displayed as narrow, empty
> boxes (unprintable characters) on my Windows XP machine.

> Any thoughts?

> --
> To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
> or visithttp://groups.google.com/group/wxPython-users?hl=en

Hi,
I guess, this migt be a font issue; I also noticed that Tkinter is
more robust (or does more magic) in displaying fonts.

You may try to explicitely set a font supporting this character.
I was able to display such letters, e.g.
ᴴ (dec.: 7476) (hex.: 0x1d34) # ᴴ MODIFIER LETTER CAPITAL H (Letter,
Modifier) (Phonetic Extensions [7424-7551] [0x1d00-0x1d7f])

using DejaVu in a wx.TextCtrl widget.http://dejavu-fonts.org/wiki/Main_Page

However, at the same time, it was enough to just paste this character
into Idle to display it correctly without explicit adjustments.
(both on Win XPp SP3)

hth,
vbr

Werner,

Basically my code has a Frame class in which I have a Panel (we'll
call it p) and I'm using wx.StaticText to display text. On my Mac the
wx.SWISS font family works great. So within my Frame class I have:

self.font = (16, wx.SWISS, wx.NORMAL, wx.NORMAL)
.
[some intervening code]
.
text = wx.StaticText(p, wx.ID_ANY, str)
text.SetFont(self.font)

The variable str might be something like u'r\edgain\u1d38' which
should display as rígain with a superscript L at the end (nominative
singular of the Old Irish word for 'queen' which causes lenition [thus
the L] on certain words following it).

I've got it working on Windows now anyway (by checking for platform
and then adding self.font.SetFaceName('DejaVu Sans') if sys.platform
== 'win32'), but thanks for the assist.

···

On Jun 23, 4:27 am, werner <wbru...@free.fr> wrote:

Hi,

On 23/06/2010 04:30, C� Chulainn wrote:

> It's possible someone else has had this problem and there is a post
> which resolved it for them, but I've searched and can't find a
> solution.

> I'm having difficulty with displaying certain unicode characters. It
> could be a font issue, but I've tried changing fonts with no positive
> results.

> In several places in my program I want to be able to display uppercase
> letters as superscripts, in particular "H" (U+1D34), "L" (U+1D38), and
> "N" (U+1D3A). When I was using Tkinter, these displayed properly on
> my Windows XP machine but they showed up as Chinese characters on my
> Mac. I've been rewriting my program to use wxPython instead and now
> they show up properly on my Mac but are displayed as narrow, empty
> boxes (unprintable characters) on my Windows XP machine.

> Any thoughts?

What is your actual code doing all this?

I just tried it without doing anything special on my Windows 7 machine
with Py 2.5 and wxPython 2.8.10.0 - see attached.

Werner

unicodeIssue.py
1KViewDownload

wx.SWISS is the default font, at least on my machine.

I am still intriged why you need to do anything special, maybe you are
missing the first line shown in my code attached in the last message,
i.e. “# -- coding: utf-8 --#” which defines the encoding of the .py
source file.

I just do this:

    hSup = u'\u1d34'

    lSup = u'\u1D38'

    nSup = u'\u1D3A'

   

    lWithSup = u'r\xedgain\u1d38'

   

    self.textCtrl1.ChangeValue(('h: %s, l: %s, n: %s') % (hSup,

lSup, nSup))

    self.textCtrl2.ChangeValue(lWithSup)

And this is the result.

moz-screenshot-16.png

Werner

···

On 24/06/2010 05:21, Cú Chulainn wrote:


Werner,
Basically my code has a Frame class in which I have a Panel (we'll
call it p) and I'm using wx.StaticText to display text. On my Mac the
wx.SWISS font family works great. So within my Frame class I have:
self.font = (16, wx.SWISS, wx.NORMAL, wx.NORMAL)
.
[some intervening code]
.
text = wx.StaticText(p, wx.ID_ANY, str)
text.SetFont(self.font)

Hi,

I believe, this might really be a font-issue; (after running your code; I get squares for the superscripts (win XP).

You probably have some newer OS version with a better font support for SWISS .

I’d also like to mention, that DejaVu is probably not present by default on windows installations, if the code is going to be distributed, this should be mentioned as requirement.

regards

vbr

moz-screenshot-16.png

···

2010/6/24 werner wbruhin@free.fr

On 24/06/2010 05:21, Cú Chulainn wrote:


Werner,
Basically my code has a Frame class in which I have a Panel (we'll
call it p) and I'm using wx.StaticText to display text. On my Mac the
wx.SWISS font family works great. So within my Frame class I have:
self.font = (16, wx.SWISS, wx.NORMAL, wx.NORMAL)
.
[some intervening code]
.
text = wx.StaticText(p, wx.ID_ANY, str)
text.SetFont(self.font)

wx.SWISS is the default font, at least on my machine.

I am still intriged why you need to do anything special, maybe you are
missing the first line shown in my code attached in the last message,
i.e. “# -- coding: utf-8 --#” which defines the encoding of the .py
source file.

I just do this:

    hSup = u'\u1d34'

    lSup = u'\u1D38'

    nSup = u'\u1D3A'

   

    lWithSup = u'r\xedgain\u1d38'

   

    self.textCtrl1.ChangeValue(('h: %s, l: %s, n: %s') % (hSup,

lSup, nSup))

    self.textCtrl2.ChangeValue(lWithSup)

And this is the result.

Werner

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Hi,
I believe, this might really be a font-issue; (after running your code; I
get squares for the superscripts (win XP).

The font/typography is a domain per se and is independent
of the platforms.

Due to historical development, you may have different font
files with the same file name (and the same font name) but
with different number of glyphs. (Short explanation, in
reality it is more complex than that).

To examine the list and the properties of the available
glyphs in a font file, Microsoft/Typography or Adobe are
proposing tools. The Unicode consortium proposes also one
(I do no recall the name, never tested).
I'm happy in using BabelMap (Windows).
http://www.babelstone.co.uk/Software/BabelMap.html

I'd also like to mention, that DejaVu is probably not present by default on
windows installations, if the code is going to be distributed, this should
be mentioned as requirement.

Correct. And this is an exemple of what I was explaining above. The
DejaVu
font family is no more the family proposed earlier and the next
release may
be different from the actual one.

jmf