-
-
Notifications
You must be signed in to change notification settings - Fork 385
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 too wide text rendering on buttons #8173
base: master
Are you sure you want to change the base?
Conversation
In German, for example both "Neustart" (Restart) and "Ablehnen" (Decline) don't fit into the button width.
Hi @zenseii , does this change correlate with your pull request? |
Hi, @a1exsh ! I'm a bit busy these days but will hopefully have time tomorrow to look more into your PR. Currently I have 2 PRs up that solve this problem in a different way in one way by making the actual button backgrounds expand to the necessary width automatically, and in the other PR I'm working on making the button font cram closer when the text width reaches a threshold. The function to automatically expand buttons is Later I need to look into making buttons expand in the vertical direction too for both larger buttons, so that they can increase in both width and height, and for pure horizontal buttons like in the hero screen and high score screen, though the latter is complex due to the non-uniform background of the high score screen. |
Makes sense. I'd also keep the code for truncation, just in case a translation is updated and doesn't fit once again, as a fallback to avoid the two-line rendering as on the screenshot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, all!
For the tall buttons (e.g. main menu) if the translated text is taller than the button it will be truncated to one line.
I suggest to add a TODO: Implement text truncating to the specified number of lines.
That's true. At the same time, the tall buttons have more space and less likely to trigger this. It's a fallback mainly for single-line buttons. |
I have not seen such translations, but theoretically it is possible, so I suggest adding only a TODO comment. |
The Polish translation has many such issues in the main menu. A typical issue in such areas are the two campaign buttons. |
My PR will be just one part of addressing this, but it's not the most important one. Here are the steps for how I currently envision addressing this:
The current problem with the New Game menu buttons is the width. In the future I want to have the possibility to automatically resize the height of buttons too, but in this specific case it should be fine because the current possibility of having 3 lines should already be enough. As for this PR, I believe it serves the purpose of a safeguard in case the translator doesn't check well enough the current button. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@a1exsh. I've tested how this currently works and as I said it could work as a final measure in case a text doesn't fit. However, I've since addressed all the buttons which currently had too wide texts in languages (that I could find), by updating them to the auto-adjustable buttons.
There is also an issue where this solution cuts text that is shown fully on other buttons, like Kampania here:
Still, as I mentioned before, these buttons will be auto-adjustable too. In fact I have that among my (several) goals for the next release.
One limitation with this PR's solution is that it naturally can't help with auto-adjustable buttons like the ones on the campaign screen:
To solve these my plan is as mentioned to make the letters go closer once the text's width exceeds a certain threshold. Of course, in the meantime it would have been better if a translator could make abbreviations for these strings, since ultimately they have to check if their translations fit within the UI in many other places too, like the creature info dialog.
In German, for example both "Neustart" (Restart) and "Ablehnen" (Decline) don't fit into the button width.
⇒
Ideally, the translation could be improved, but at least it looks less weird when it doesn't fit. :)
🎅 🎁