gui: fix device id last character invisibly clipped in deep status bar - #342
Open
wmelonw wants to merge 2 commits into
Open
gui: fix device id last character invisibly clipped in deep status bar#342wmelonw wants to merge 2 commits into
wmelonw wants to merge 2 commits into
Conversation
On Jade Plus (HOME_SCREEN_DEEP_STATUS_BAR, 320x170) the status bar name
box is 35% of the padded width = 110px, but the widest possible device
id ('Jade ' + six wide hex glyphs, eg. 'Jade AAAAAA') is 114px in
UBUNTU16. The overflowing last character wraps onto a second line that
is clipped and never visible, so such units appear to have a 5-char id.
Widen the split to 63/37 (=117px) so the worst-case id always fits.
Verified under qemu (BOARD_TYPE_QEMU_LARGER, same 320x170 layout) with
a forced all-'A' id: before this change the title renders as
'Jade AAAAA'; with it the full 'Jade AAAAAA' is shown.
render_text() prints non-scrolling text with wrap enabled. When a string is slightly wider than a box that is only one font-line tall, the overflow wraps onto a second line that is clipped and never visible - the text appears silently truncated with no indication. When the padded box is less than two font-heights tall, truncate the string to the characters that actually fit instead of wrapping. This is a general guard for any single-line text node (the deep status bar title was one such case).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #341
On Jade Plus (
HOME_SCREEN_DEEP_STATUS_BAR, 320x170) the status bar device name can silently lose its last character: the name box is 35% of the padded status bar width = 110px, while the widest possible id (Jade+ six wide hex glyphs, e.g.Jade AAAAAA) is 114px inUBUNTU16_FONT.render_text()prints with wrap enabled, so the overflowing character wraps onto a second line that is clipped and never visible. Whether a given unit is affected depends on its id's glyph widths (Jade ABCDEF= 109px fits; ids with more of the wider A/C/D glyphs do not).Two commits:
render_text(): when the padded box is less than two font-heights tall, truncate to the characters that fit instead of wrapping into clipped space. (Original string restored after printing.)Verification (QEMU)
Built with
Dockerfile.qemu+--webdisplay-larger(BOARD_TYPE_QEMU_LARGER, same 320x170 layout/code path as Jade Plus), with the device id temporarily forced to the worst-caseAAAAAA(test hack not included in this PR):Jade AAAAA— 5 of 6 characters (bug reproduced)Jade AAAAAA— all 6 characters, logo/status icons unaffectedGlyph-width math (UBUNTU16, effective advance incl. spacing): A/C/D = 12px, B = 11px, E/F = 10px, digits = 10px;
Jadeprefix = 42px.