IMyTextSurface.MeasureStringInPixels probably doesn't work on dedicated servers
I got some reports that my script is auto-sizing panels wrong and giving them a font size of infinity. I can't replicate this bug in single player. I was told this was only happening on dedicated servers and it could not be reproduced in single player. Auto-size = setting font size to perfectly fit text onto panel
My auto-sizing function divides the panel size by text size (width and height separated) and applies the smallest number as the font size. I bet the MeasureStringInPixels is returning (0, 0) and causing division by zero. My script doesn't auto-size blank panels so that's not the problem.
My script used to only work with Monospace. I had to keep variables for monospace character sizes. I would calculate a value similar to what the MeasureStringInPixels function does and use the same math to auto-size the panel. It worked 100%, I used it on dedicated servers and was never told it didn't work.
When I saw the new functions I tossed out the variables for font sizes and panel sizes then switched to your functions as it would allow any font to be auto-sizable. It works for me in single player on every LCD panel. I'm told it doesn't work on dedicated servers. Whenever I get onto a dedicated server, or start one up to test it, I will confirm my theory that MeasureStringInPixels is returning (0, 0) as the size of the text in pixels.
On a side note, it looks like IMyTextSurface.SurfaceSize and IMyTextSurface.TextureSize return the same values. While most panels work perfectly, I have to adjust the values for: corner panels, cockpit panels, and programmable block panels. I either have to note which panel I'm resizing or only make compatibility with the first provided IMyTextSurface. Could you make IMyTextSurface.TextureSize return the size of the texture the drawing surface is rendered to, like it says it is supposed to do?
[Text Size: {X:0 Y:0}, Texture Size: {X:512 Y:512}, Surface Size: {X:512 Y:512}, Blank: False]
Proved my theory. Finally found a creative dedicated server that allowed scripts and didn't require you to be a scripter or what ever the title was.
I created a debug that as you can see above returned text size as (0, 0). The text in question was:
[Text Size: {X:0 Y:0}, Texture Size: {X:512 Y:512}, Surface Size: {X:512 Y:512}, Blank: False]
Proved my theory. Finally found a creative dedicated server that allowed scripts and didn't require you to be a scripter or what ever the title was.
I created a debug that as you can see above returned text size as (0, 0). The text in question was:
Hello, Engineer!
Thank you for your feedback! Your topic has been added between considered issues.
Please keep voting for the issue as it will help us to identify the most serious bugs.
We really appreciate your patience.
Kind Regards
Keen Software House: QA Department
Hello, Engineer!
Thank you for your feedback! Your topic has been added between considered issues.
Please keep voting for the issue as it will help us to identify the most serious bugs.
We really appreciate your patience.
Kind Regards
Keen Software House: QA Department
Replies have been locked on this page!