Skip to content
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

[rtext] MeasureTextEx() does not report correct height when using multi line string #3745

Closed
karl-zylinski opened this issue Jan 20, 2024 · 2 comments

Comments

@karl-zylinski
Copy link
Contributor

karl-zylinski commented Jan 20, 2024

Issue description

When sending in a multi line string to MeasureTextEx it does not report the correct height. The text drawn by DrawTextPro will often be taller.

Environment

Windows 10, GL3 (I guess), GTX 2080 Ti

Issue Screenshot

Drawn multi line text with a dark background color, note that the dark background is less tall than the text:

image

Code Example

Vector2 ts = MeasureTextEx(some_font, "hi\nho\nha", 20, 0)

text_r := Rectangle {
    0,0,
    ts.x,
    ts.y,
}

DrawRectangleRec(text_r, BLACK)
DrawTextPro(some_font, "hi\nho\nha", {0, 0}, {}, 0, 20, 0, WHITE)

I hand translated the code above from Odin to C, so I'm not sure it works out of the box. Also I use a custom font, I'm afraid I don't have time to setup test with non-custom font right.

@raysan5 raysan5 changed the title [raylib] MeasureTextEx does not report correct height when using multi line string [rtext] MeasureTextEx() does not report correct height when using multi line string Jan 23, 2024
@raysan5
Copy link
Owner

raysan5 commented Jan 28, 2024

@karl-zylinski Excuse the late answer, I will try to review it asap. The line-break spacing support was added quite recently, are you using latest raylib version from GitHub master branch?

@raysan5
Copy link
Owner

raysan5 commented Feb 1, 2024

@karl-zylinski This issue should be fixed with merged PR.

@raysan5 raysan5 closed this as completed Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants