I am trying to load a .woff formatted font file into my pygame. I have seen other posts talking about this issue, but their answers do not help answer my question. I tried using this:
fontObj = py.font.Font('brandon_blk-webfont.woff', 16)
textSurfaceObj = fontObj.render(self.fact, True, black, None)
textRectObj = textSurfaceObj.get_rect()
textRectObj.center = (x * 1.5, y * 1.5)
gameDisplay.blit(textSurfaceObj, textRectObj)
Here is my error:
Traceback (most recent call last):
File "C:\Users\Sruthi\Desktop\Python\Pygame\Memorization Game\main.py", line 111, in <module>
gameLoop()
File "C:\Users\Sruthi\Desktop\Python\Pygame\Memorization Game\main.py", line 108, in gameLoop
create_button(mouse, 50, 50)
File "C:\Users\Sruthi\Desktop\Python\Pygame\Memorization Game\main.py", line 84, in create_button
fontObj = py.font.Font('Memorization Game/brandon_blk-webfont.woff', 16)
OSError: unable to read font file 'Memorization Game/brandon_blk-webfont.woff'
I have placed this font file in my current python file directory as you can see in this picture:
Shows that the font files are in the same directory
Also I know the font file isn't corrupted as I have seen a problem can be.