implmented font code that can get width and height accurately