Pygame 显示空白框而不是正确的字符
我正在使用 PyGame 绘制一些印地语以及印度或马拉雅拉姆语中使用的其他语言(等ថ្ងៃ
)。我检查了像 Twitter 这样支持多种语言的网站,使用 Leelawadee UI
字体来显示文本,所以我将其添加到脚本中,但出现了空格,例如 这个。
#!/usr/bin/python
import pygame
pygame.init()
font_size = 1024
font = pygame.font.SysFont('LeelawUI', font_size)
text = font.render(text, True, (27, 149, 224), background)
pygame.image.save(text, output_path)
我尝试了另一种字体,并得到了一个不同的空格框,例如 this
另外,还有一个库可以处理这种语言中错误标记的重音或元音吗?当我输入类似 കേരളബ്ലാസ്റസ്റ്റേഴ്സ്
时,程序似乎没有正确理解这是一个词而不是一个离散的字母。
提前致谢。
I'm using PyGame to draw some Hindi and other languages used in India or Malayalam (etc. ថ្ងៃ
). I checked websites like Twitter which supports multiple languages, uses the Leelawadee UI
font to display text, so I added it to the script but got blank space like this.
#!/usr/bin/python
import pygame
pygame.init()
font_size = 1024
font = pygame.font.SysFont('LeelawUI', font_size)
text = font.render(text, True, (27, 149, 224), background)
pygame.image.save(text, output_path)
I've tried another font and got a different space box like this
Also, ts there a library that can handle the mis-marked stress or vowels in this language? When I type-in word like കേരളബ്ലാസ്റ്റേഴ്സ്
, it seems the program doesn't understand correctly that this is a word and not a discrete letter.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议使用 Unifont 作为字体。我测试了它,
.ttf
文件应该可以工作。您只需将其安装到您的系统上即可。它的外观如下:
I suggest using Unifont as font. I tested it, the
.ttf
file should work. You just need to install it on your system, and it's done.Here's how it looks: