Pygame 字体不一致
我正在与其他一些开发人员一起使用 python+pygame 开发一个程序,我们看到相同的字体呈现不同的效果。这是我们随游戏分发的免费字体。在我的机器上,这种特定字体的渲染速度比其他开发人员的机器上低 10 像素。
对于这是为什么?有什么想法吗?
I'm working on a program in python+pygame with some other developers, and we're seeing the same font rendered differently. It's a free font that we're distributing with the game. On my machine, this particular font is rendering 10px lower than on another developer's machine.
Any thoughts on why this is?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我遇到了同样的问题,但这是在使用不同版本的 pygame 东西(尤其是 truetype 库)时,尝试比较 pygame、sdl、sdl-ttf 和 freetype 库的版本。
I encountered the same problem but it was when using too different releases of the pygame stuff (especially the truetype library), try to compare the versions of pygame, sdl, sdl-ttf and the freetype library.
但是,当您进行原型设计和构建程序时,您是否从项目内的本地目录引用字体文件,或者您只是使用相同的字体,但“安装”在每台计算机上?
如果是这样,则可能是一台机器的字体版本略有不同。尝试仅使用项目中目录中的字体,看看是否有帮助。
否则,可能是一些疯狂的 ClearType / TrueType 设置或字体抗锯齿之类的。我不知道如何解决这个问题。也许尝试将其转换为不同的文件格式?
But whilst you are prototyping and building the program, are you referencing the font file from a local directory within the project, or are you just using the same font, but 'installed' on each machine?
If so, it could be that one machine has a slightly differing version of the font. Try and use the font just from a directory in the project and see if that helps.
Otherwise, it could be some crazy ClearType / TrueType settings or font anti-aliasing or something. I would have no idea how to fix that. Maybe try converting it to a different file format?
测试:将字体副本放置在与 python 脚本相同的文件夹中。
或者可能正在加载类似的字体。
To test: Place a copy of the font the same folder as a python script.
Or maybe similar font is being loaded.
Pygame 使用操作系统上安装的字体:也许您安装了或未安装一些不同的字体?如果是这样,那么它将默认使用与您预期不同的字体。
Pygame uses te installed fonts on your operating system: maybe you have some different fonts installed or not installed? If so then it will default to a different font than you expect.