Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Strange error for unicode chars with certain text sizes

Author
Message
Increase
7
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 22nd Aug 2018 10:46 Edited at: 22nd Aug 2018 10:48
This works well for the text size 30 ->



But if it is executed with text size 24, it crashes ->



If I try to find out where it crashes, by



..it returns different unicode-codes e.g. (9557) ; dependent on text sizes which delivers an error.

But if i create a single text without array with the textsizes that delivered an error, it works ->




So some unicode chars seem to have to a problem with certain text sizes in arrays, while they work with other text sizes.

The same unicode chars seem to have no problem with any text size, if it is a single text.


The program either hangs itself without getting to the do - loop , or it simply ends without reporting any error OR in rare cases reported an exceptional error but without any error code.
Increase
7
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 22nd Aug 2018 22:03
Solved as far as that it seems to work, as long as the Textsizes are the Power of 2 -> surprising as truetype fonts are presented in the 12,18,24 format by microsoft , but i take it - makes some sense when it comes to symmetry
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 23rd Aug 2018 14:24
Unfortunately I can't get it to crash on my machine. By default the text is using bitmap fonts, but you mention TTF, so I assume there is a call to UseNewDefaultFonts(1) somewhere that isn't included in your snippet? However even if I add that I can't get it to crash. The only thing I can think of at this point is perhaps a memory issue, but in that case I would expect it to crash with higher text sizes rather than lower ones.
Increase
7
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 23rd Aug 2018 15:45


I narrowed it down to setwindowsize ( m_d_w, m_d_h, 1 ) : If it is fullscreen, it crashes, if i start it with setwindowsize ( m_d_w , m_d_h , 0 ) it works.

Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 23rd Aug 2018 18:13
Thanks for the sample code, I managed to replicate it and track it down, fixed for the next version. It was caused by the way AppGameKit builds up the font image when it encounters characters of different heights, sometimes all the tall characters would be on one row of the image, other times they would be spread across multiple rows, causing AppGameKit to underestimate the size of the image needed. It's pure luck that it works at all.

Login to post a reply

Server time is: 2024-11-23 17:51:35
Your offset time is: 2024-11-23 17:51:35