我不久前安装了“Raleway”,但似乎无法使其适用于 pygame。我的程序似乎只能显示常规版本的字体,但不能显示粗体、斜体等。这是我所拥有的:
import pygame
pygame.init()
pygame.font.init()
myfont = pygame.font.SysFont('Raleway Bold', 72)
screen = pygame.display.set_mode((850, 600))
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
screen.fill((8, 8, 8))
textsurface = myfont.render('WELCOME', False, (205, 92, 92))
screen.blit(textsurface,(250,200))
这是字体系列下可用的字体: Raleway
最佳答案
您的字体实际上只是命名为Raleway
,要加载粗体版本,您必须 set the bold
flag :
myfont = pygame.font.SysFont('Raleway', 72, bold=True, italic=False)
关于python - 如何在 pygame 上使用字体系列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52032825/