Fixed it, thanks! I changed it to allow for more flexibility when using a custom font. Now there is a string, "glyphs", which stores the chars in the font in order, and the function now checks it to return a number.
Also, thanks for reminding me of ranges, I completely forgot about them