DirectEntry produces strange characters on _, <, >, et

I have some code that uses a DirectEntry widget like this:

        self.command_box = DirectEntry(pos=(-1.2,-0.95,-0.95),
                text_fg=(0.282, 0.725, 0.850,1),
                frameColor=(0.631, 0.219, 0.247,0.25),
                suppressKeys=1, initialText="enter text and hit return",
                enableEdit=0,scale=0.07, focus=0, focusInCommand=disable_keys,
                focusOutCommand=enable_keys, focusInExtraArgs=[self],
                focusOutExtraArgs=[self], command=accept_message,
                extraArgs=[self], entryFont=self.font,  width=15, numLines=1)

When I try to enter characters such as _ (underscore), it comes out as a flying . character (not sure what the actual character is). < turns into an upside-down exclamation point, and > turns into an upside-down question mark. { turns into a dash of some sort, and } turns into some sort of double-quote. Most other characters are fine.

Is this a bug in DirectEntry or am I doing something wrong?

Not sure, but could it be the font you’re using?

It sure does sound like a font issue. What if you render these characters using, say, an OnscreenText and this font?

David

Hm, that does seem to be the case. Why cmss12, one of panda’s shipped fonts, does that, I don’t know.

Falling back to the default font makes it work as I’d expect.

I had exactly the same issue, perhaps these font files need to be regenerated somehow?

cmss12, cmr12, and cmtt12 come from TeX and Multifont, which date back to before the Unicode character set was standardized. So probably they just follow a nonstandard convention for some of the characters.

We could, of course, replace these three with a different set of three free fonts. For instance, we replaced cmss12 with Perspective Sans as the default font that’s compiled into Panda. We could do similarly with these font model files. Any suggestions for replacing the serif and proportional fonts?

David

Too bad Consolas is a Microsoft font, my favourite monospace by far.
Anonymous Pro is also a quite good monospaced font.
It is released under Open Font License which, while I am no license expert, I believe makes it free.