| Reference | Downloads | Github

Button component,Chinese characters appear as white squares

Hi, everyone
OS : Win10
PsychoPy version: 2021.2.3
Standard Standalone? (y/n) :yes
What are you trying to achieve?:
What did you try to make it work?:
I try to change the botton text according to some condition. But it seemed fail to show Chinese characters. Even when I changed the font.

Thanks for any feedback

What font are you using & what characters are you trying to display?

Thanks for your reply!
I tried the default setting “Arvo”, as well as “Open Sans”, which was the default setting for text component and supports Chinese characters display.
I wanted to display “接受” and “拒绝”, representing “accept” and “refuse”.

Open Sans doesn’t support Chinese characters, instead I’d recommend either Noto Sans SC for simplified Chinese or Noto Sans TC for traditional Chinese. You can install these locally (Simplified, Traditional) or you can just refer to them by name and PsychoPy will fetch them directly from Google Fonts when you next run your experiment.

Thanks for you insightful suggestion!

Although Open Sans should support Chinese characters as I used this font in text component. And it is strange that this mistake disappeared in online version(in pavlovia).

According to your suggestion, I download the Noto Sans CJK SC font. And it worked in the offline version! However, a new mistake happened as the character didnot show up in the center of the “box” even after I changed the anchor setting from “center” to “top-center”.

Anchor defines where the box is relative to the point specified by pos, so doesn’t affect where the text is relative to the box. It looks like the problem is with font size & padding - try making the letter height and padding smaller.