Is DirectEntry support Asian languages ?

hi ! Everybody :smiley:
I had some problem.
I could used Asian language in TextNode or Onscreentext. But I couldn’t used DirectEntry for Asian languages.I doubted about DirectEntry support Asian languages ?
I changed entryFont in DirectEntry.I used appropriate font but it wasn’t support.
I tried used TextEncoder but it wasn’t work again. :frowning:

Help me , please
Thank you

Works fine for me. You might need to set:

text-encoding utf8

in your Config.prc file. Then when you call entry.get(), it should return a Python unicode string if the user has entered non-ASCII characters.

You can also see this thread, which is somewhat out of date (we have added support for Python unicode strings since this thread was written, so while the code in the thread still works, you don’t need to mess with the Python default encoding any more).
https://discourse.panda3d.org/viewtopic.php?t=555

David

thank you, David

TextNode and OnscreenText is work. It can used for Thai language with micross.ttf .

but DirectEntry is not work . while I type in thai languang but it isn’t show thai Language

I need create textbox for fill name in Thai language . I use DirectEntry in English Language. It isn’t problem.

thaifont = loader.loadFont('micross.ttf')

self.myCalendar = TextNode('myCalendar')
self.myCalendar.setFont(thaifont)
self.myCalendar.setEncoding(TextNode.EUtf8)
self.myCalendarNodePath = aspect2d.attachNewNode(self.myCalendar)
self.myCalendarNodePath.setScale(0.07) 
self.myCalendarNodePath.setPos(0.55,0,0.9)

self.myCalendar.setText(codecs.utf_8_encode(u"เวลา ")[0]

above , it is code. I used thai language in Textnode is work but I apply to
DirectEntry isn’t work

Thank you very much.

i basically had the same problem as you did. from what i remember. panda has no problem with unicode input in direct entry. on my linux machine it worked out of the box once i set right text encoding. on windows things seems a little bit more difficult but still doable. i didnt try it but drwr seems to know about :slight_smile:

Perhaps you haven’t set the font correctly on your DirectEntry? You have to set entryFont = thaiFont in the constructor. Or you can just put:

text-default-font micross.ttf

in your Config.prc to make your Thai font the default font for all DirectGui objects.

David

:confused:
drwr

i have problem too

i already put

text-encoding utf8
text-default-font micross.ttf

in my Config.prc in my folder name ‘etc’ at Panda3D1.4.2

i see the text have change style
but i can’t write in directEntry (another font)

why? what have i miss?
please help :frowning:

I don’t know why the text-default-font variable isn’t working for you; it seems to work for me. But another way to do the same thing is with code like this:

thaifont = loader.loadFont('micross.ttf')
entry = DirectEntry(entryFont = thaifont, ...)

So that you explicitly specify the font at the time you create the DirectEntry. (The … stands for the other constructor parameters you would pass to the DirectEntry.)

David