Problem with other languages support

Hello everyone.

I have some problem with my text rendering and DirectGUI input: it seems, that my language is not supported, but it was stated on URL:GUI — Panda3D Manual that Panda3D supports English, Asian and other languages.

Rendering Text

Panda3D includes support for easily rendering dynamic text onscreen or in the 3-d world. It supports full use of the Unicode character set, so it can easily render international languages (including Asian languages, when used with an appropriate font).

However, for me it seems, that Panda3D doesn’t support (Eastern) European languages (nor Ukrainian, Polish or Russian language). Possibly, I need to update, but for now it doesn’t work for me: I have errors
:text(warning): No definition in for character U+0442

Please, help if possible. Thanks.

Greetings, and welcome to the forum! I hope that you find your time here to be positive! :slight_smile:

As to your question: Have you checked that the font that you’re using includes the desired characters?

I seem to recall seeing that sort of error when using a font that lacked characters that I was trying to show.

(If you’re not setting a font, then you’re presumably using the default font. In that case, I’d suggest looking for a font that has the characters that you want, and setting that as the font for your DirectGUI elements.)

1 Like

Hello, Thaumaturge, and thank you so much!

This was the exact cause of the problem, I used the default font and it doesn’t contain so much symbols.
Somewhere on the internet, I downloaded usual Arial font type with my own language and it worked.

The solution was:

  1. Downloading arial.ttf from the internet. And put this file into my work’s folder with the python file.
  2. Type in venv:
    egg-mkfont -o arial.egg arial.ttf

This created an arial.egg file:
Resizing arial_1.png to 512 256
Generating new arial_1.png
Writing arial_1.png
Writing arial.egg

  1. Then, with the obtained arial.egg file, I used this in my loop function ( def __init__(self): ):
    Right after this:
   ShowBase.__init__(self)
   simplepbr.init()
   font = self.loader.loadFont('arial.ttf')

I typed:

    # add some text and Text placement
    bk_text = "This is an input text, ПРИВЕТ"
    textObject = OnscreenText(text=bk_text, pos=(0.36, -0.95), scale=0.07,
                              fg=(1, 0.5, 0.5, 1), align=TextNode.ACenter,
                              mayChange=1)
    textObject.setFont(font) # to set font with my language support

    # callback function to set text for DirectEntry
    def setText(textEntered):
        textObject.setText(textEntered)
    # clear the text for DirectEntry
    def clearText():
        entry.enterText('')
    # add text entry for DirectEntry
    entry = DirectEntry(text="", entryFont=font, scale=.05, command=setText,
                        initialText="Type Something, Привет", numLines=2, focus=1, focusInCommand=clearText) # entryFont parameter helps to use Arial in DirectEntry

And this worked. So, no more squares.
Thank you very much, kind person.

1 Like