raylibtech / rtools

rtools feedback and issues
17 stars 1 forks source link

[rTexPacker] Generate single PNG fonts for Raylib #8

Closed edubart closed 2 years ago

edubart commented 4 years ago

I am trying to use rTexPacker to load fonts with Raylib using LoadFontFromImage function, but I always get crashes in that function. Is it possible to generate font atlases that are loadable by Raylib with rTexPacker? If yes then how? If no what other program could do it? In this use case I don't want to use TTFs.

raysan5 commented 4 years ago

@edubart Actually, at this moment I think it's not possible with currently published rTexPacker, I was working in some modifications to allow that...

The problem with LoadFontFromImage() is that it requires a very specific PNG image format, to scan it properly, (magenta background, same separation between characters, chars ordered in a rows and starting with SPACE...). Exactly like XNA SpriteFonts:

62f6E

The best way to do that is loading the .PNG in font.texture and then manually load the exported .xml/.json/.rtpa text files characters information into font.chars.

Next rTexPacker will allow an XNA style PNG SpriteFont, also preparing a raylib example to load that.

raysan5 commented 2 years ago

Implemented.