separating lua code and get units in sp

This commit also uses the font data already loaded, without reparsing the font.
Merge pull request #1 from eroux/master

separating lua code and get units in sp