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

avoid leading spaces in text_rectangle_bounds #2746

Merged
merged 1 commit into from
Oct 11, 2022
Merged

avoid leading spaces in text_rectangle_bounds #2746

merged 1 commit into from
Oct 11, 2022

Conversation

SzieberthAdam
Copy link
Contributor

Hello! I copied the DrawTextBoxed() code into my project and noticed this glitch. Wrapped spaces are currently moved into the start of the next line. Hence this PR. Cheers!

@@ -263,6 +263,6 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
}
}

textOffsetX += glyphWidth;
if ((textOffsetX != 0) || (codepoint != ' ')) textOffsetX += glyphWidth; // avoid leading spaces
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I understand the improvement, (codepoint == ' ') glyph width must be considered when calculating textOffsetX.

@SzieberthAdam
Copy link
Contributor Author

Sorry for not writing it properly. Just shrink the box slowly:
raylib-example-pr

@raysan5 raysan5 merged commit 4cca234 into raysan5:master Oct 11, 2022
@raysan5
Copy link
Owner

raysan5 commented Oct 11, 2022

@SzieberthAdam Thanks for the details! Now I understand it better the issue! :)

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

Successfully merging this pull request may close these issues.

2 participants