【发布时间】:2019-11-13 07:07:40
【问题描述】:
largeText = pygame.font.Font('digifaw.ttf',450)
字号为450,适合分辨率为1366x768的全屏显示文字。如何更改字体大小以使其与其他显示分辨率兼容?我查找了 font 的 pydocs,但找不到与自动缩放相关的任何内容。
更新:这是代码的 sn-p
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)
【问题讨论】: