View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0001284 | Spring engine | General | public | 2009-01-17 22:40 | 2009-05-29 00:43 | ||||
Reporter | Evil4Zerggin | ||||||||
Assigned To | jK | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | 0.77b5 | ||||||||
Target Version | Fixed in Version | 0.79.0.0 | |||||||
Summary | 0001284: gl.GetTextWidth Returns Wrong Result | ||||||||
Description | I think this started happening before 0.78, but gl.GetTextWidth doesn't return the correct result.(At one point it worked correctly.) So far as I can tell, the issue is: const float width = font->CalcTextWidth(text.c_str()) / fontHeight; lua_pushnumber(L, width); Why is the result being divided by fontHeight? fontHeight is not used in gl.Text's justification: if (right) { xj -= fontScale * font->CalcTextWidth(text.c_str()); } else if (center) { xj -= fontScale * font->CalcTextWidth(text.c_str()) * 0.5f; } which produces the correct visual result. | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
|
Evil4Zerggin (reporter) 2009-01-19 06:59 |
After some testing, it appears that this isn't the problem. Not sure what is, though. |
MelTraX (reporter) 2009-01-19 10:29 |
I can confirm this btw. Code that worked for IceUI a few releases back was untouched and doesn't work anymore. |
Evil4Zerggin (reporter) 2009-01-23 18:14 |
As far as I can tell it has something to do with view sizes; for now I'm using local function GetRealTextWidth(text) return glGetTextWidth(text) * vsx / vsy * 1.33333333 end |
quantum (reporter) 2009-01-31 05:22 |
It seems that gl.Text produces text that is streched with the aspect ratio, probably to make it fit in the vanilla spring gui buttons. It looks like gl.Scale(viewSizeY/viewSizeX * 3/4, 1, 1) compensates for it and causes gl.GetTextWidth to be correct, but it also makes the text hard to read due to more resizing. Example with text size 12: http://img264.imageshack.us/img264/1207/ss20090131051920ef8.png |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2009-01-17 22:40 | Evil4Zerggin | New Issue | |
2009-01-19 06:59 | Evil4Zerggin | Note Added: 0003216 | |
2009-01-19 10:29 | MelTraX | Note Added: 0003220 | |
2009-01-23 18:14 | Evil4Zerggin | Note Added: 0003235 | |
2009-01-31 05:22 | quantum | Note Added: 0003240 | |
2009-05-29 00:43 | jK | Status | new => resolved |
2009-05-29 00:43 | jK | Fixed in Version | => 0.79.0.0 |
2009-05-29 00:43 | jK | Resolution | open => fixed |
2009-05-29 00:43 | jK | Assigned To | => jK |