Using glyphs illustrated in "Designing for Playdate"

Hi,

I've just read the "Designing for Playdate" guide.

Inside I noticed the followings lines : "We provide glyphs for this in many of our fonts, mapped to the following characters: Ⓐ Ⓑ" and "By the way, we have also font characters for other Playdate buttons: :yellow_square::lock: :fishing_pole_and_fish::arrow_up: :arrow_right: :arrow_down: :arrow_left:".

How can we display the glyphs illustrated in the guide ? Is there a way to rely on the system font ? Roobert font provided in the SDK seems to not include all these glyphs they are displayed with the "question mark squared character".

Thanks for your help :slight_smile:

1 Like

You simply put those emoji characters in the text you want to draw:

import "CoreLibs/graphics"

function playdate.update()
	playdate.graphics.drawTextAligned("Emoji _Glyphs!_ 🟨⊙🔒🎣✛⬆️➡️⬇️⬅️", 200, 110, kTextAlignment.center)
end

screen

Files

Thanks for your help. My glyphs weren't displaying as I have replaced the default font with a custom one (Roobert).

1 Like

I was personally under the impression that when a character isn't present in a font, we replace it with the default font. If this isn't the case (and can't be made to be the case) I'll see about adding those characters to the other fonts we use!

2 Likes

I'm seeing the same behavior here. I replaced the system font, and i can't get the above glyphs to render... assuming that the character fallback thing is there.

Hi Scott,

To get the glyph back, reset the font to system font via getSystemFont before displaying them. Then reapply your font to display non glyph texts.

Aha! Gotcha. I ended up swapping them around since I don't need italic support in my text (btw, love the bold italic auto-font thing. really nifty!) so I did this:

local originalSystemFont = playdate.graphics.getSystemFont()
gfx.setFont( originalSystemFont, playdate.graphics.font.kVariantItalic )
gfx.setFont( "myFont" )

So now, i can use all of them, within my custom font by just wrapping them with the underscore.... "This is the b button icon: "

5 Likes

This sounds like an ingenious workaround, @BleuLlama

@neven can we move this topic to the bugs board?

1 Like

Great idea! I'm surely going to use that to display game-specific glyphs embedded in text, without requiring them to be hard-to-type Unicode.

(I don't quite get what's happening in your code, but I'm used to setFontFamily and that will do the trick I think.)

1 Like

Sure. That would work too! My code gets the system font, then sets that as as the default italic font. then i set the regular font to be myFont, which would have been loaded previously.

local originalSystemFont = playdate.graphics.getSystemFont()
gfx.setFont( originalSystemFont, playdate.graphics.font.kVariantItalic )
gfx.setFont( "myFont" )
1 Like