Hi all, first time posting
width, height = gfx.getTextSize(names[pos], myFontInstance)
There is something I don't understand. Width and Height doesn't match what I expect.
I drew a rectagle with width and height from getTextSize to cover the text. You can see in the image that the output values are higher than the text size. Why the 'extra' red space?
I tested this with 'Roobert-24-Medium' font and also with "Asheville Ayu" one.
Thanks in advance
I'm pretty sure that the 'bottom' extra space is there for descenders... the 'stick-y down' parts of the letters.
Try "Dqpter" and see what you get .
As for the space on the right, no idea.
Good catch, thanks
Now up and down spacing looks the same.
Still I don't understand why left spacing looks like 0 and right spacing looks that big.
It depends on how the font has been drawn. This one seems to have those empty lines above and below.
So you should think of the dimensions as representing the bounding box of the font cells rather than the drawn contents.
Try loading the font into Caps or Tophat to see.
For the width...
It seems to be measuring System font. Did you do SetFontFamily?
Thanks matt, your comment help me track the problem.
It ended up being a problem in my code that I still don't understand but it is fixed
I guess is scope related.
It worked after moving playdate.graphics.setFont(myFontInstance) inside the function that contains the getTextSize line mentioned in the first post. In other words, it is like setFont didn't set the new font globally. Maybe I am missing something.
Thanks for all your help guys!