Page 1 of 1

Load Custom Font

Posted: Mon Sep 23, 2019 4:03 am
by cloudstrifer
Hi, I need help with custom font.

Thank you!

Code: Select all

	u32 customFont = VDP_loadFont(&custom_font, DMA);		
	VDP_loadFontData(&customFont, custom_font.numTile, DMA);	
.res

Code: Select all

	TILESET custom_font "gfx/font.png" BEST
	PALETTE custom_pal "gfx/font.png"

Re: Load Custom Font

Posted: Mon Sep 23, 2019 7:59 am
by Stef
You just need to use one or the other:

.res

Code: Select all

IMAGE custom_font  "gfx/font.png" BEST
.c

Code: Select all

VDP_loadFont(custom_font.tileset, DMA);	
should be enough to get your custom font loaded (i used IMAGE resource but the tileset as you did is also ok).
If you need to set a specific palette then don't forget to load the palette as well (by default text use PAL0 but you can change it)

Re: Load Custom Font

Posted: Tue Sep 24, 2019 3:25 pm
by cloudstrifer
Stef, using IMAGE and DMA my font didn't work correctly, instead of showing 60, it showed 71. :shock:


With the code below it works.

c

Code: Select all

	VDP_loadFont(&custom_font, CPU);
res

Code: Select all

	TILESET custom_font "gfx/font.png" -1
Thank you!
Thank you again for SGDK 1.41! :D

Re: Load Custom Font

Posted: Tue Sep 24, 2019 4:34 pm
by Stef
Oh i guess it "optimized" the empty (space) character :lol:
You can disable IMAGE optimisation declaring it that way :

Code: Select all

IMAGE custom_font  "gfx/font.png" BEST NONE
But TILESET may be better in the end to avoid that issue ;)