largeText = pygame.font.Font('digifaw.ttf', 450)
字体大小为450,适合在分辨率为1366x768
的全屏显示中显示文本。如何更改字体大小,使其与其他显示分辨率兼容? 我查看了font的Pydocs文档,但没有找到与自动缩放相关的内容。
更新:下面是代码片段
def text_objects(text, font):
textSurface = font.render(text, True, black)
return textSurface, textSurface.get_rect()
def message_display(text):
largeText = pygame.font.Font('digifaw.ttf',450)
TextSurf, TextRect = text_objects(text, largeText)
TextRect.center = ((display_width/2),(display_height/2))
gameDisplay.blit(TextSurf, TextRect)
pygame.display.update()
time.sleep(1)