Why is TextHeight so far out?
BlitzMax Forums/BlitzMax Programming/Why is TextHeight so far out?
| ||
I've found that TextHeight is always way higher than the actual drawn height of text on-screen, even for the built in font that gets used when the current ImageFont is null (it reports a height of 16 even if you draw a full-stop/period). I've love an accurate TextHeight, but obviously it can't be changed now or it would break the alignment of many people games, but how about a new function called TextHeightAccurate or something? And yes, I'm making sure SetScale 1,1 is used. |
| ||
you could use a fonttext module and hope that is more accurate? |
| ||
It looks like the calculation was taken out and replaced with a return of just the font height.Function TextHeight( text$ ) Return gc.image_font.Height() Rem Local height=0 For Local n=0 Until text.length Local c=text[n]-image_font.BaseChar() If c<0 Or c>=image_font.CountGlyphs() Continue Local x,y,w,h image_font.Glyph(c).GetRect( x,y,w,h ) height=Max(height,h) Next Return height End Rem End Function |
| ||
Yowzer, I wonder when that was done? Perhaps it's already broken my old games if I was to recompile them? |
| ||
I think it's been like this since 1.21 or the like. This was modified very early. |
| ||
Not really sure when it was done, since I use my own bitmap font system. Now that I seen the change I do wonder why it was changed? |
| ||
Ah, OK if it's a really old mod then that's probably fine. I use bitmap fonts for my most recent games but not my early ones. Guess I should check them to see if anything is screwed, not sure what version BMax was when I started using it in summer 2006. |