Gugu72
Gugu72

Reputation: 2218

Use an imported font on PyGame

I want to add a font imported from google to Pygame. I used that code but when I run script, the window immediately closes :

pygame.init()
pygame.font.init()

myfont = pygame.font.Font("resources/fonts/Mansalva.zip", 30)

The path to my .zip font is also good.

Upvotes: 1

Views: 276

Answers (1)

Rabbid76
Rabbid76

Reputation: 211186

.zip is an archive. You've to unzip it and to load a single (e.g. .ttf) file from the archive. The filename which is passed to pygame.font.Font is assumed to be a font file. A zip-archive file can't be processed an causes an exception.

Upvotes: 1

Related Questions