How to change text size (bigger)

,

Hi! I want to understand how to change the size of a texte, to make it bigger. I read the doc but i don't understand how to. I want to use the font system.

Thanks!

My code:

playdate.graphics.drawText("My text", 10,10)

You have to use a different (bigger) font.

The relevant section of the docs: Inside Playdate: Fonts

There are fonts you can copy into your project directory and call out, they're located in '..\PlaydateSDK\resources\Fonts'.

thanks, i read this section but i don't understand how to use a different font. Have you got a link to a tuto or github examples?

Here you go (also see attached):

local gfx = playdate.graphics

gfx.setColor(gfx.kColorWhite)

ash14 = playdate.graphics.font.new("fonts/Asheville-Sans-14-Light")
ash24 = playdate.graphics.font.new("fonts/Asheville-Sans-24-Light")

function playdate.update()
    gfx.fillRect(0, 0, 400, 240)
    gfx.setImageDrawMode(gfx.kDrawModeNXOR)

    gfx.setFont(ash14)
    gfx.drawText("This is Asheville-Sans-14-Light", 5, 5)

    gfx.setFont(ash24)
    gfx.drawText("This is Asheville-Sans-24-Light", 5, 30)

    ash14:drawText("This is Asheville-Sans-14-Light", 5, 65)

    ash24:drawText("This is Asheville-Sans-24-Light", 5, 90)
end

FontExample.pdx.zip (16.5 KB)
FontExample.zip (48.2 KB)

The .pdx you unzip somewhere and then load in the simulator.

The 'FontExample.zip' you unzip somewhere and that shows you the project directory structure.

5 Likes

Awesome! Thank you for the files!!