How to support Chinese character

I’m sorry I think it’s an old topic but the posts with similar topic is too long ago, and the methods do not work in my program. So I hope there is some more specific way to help me.

I need to display Chinese character on my GUI window, it is basic.
If better, hopefully the Chinese input can also be supported.

Thanks in advance

It should be supported.

I recommend making sure you have a Panda build with HarfBuzz support (I think all recent development builds should have it), which may be needed for more complex scripts to be rendered and kerned correctly. You can enable this by setting text-use-harfbuzz true in Config.prc. Also see this blog post.

You will also need to use a font with Hanzi characters, which I do not think the default font has. An example of a GUI font would be Noto CJK.

As for Chinese character input in DirectEntry, I think IME methods are supported but I am not personally familiar with it.

Thank you rgb,
I tried it yesterday, but some troubled problem is occurred and I don’t know why, please help me again.

whether I use loadPrcFileData("", “text-use-harfbuzz true”) or
harf = ConfigVariableBool(“text-use-harfbuzz”)
harf.setValue(1)

the error is occurred.
What’s wrong?

How did you set up your font and text? Make sure to use unicode strings in python (e.g. u"\u4f60\u597d").
@rdb as for the entry with IME, from a quick test this doesn’t seem to work on Windows at least for Japanese charakters input using the windows 10 IME.

Can you show a small sample program that I could run that reproduces that error?

I run the same program successfully on another computer, so it may be some misunderstanding. Thanks anyway!

2 posts were split to a new topic: DirectEntry does not work with Chinese IME