pygame-ce
pygame-ce copied to clipboard
Font constructor now raises an error when it fails to load a valid font file
Sample piece of code:
import pygame
pygame.init()
win = pygame.Window()
screen = win.get_surface()
font = pygame.font.Font("MODERN.fnt", 20)
text = font.render("Hello World!", True, "white")
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
screen.fill("black")
screen.blit(text, (0, 0))
win.flip()
Sample font file (same file is added in the examples dir in this pull): MODERN.zip Source for the sample file