Get the size of an individual glyph / char

Does anyone know of a way to get the size of an individual glyph / char? (I’m making a roguelike using letters to represent creatures, and want to apply a dynamically sized background to them rather than needing to tailor the background size each time to reflect different sized letters).

I’ve tried using Font’s “get_char_size” method, which seems to give the width properly, but (as stated in the docs), it returns the height of the font (seemingly the size of the Label) rather than the height of the specific glyph/char.

I’ve also tried using TextServer’s “font_get_glyph_size” method, but I can’t seem to get the font’s RID for the first parameter (I’ve tried using “get_RID()” on the reference to the font and to the font’s resource file, but both seem to return RID(0).

Any advice would be appreciated!

1 Like

Here’s an answer for a similar question I want a tight bounding box around rendered text. Labels are not tight enough - #2 by mrcdk

1 Like

Thanks! That showed me what to do.