Angelfont: TextHeight() tweak.
Monkey Forums/Monkey Programming/Angelfont: TextHeight() tweak.
| ||
Tweaked to take account of each character's y offset, which is probably what interests you more than solely the height of each character.Method TextHeight:Int(txt:String) Local h:Int = 0 For Local i:= 0 Until txt.Length Local asc:Int = txt[i] Local ac:Char = chars[asc] If (ac.height+ac.yOffset > h) h = ac.height+ac.yOffset Next Return h End |
| ||
Very useful, I needed that to draw a box around the text ! Thank you very much... |