Font doesn't seem to be using the .fnt file

I'm using: Roobert-24-Medium-table-36-36.png Roobert-24-Medium.fnt files from the Resources/Fonts folder of the SDK but no matter how I change the .fnt file it doesn't seem to affect the font on screen. Do I also need to load the .fnt file somehow (as well as the .png)?

I was trying to adjust the spacing of "11" like it shows in the docs but it doesn't seem to be working.

Thanks

I'm doing exactly what you're showing above, and my font shows up just like it should, it just doesn't seem to take the .fnt file into account. I wanted to have more space between the one's in the number eleven just like they show in the docs (Inside Playdate - under text) but no matter what number I put in there to add more space it doesn't work.

I have tried extreme numbers and nothing happens, even the first two listings in the .fnt file don't seem to be taken into account (tracking and space) it just seems like the SDK on compiling is not using it, and I even checked the naming of the 2 files (the .png vs the .fnt) seems like a bug.

OK, I even went and tweeked the spacing in the .fnt file in the 2020 game example and it didn't change anything, hmm :thinking:

I've used that too, works fine.

look in the resource/fonts folder - notice that each font consists of a .png and a matching .fnt file, if you look at the .fnt file with a text editor you will see two columns - the first entry or two start with space and sometimes also tracking then the rest of the file is the character on the left and a number for the width of that character, then farther down the list is special info for custom spacing, etc.

search the Inside Playdate.html for this [Sample .fnt file excerp] to see what I'm talking about, the third example down shows what I'm talking about, it's being ignored. you should be able to put some custom spacing in there on a character by character basis. Unless I'm reading that wrong.

Now you got it, doesn't seem to be working

See if you can tweak some numbers in one of the fonts to see if it has any affect

I think there's a compiler bug there--if you make a change to the fnt file and recompile the compiler doesn't realize it needs to update the compiled font because its timestamp is newer than the png file. If you delete the pdx and rebuild from scratch I believe you'll see the kerning and spacing changes.

Thanks Dave, I'll try that and let you know if it works.

That did it, thanks :blush:

it is old thread, but I am doing exactly this and I am not able to load the Roobert-24-Medium.

the error I get is: main.lua:17: attempt to index a nil value (global 'myRoobertFontInstance')

I don't understand, apologize! Here is the code, and yet I am not able to change the font!

import "CoreLibs/graphics"
local gfx <const> = playdate.graphics
myRoobertFontInstance = gfx.font.new("Roobert-24-Medium")
gfx.setFont(myRoobertFontInstance)

function playdate.update()
gfx.drawText("test", 10, 10)
end

Thank you.

Thank you, Matt! It works. The font it was in the wrong category!