如何解决用 pygame 渲染 freetype 字体
我是 pygame 的新手,所以我试图使用 pygame 打印出一个简单的标题页。
我的原始代码如下:
import pygame
import pygame.freetype
pygame.init()
pygame.display.set_caption('hello world')
screen = pygame.display.set_mode((800,600),32)
title_font = pygame.font.Font(".../Montserrat-BlackItalic.ttf",24)
title = title_font.render('sup',False,(250,250,250))
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.quit:
running = False
screen.fill((25,25,25))
screen.blit(title,(0,0))
pygame.display.update()
pygame.quit()
它有效。但是,字体超级模糊。我读到使用 freetype 字体将有助于减少模糊,但是当我尝试时,我收到了这个错误:
File ".../untitled1.py",line 22,in <module>
screen.blit(title,0))
TypeError: argument 1 must be pygame.Surface,not tuple
我只更改了代码以查找字体类型,使其看起来像这样:
title_font = pygame.freetype.Font(".../Montserrat-BlackItalic.ttf",24)
我现在如何减少模糊的字体?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。