Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upTextWidget: small refactoring, better handle max_width #5503
Conversation
This was referenced Oct 20, 2019
Merged
This comment has been minimized.
This comment has been minimized.
@poire-z |
Lots of code was doing some renderText calls to get the size of some text string, and truncate it to some width if needed, with or without an added ellipsis, before instantiating a TextWidget with that tweaked text string. This adds some properties and methods to TextWidget so all that can be done by it. It makes the caller codes simpler, as they don't need to use RenderText directly. (Additionally, if we ever go at using Harfbuzz for text rendering, we'll just have to update or replace textwidget.lua without the need to update any higher level code.) KeyValuePage: fix some subtle size and alignment issues.
This comment has been minimized.
This comment has been minimized.
(Just rebased to current master.) |
No real comments. |
Co-Authored-By: Frans de Jonge <fransdejonge@gmail.com>
Frenzie
added a commit
that referenced
this pull request
Oct 27, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
poire-z commentedOct 18, 2019
Lots of code was doing some renderText calls to get the size of some text string, and truncate it to some width if needed, with or without an added ellipsis, before instantiating a TextWidget with that tweaked text string.
This PR fixes/adds some properties and methods to TextWidget so all that can be done by it. It makes the caller codes simpler, as they don't need to use RenderText directly.
(Additionally, if we ever go at using Harfbuzz for text rendering, we'll just have to update or replace textwidget.lua without the need to update any higher level code.)
RenderText: removed the space added by truncateTextByWidth after the ellipsis, as it doesn't feel needed, and break right alignment of the ellipsis with other texts.
KeyValuePage: fix some subtle size and alignment issues.
NumberPickerWidget: fix font size (provided font size was not used)
Menu.lua: I did not touch the part of the code that #5496 affects, so these 2 PRs should be mergeable in any order. If needed, I'll update what can be from #5496 to follow the spirit of this PR.
Pinging @robert00s for info, for your future widgets :)