-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrapper method loadFontEx
does not handle loading the default character set properly
#14
Comments
Thanks for finding this. Looks like another shit thing about Raylib API, no way to specify in the signature that the pointer is nullable yet behaviour requires it to be. Yes only solution I can think of is an if statement in the wrapper. Would need to check if there are any other such functions that require one too. |
However the if statement will add overhead. The intention is that the majority of the wrapper should be able to be optimized away by a smart compiler, but I don't think think the if statement would be. (In theory function call could be inlined and an if statement that is always false could be removed, but I'd be surprised if java does this. We could investigate.) A nicer solution would be to overload the function and have one that doesn't have the codepoints parameter at all, but that would probably have to be written manually, which is bit annoying for an auto-generated binding. |
Have implemented the if statement fix because it was easiest. |
Released https://github.com/electronstudio/jaylib-ffm/releases/tag/v5.5.0-2 with the fix |
The
loadFontEx
method does not properly handle when thecodepoints
argument is null.As per the raylib documentation (emphasis added):
In other words,
codepoints
should benull
when we want to load the default character set, but under the hood, theloadFontEx
wrapper function does not handle the case whencodepoints
isnull
.The workaround is to not use the wrapper function and instead do something like the following (Kotlin code, but I'm sure you get the point):
It seems like the
loadFontEx
wrapper method needs to be tweaked so it can handle the case wherecodepoints
isnull
and substitute inMemorySegment.NULL
.The text was updated successfully, but these errors were encountered: