Hi, I am using the Chinese font (BiauKai) in my online experiment, but I found that “BiauKai” only works for Mac. For windows, “DFKai-SB” should be named.
Does anyone know how to add multiple font names?
Thank you so much!
Hi, I am using the Chinese font (BiauKai) in my online experiment, but I found that “BiauKai” only works for Mac. For windows, “DFKai-SB” should be named.
Does anyone know how to add multiple font names?
Thank you so much!
The font name can be a variable set in code at the beginning of the experiment based on the OS from How can I detect participant's OS?
@wakecarter Thank you for your reply.
Do you mean I should first detect the OS? I’ve read the post you referred, but I have no idea how it works. Could you explain more and give me an example of the font code?
Actually, I think you can use expInfo[‘OS’] as the OS.
Values I’ve seen for this variable are: iPhone, iPad, MacIntel, Linux aarch64, Linux armv8l, and Win32.
To set the font you could use:
if expInfo['OS'] == 'Win32':
useFont = 'DFKai-SB'
else:
useFont = 'BiauKai'
and then put the font as $useFont
Additionally if you have a text component that isn’t working) add:
text_1.setFont(useFont)
where text_1 is the name of the text component
Thank you very much @wakecarter ! The codes work well!
But I found that BiauKai and DFKai-SB are not the best Chinese fonts in mac and windows, both of them have problems. Few characters in BiauKai are not correctly shown, and the top of some DFKai-SB characters are trimmed. I finally use STKaiti, this style can be presented both in Mac and win.