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

Fix RichTextLabel character horizontal offset calculation #52752

Merged

Conversation

Listwon
Copy link
Contributor

@Listwon Listwon commented Sep 16, 2021

This PR is not relevant to master branch, because on master the x offset in RichTextLabel is properly treated as float (just like in Label code on 3.x branch).
Fixes #22580

Horizontal offsets were assigned to the integer variables while the actual type of value returned by get_char_size is float (and is properly handled in plain Label). We were losing data in cases where character sizes were not integer values.

@Listwon Listwon requested a review from a team as a code owner September 16, 2021 19:41
@Listwon
Copy link
Contributor Author

Listwon commented Sep 17, 2021

There is still one problem which I'm stuggling to solve, here you can see one character not being moved to the next line:
rich_text_label_issue2

MRP: render_text_bug.zip

@Listwon
Copy link
Contributor Author

Listwon commented Oct 4, 2021

The last problem I mentioned is not an issue connected directly with offsets, but simply with major differences how line/word wrapping is handled in 3.x RichTextLabel (it was reworked on master branch). So from my perspecrive this PR does its purpose - fixes the offsets so the characters are not tightened and unreadable on scaled viewports. Changing the wrapping code is the topic for another PR.

@akien-mga akien-mga merged commit 2b642d6 into godotengine:3.x Oct 4, 2021
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants