-
-
Notifications
You must be signed in to change notification settings - Fork 437
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
[Renderers/Raylib] Odin measure text function for Raylib doesn't support variable font size #308
Comments
Hello, thanks for opening this issue. Just for me to understand a little better, are you loading your raylib font (with LoadFont or LoadFontEx) at a different font size to the size you're using to render it? |
Hi. Yes, I'm loading it with fontSize = 24, but rendering the title at size 20, and the subtitle at size 14. I guess this means the proper way to do it is to load a separate font for every size I'd need. While certainly doable once I have a more defined style, in these prototyping phases, it's easier for me to just change the size. Plus, what's the problem with using raylib's internal font measuring, if we're using raylib for rendering anyway? If it gives better results... then we might as well. |
@tralph3 Yep you're totally right, it's a problem that our shim text measurement function doesn't support rendering at a different size from the loaded one. Will get that fixed up 🙂 |
Ah... I wasn't aware of that. Well thankfully my program isn't too text intensive, but I'll take it into account. Thanks! |
I thought the rewritten MeasureTextEx function was because MeasureTextEx only supports null terminated strings. For my zig bindings I just rewrote MeasureTextEx directly. https://github.com/johan0A/clay-zig-bindings/blob/c26ef9d4b6b591caeb1750869abcdc50446b33c1/examples/clay-official-website/src/raylib_render_clay.zig#L195 |
I found the measure text function provided in the example for the raylib renderer in the odin bindings to give wrong results. Here's how it looks like:
Luckily, raylib has its own function to measure text, and it works perfectly.
This is the revised function:
And this is the result:
The text was updated successfully, but these errors were encountered: