Slick Forums

BUG: AngelCodeFont.getWidth(" ") returns incorrect value
Page 1 of 1

Author:  davedes [ Mon Jan 30, 2012 1:49 am ]
Post subject:  BUG: AngelCodeFont.getWidth(" ") returns incorrect value

AngelCodeFont.getWidth adds the width of the last character instead of its xadvance; if the last character is a space (or other character with no width), the resulting text width will be incorrect.
         if (i < n - 1) {
            width += charDef.xadvance;
         } else {
            width += charDef.width;

You can test with the default font:
        Font f = container.getDefaultFont();
        System.out.println(f.getWidth("i") < f.getWidth("i "));

Author:  Shuken [ Tue Jan 29, 2013 8:14 pm ]
Post subject:  Re: BUG: AngelCodeFont.getWidth(" ") returns incorrect value

Ok, I realize that Im not using the latest version of Slick. I have, yes, the latest source, but I cant get the latest Slick.jar file. I know that there must be some non-magic way to compile the entire proyect and get the simple Slick.jar but Im not sure how to do it.

In order to use Slick, I usually simply add the Slick.jar file into a "lib" folder of my project game. But I cant get an updated Slick.jar file.

Please, I really need a map? Im kinda lost with the dev branch and all that, just looking for the latest version of the Slick.jar file...

Thank you

Author:  davedes [ Thu Jan 31, 2013 7:57 am ]
Post subject:  Re: BUG: AngelCodeFont.getWidth(" ") returns incorrect value

See the global forum announcement for details.

The latest Slick.jar file is on the website. You'll also need the latest LWJGL binaries and natives from their website. If that JAR isn't recent enough to include the fix, then you are stuck building from development branch -- which really should only take about 10 minutes if you follow the guide.

Author:  nwakerrMl [ Fri Jun 05, 2015 9:24 am ]
Post subject:  BUG AngelCodeFont getWidth" " returns incorrect value

First you need to check Mouse.getEventButton >= 0 and only then check the Mouse.getEventButtonState.

And always upgrade to the latest LWJGL version.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group