Need help calculating dimensions for correct font size with a bitmap font

Hi!

  1. What do you want to achieve? I’m working on a custom font system, and I need to get the font size dimensions right for each glyph.

  2. What is the issue? I don’t know how to calculate the size of each glyph correctly for each font size. I need the size to match the font sizes that Roblox has in textlabels.

  3. What solutions have you tried so far? I tried the following things

--==Random numbers
local sizeMultiplier = (textsize/10)*.35 --This one looked okay, but it made 
--fonts look very weird at small sizes.

--==Division
local xScaled = (glyphwidth/glyphheight)*textsize
local yScaled = (glyphheight/glyphheight)*textsize -- Looks really weird.
--I tried to set the Y value to the text size,  and have the X value scale appropriately, 
--but uppercase characters are the same size as lowercase characters

If you need more info, I will be glad to send it over.
Thanks!