Can't display the full Chinese characters on Mac

121 views
Skip to first unread message

杨金骉

unread,
Jan 12, 2017, 4:45:30 AM1/12/17
to pyglet-users
System: MacOSX Sierra
Pyglet: 1.2.4
Python: 3.5 64bit

The English letters seem fine. However, Chinese characters can only display with the width as English letters, so the right part of a character will be masked by the next character.


How could I get the right display?


xinming

unread,
Jan 12, 2017, 11:20:32 PM1/12/17
to pyglet...@googlegroups.com
I don't know the reason, but I am sure this phenomenon would happen ^ v ^
--
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users...@googlegroups.com.
To post to this group, send email to pyglet...@googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.


 

Benjamin Moran

unread,
Jan 13, 2017, 9:15:52 PM1/13/17
to pyglet-users
Can you try the development version of pyglet, from Bitbucket, and see how it looks? There were some changes in the text module, but I'm bit sure if they will affect this.

If it still does not work correctly, can you provide some example code?

杨金骉

unread,
Jan 14, 2017, 2:33:29 AM1/14/17
to pyglet...@googlegroups.com
Hi Benjamin,
The pyglet page on Bitbucket said "Currently no development release available", so how should I do? Run  pip install --upgrade https://bitbucket.org/pyglet/pyglet/get/tip.zip ?


Best regards,
Jin-Biao Yang(杨金骉)

-----------------------------------------------------------------------------
Cell Phone: +86 13162513165

Research Associate,
NYU-ECNU Institute of Brain and Cognitive Science,
NYU Shanghai,
3663 North Zhongshan Road, Shanghai,China 200062

2017-01-14 10:15 GMT+08:00 Benjamin Moran <benmo...@gmail.com>:
Can you try the development version of pyglet, from Bitbucket, and see how it looks?  There were some changes in the text module, but I'm bit sure if they will affect this.

If it still does not work correctly, can you provide some example code?

--
You received this message because you are subscribed to a topic in the Google Groups "pyglet-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyglet-users/l1TY7laEs8Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyglet-users+unsubscribe@googlegroups.com.

Benjamin Moran

unread,
Jan 14, 2017, 3:11:22 AM1/14/17
to pyglet-users
Hi Jin-Biao,

Actually, development is happening in the default branch on Bitbucket. Your "pip install" example should work. Or, you can just clone/download the repo, and copy the pyglet folder into your project.

By the way, which font are you using?



On Saturday, January 14, 2017 at 4:33:29 PM UTC+9, 杨金骉 wrote:
Hi Benjamin,
The pyglet page on Bitbucket said "Currently no development release available", so how should I do? Run  pip install --upgrade https://bitbucket.org/pyglet/pyglet/get/tip.zip ?


Best regards,
Jin-Biao Yang(杨金骉)

-----------------------------------------------------------------------------
Cell Phone: +86 13162513165

Research Associate,
NYU-ECNU Institute of Brain and Cognitive Science,
NYU Shanghai,
3663 North Zhongshan Road, Shanghai,China 200062

2017-01-14 10:15 GMT+08:00 Benjamin Moran <benmo...@gmail.com>:
Can you try the development version of pyglet, from Bitbucket, and see how it looks?  There were some changes in the text module, but I'm bit sure if they will affect this.

If it still does not work correctly, can you provide some example code?

--
You received this message because you are subscribed to a topic in the Google Groups "pyglet-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyglet-users/l1TY7laEs8Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyglet-users...@googlegroups.com.

杨金骉

unread,
Jan 14, 2017, 9:06:06 AM1/14/17
to pyglet...@googlegroups.com
I had copied "simhei.ttf", which is a Chinese font named "黑体", in the working path of my code, and I called it by "pyglet.font.add_file('simhei.ttf')" and "pyglet.text.Label(‘XXX’, font_name=‘simhei’)".

However, above all are unnecessary, because I found the root of my issue...

The "simhei.ttf" is copied from my Windows' font. Although it's official, it cannot work under MacOSX. Once I replace Simhei with other TTF fonts, the displaying effect seems perfect.
And perhaps the default font of MacOSX cannot display Chinese well in Pyglet, because I used "font_name=‘xxx’" in pyglet.text.Label, but the strange displaying remained.

BTW, https://bitbucket.org/pyglet/pyglet/get/tip.zip may not fit the pyglet on python3, since I got "No module named 'future'".




Best regards,
Jin-Biao Yang(杨金骉)

-----------------------------------------------------------------------------
Cell Phone: +86 13162513165

Research Associate,
NYU-ECNU Institute of Brain and Cognitive Science,
NYU Shanghai,
3663 North Zhongshan Road, Shanghai,China 200062

To unsubscribe from this group and all its topics, send an email to pyglet-users+unsubscribe@googlegroups.com.

Benjamin Moran

unread,
Jan 16, 2017, 12:07:53 AM1/16/17
to pyglet-users
Thanks for the information. I'm glad that you found a solution.

I don't know enough about fonts to say where the problem is. Maybe the fonts do not provide correct information to be rendered properly, or pyglet needs to be improved to handle non-ascii fonts better.

Do you mind sharing your not-working font? I'd like to try it on my Linux machine.

杨金骉

unread,
Jan 16, 2017, 12:55:44 AM1/16/17
to pyglet...@googlegroups.com
Hi, attached is that font. You can try the string "test 测试" on it.​



Best regards,
Jin-Biao Yang(杨金骉)

-----------------------------------------------------------------------------
Cell Phone: +86 13162513165

Research Associate,
NYU-ECNU Institute of Brain and Cognitive Science,
NYU Shanghai,
3663 North Zhongshan Road, Shanghai,China 200062

Benjamin Moran

unread,
Jan 16, 2017, 6:04:18 AM1/16/17
to pyglet-users
I tried it on my Linux machine, and it does not work either. The unicode characters are blank (the empty box symbol, like you see when there is no valid character).

I also noticed that many of my system fonts have the same issue with pyglet. I think we can confirm that pyglet needs some improvement in this area. I wonder what the difference between working, and non-working fonts is?

Anyway, thanks for sharing your font.
-Ben






On Monday, January 16, 2017 at 2:55:44 PM UTC+9, 杨金骉 wrote:
Hi, attached is that font. You can try the string "test 测试" on it.​



Best regards,
Jin-Biao Yang(杨金骉)

-----------------------------------------------------------------------------
Cell Phone: +86 13162513165

Research Associate,
NYU-ECNU Institute of Brain and Cognitive Science,
NYU Shanghai,
3663 North Zhongshan Road, Shanghai,China 200062

2017-01-16 13:07 GMT+08:00 Benjamin Moran <benmo...@gmail.com>:
Thanks for the information. I'm glad that you found a solution.

I don't know enough about fonts to say where the problem is. Maybe the fonts do not provide correct information to be rendered properly, or pyglet needs to be improved to handle non-ascii fonts better.

Do you mind sharing your not-working font? I'd like to try it on my Linux machine.

--
You received this message because you are subscribed to a topic in the Google Groups "pyglet-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyglet-users/l1TY7laEs8Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyglet-users...@googlegroups.com.

杨金骉

unread,
Jan 16, 2017, 7:08:47 AM1/16/17
to pyglet...@googlegroups.com
Here is one of the working fonts (on Mac and Win). It's name is "Li Xuke", and it's not a common font, and I downloaded it just for testing. Hope you can find the differences!

btw, I found the Chinese Characters were unsupported in the "fontname" of "pyglet.text.Label", I got:
  File "D:\Anaconda3\lib\site-packages\pyglet\compat.py", line 75, in asbytes
    return bytes(ord(c) for c in s)
ValueError: bytes must be in range(0, 256)


Best regards,
Jin-Biao Yang(杨金骉)

-----------------------------------------------------------------------------
Cell Phone: +86 13162513165

Research Associate,
NYU-ECNU Institute of Brain and Cognitive Science,
NYU Shanghai,
3663 North Zhongshan Road, Shanghai,China 200062

To unsubscribe from this group and all its topics, send an email to pyglet-users+unsubscribe@googlegroups.com.
Li-Xuke.ttf

Benjamin Moran

unread,
Jan 16, 2017, 7:09:12 PM1/16/17
to pyglet-users
Great! This should be enough data to find a solution.

Thanks!
Reply all
Reply to author
Forward
0 new messages