pygame 2.1.2 available fonts
xxxxxxxxxx
# pygame 2.1.2 available fonts
['arial', 'arialblack', 'bahnschrift', 'calibri', 'cambria', 'cambriamath', 'candara', 'comicsansms', 'consolas', 'constantia', 'corbel', 'couriernew', 'ebrima', 'franklingothicmedium', 'gabriola', 'gadugi', 'georgia', 'impact', 'inkfree', 'javanesetext', 'leelawadeeui', 'leelawadeeuisemilight', 'lucidaconsole', 'lucidasans', 'malgungothic', 'malgungothicsemilight', 'microsofthimalaya', 'microsoftjhenghei', 'microsoftjhengheiui', 'microsoftnewtailue', 'microsoftphagspa', 'microsoftsansserif', 'microsofttaile', 'microsoftyahei', 'microsoftyaheiui', 'microsoftyibaiti', 'mingliuextb', 'pmingliuextb', 'mingliuhkscsextb', 'mongolianbaiti', 'msgothic', 'msuigothic', 'mspgothic', 'mvboli', 'myanmartext', 'nirmalaui', 'nirmalauisemilight', 'palatinolinotype', 'segoemdl2assets', 'segoeprint', 'segoescript', 'segoeui', 'segoeuiblack', 'segoeuiemoji', 'segoeuihistoric', 'segoeuisemibold', 'segoeuisemilight', 'segoeuisymbol', 'simsun', 'nsimsun', 'simsunextb', 'sitkasmall', 'sitkatext', 'sitkasubheading', 'sitkaheading', 'sitkadisplay', 'sitkabanner', 'sylfaen', 'symbol', 'tahoma', 'timesnewroman', 'trebuchetms', 'verdana', 'webdings', 'wingdings', 'yugothic', 'yugothicuisemibold', 'yugothicui', 'yugothicmedium', 'yugothicuiregular', 'yugothicregular', 'yugothicuisemilight', 'holomdl2assets', 'century', 'leelawadee', 'microsoftuighur', 'wingdings2', 'wingdings3', 'tempussansitc', 'pristina', 'papyrus', 'mistral', 'lucidahandwriting', 'kristenitc', 'juiceitc', 'frenchscript', 'freestylescript', 'bradleyhanditc', 'msoutlook', 'bookantiqua', 'garamond', 'monotypecorsiva', 'centurygothic', 'algerian', 'baskervilleoldface', 'bauhaus93', 'bell', 'berlinsansfb', 'bernardcondensed', 'bodonipostercompressed', 'britannic', 'broadway', 'brushscript', 'californianfb', 'centaur', 'chiller', 'colonna', 'cooperblack', 'footlight', 'harlowsolid', 'harrington', 'hightowertext', 'jokerman', 'kunstlerscript', 'lucidabright', 'lucidacalligraphy', 'lucidafaxregular', 'magneto', 'maturascriptcapitals', 'modernno20', 'niagaraengraved', 'niagarasolid', 'oldenglishtext', 'onyx', 'parchment', 'playbill', 'poorrichard', 'ravie', 'informalroman', 'showcardgothic', 'snapitc', 'stencil', 'vinerhanditc', 'vivaldi', 'vladimirscript', 'widelatin', 'twcen', 'twcencondensed', 'script', 'rockwellextra', 'rockwellcondensed', 'rockwell', 'rage', 'perpetuatitling', 'perpetua', 'palacescript', 'ocraextended', 'maiandragd', 'lucidasanstypewriterregular', 'lucidasansregular', 'imprintshadow', 'haettenschweiler', 'goudystout', 'goudyoldstyle', 'gloucesterextracondensed', 'gillsansultracondensed', 'gillsansultra', 'gillsanscondensed', 'gillsans', 'gillsansextcondensed', 'gigi', 'franklingothicmediumcond', 'franklingothicheavy', 'franklingothicdemicond', 'franklingothicdemi', 'franklingothicbook', 'forte', 'felixtitling', 'erasmediumitc', 'erasitc', 'erasdemiitc', 'engravers', 'elephant', 'edwardianscriptitc', 'curlz', 'copperplategothic', 'centuryschoolbook', 'castellar', 'calisto', 'bookmanoldstyle', 'bodonicondensed', 'bodoniblack', 'bodoni', 'blackadderitc', 'arialrounded', 'agencyfb', 'bookshelfsymbol7', 'msreferencesansserif', 'msreferencespecialty', 'berlinsansfbdemi', 'lucidafax', 'twcencondensedextra', 'lucidasanstypewriter', 'lucidasanstypewriteroblique', 'lucidasansroman', 'sasmonospace', 'cumberlandamt', 'arialsymbolitalique', 'albanyamt', 'gulim', 'timesnewromansymbolitalique', 'csonggb18030clighthwl', 'arialsymbolgras', 'msmincho', 'csonggb18030clight', 'mingliu', 'arialms', 'thorndaleamt', 'myinghei18030cmediumhwl', 'timesnewromansymbolgrasitalique', 'timesnewromansymbolgras', 'timesnewromanuni', 'myinghei18030cmedium', 'arialsymbolgrasitalique', 'heit', 'monotypesorts', 'timesnewromansymbol', 'batang', 'arialsymbol', 'extra', 'arialmonospacedforsap', 'sapdingsnormal', 'sapiconsnormal', 'sapguiicons', 'sapguibelizeicons', 'kootenay', 'lindsey', 'miramonte', 'pericles', 'pescadero', 'andy', 'jingjing', 'moire', 'moireextrabold', 'motorwerk', 'newsgothic', 'quartzms', 'segoekeycaps', 'segoeuimono', 'wascosans']
xxxxxxxxxx
font = pygame.font.SysFont(None, 24)
img = font.render('hello', True, BLUE)
screen.blit(img, (20, 20))
xxxxxxxxxx
import pygame
pygame.init()
# creating a new font using a ttf file
font = pygame.font.Font('font_path', 69)
text_surf = font.render('Hello world!', True, 'Black')
text_rect = text_surf.get_rect(center=(420, 150))
screen.blit(text_surf, text_rect)
xxxxxxxxxx
#You need the font, if you are getting "font not initialiized"
#then do "pygame.init()" after importing modules
#example:
import pygame
pygame.init()
game_display = pygame.display.set_mode((800, 800))
def writeText(string, coordx, coordy, fontSize):
#set the font to write with
font = pygame.font.Font('freesansbold.ttf', fontSize)
#(0, 0, 0) is black, to make black text
text = font.render(string, True, (255, 255, 255))
#get the rect of the text
textRect = text.get_rect()
#set the position of the text
textRect.center = (coordx, coordy)
#add text to window
game_display.blit(text, textRect)
#update window
pygame.display.update()
text = ("sub 2 zonellobster250 for python stuff")
writeText((text), 400, 400, 20)