Font class python pygame code example

Example 1: pygame fonts

# On this version of windows 10 the pygame fonts available are listed below

arial
arialblack
bahnschrift
calibri
cambriacambriamath
cambria
candara
comicsansms
consolas
constantia
corbel
couriernew
ebrima
franklingothicmedium
gabriola
gadugi
georgia
impact
inkfree
javanesetext
leelawadeeui
leelawadeeuisemilight
lucidaconsole
lucidasans
malgungothic
malgungothicsemilight
microsofthimalaya
microsoftjhengheimicrosoftjhengheiui
microsoftjhengheimicrosoftjhengheiuibold
microsoftjhengheimicrosoftjhengheiuilight
microsoftnewtailue
microsoftphagspa
microsoftsansserif
microsofttaile
microsoftyaheimicrosoftyaheiui
microsoftyaheimicrosoftyaheiuibold
microsoftyaheimicrosoftyaheiuilight
microsoftyibaiti
mingliuextbpmingliuextbmingliuhkscsextb
mongolianbaiti
msgothicmsuigothicmspgothic
mvboli
myanmartext
nirmalaui
nirmalauisemilight
palatinolinotype
segoemdl2assets
segoeprint
segoescript
segoeui
segoeuiblack
segoeuiemoji
segoeuihistoric
segoeuisemibold
segoeuisemilight
segoeuisymbol
simsunnsimsun
simsunextb
sitkasmallsitkatextsitkasubheadingsitkaheadingsitkadisplaysitkabanner
sitkasmallsitkatextboldsitkasubheadingboldsitkaheadingboldsitkadisplayboldsitkabannerbold
sitkasmallsitkatextbolditalicsitkasubheadingbolditalicsitkaheadingbolditalicsitkadisplaybolditalicsitkabannerbolditalic
sitkasmallsitkatextitalicsitkasubheadingitalicsitkaheadingitalicsitkadisplayitalicsitkabanneritalic
sylfaen
symbol
tahoma
timesnewroman
trebuchetms
verdana
webdings
wingdings
yugothicyugothicuisemiboldyugothicuibold
yugothicyugothicuilight
yugothicmediumyugothicuiregular
yugothicregularyugothicuisemilight
holomdl2assets
bookantiqua
bookmanoldstyle
bookshelfsymbol7
century
dubai
dubaimedium
dubairegular
garamond
centurygothic
leelawadee
microsoftuighur
monotypecorsiva
extra
msreferencesansserif
msreferencespecialty
wingdings2
wingdings3

Example 2: how to write a font in pygame

font = pygame.font.SysFont(None, 24)
img = font.render('hello', True, BLUE)
screen.blit(img, (20, 20))