For the past few day, i have been developing a multiplayer shooter. Obviously, it needs some kind of gui. I wanted various fonts and font styles to be used so i tried to load a font and show some text with it.
However, it threw the following error at me:
OSError: Could not load font file: SatellaRegular.ttf
Amazing.
After a couple hours of scowering the internet i found absolutely nothing, so i decided to post here.
Below is a minimum reproducible example, and the font in question (though i dont think it will be of much help
The two files are in the same directory. Minimum reproducible example:
from direct.showbase.ShowBase import ShowBase
from direct.gui.DirectGui import *
from direct.gui.OnscreenText import OnscreenText
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
fontloader = loader.loadFont('SatellaRegular.ttf')
app = MyApp()
app.run()
Still same problem, i believe that it is a problem with my installation
Hereâs the full error log:
Traceback (most recent call last):
File âC:\Users\lazar\Desktop\Panda3d.pyâ, line 58, in
app = MyApp()
File âC:\Users\lazar\Desktop\Panda3d.pyâ, line 20, in init
fontloader = loader.loadFont(âSatellaRegular-ZVVaz.ttfâ)
File âC:\Users\lazar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\direct\showbase\Loader.pyâ, line 638, in loadFont
raise IOError(message)
OSError: Could not load font file: SatellaRegular-ZVVaz.ttf
One last thing to try before I see if I can manage to install a 32-bit build of Python somewhere and see if I can replicate it. Try loading it via the full path, like so:
I really do recommend using a 64-bit build. We only have the 32-bit build available for extremely old computers, and since there are so few people using it, there may be bugs that could go unnoticed.