Closed k355l3r-5yndr0m3 closed 4 months ago
I think this is happening because the font is not loaded properly. ./font.ttf is taken relative to where you call the executable from (e.g. if you are in project-directory
and use cabal run
, then it will look for project-directory/font.ttf
). If you do changeDirectory =<< getApplicationDirectory
after initWindow
, it will search for files relative to the executable path.
In a real project you should use the data-files
field in the cabal file to list any assets you will use, then access them using the instructions here. This is probably the most convenient solution.
No, I tried this first using data-files
then when I did not get anything on screen I tried absolute path, still nothing.
Take a look at the custom-font-text example and compare it to your code. Can you share your cabal file and project structure?
This issue is specific to loadFontEx
. If I change to use loadFont
then it render just fine, although I do not have fine control over the font.
My cabal file and project structure is irrelevant as using an absolute path still have the same result. If I change the path to something that does not exist, raylib will print an error and loadFontEx
will return the default font which is visible.
Fixed in 5.5.0.0, use font <- managed window $ loadFontEx "font.ttf" 28 Nothing
. Reopen if there are any problems.
font loaded by loadFontEx is not visible on screen.