Repository navigation
Conversation
The state line of a tile ("Off", "开") ended 1.5 px above the tile's bottom edge while the badge above it started 12 px
below the top, so the text looked glued to the edge. The tile was 76 px tall and its parts took all of it: 12 (air) + 32
(badge) + 4.5 + 12 (title) + 3 + 11 (state) = 74.5.
The tile is 84 px tall now, which leaves the text about the same air under it as the badge has above it. The row pitch
grows with it (84 -> 92), so the slider card and the panel move down 16 px in total.
The tile's parts also moved into QT_* and qt_tile/qt_badge/qt_label/qt_state: the hit test in rects() and the painter had
the same numbers written out twice, and the geometry a test checks has to be the geometry that is drawn. paint() is
split into draw(dc, k) (the panel into a DC) and paint(hw, k) (BeginPaint, the double buffer) so the panel can be
rendered into a memory DC and measured.
Tests (cargo test -p topbar, 16 pass):
- quick_tiles_keep_air_under_the_text - the real panel, drawn by draw(), is read back pixel by pixel at 100, 125, 150,
175, 200 and 250 %: each tile's state line leaves 8-14 px under it (11 px in the test's language).
- every_languages_state_word_keeps_its_air - the state words of en, ru, ja, pt and zh in the tile's own font and rect;
Portuguese "Desligado", whose g descends lowest, keeps over 8 px as well.
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.
The state line of a quick-settings tile ("Off", "开") ended 1.5 px above the tile's bottom edge, while the badge in the same tile started 12 px below the top: the text looked glued to the edge.
The tile was 76 px tall and its parts took all of it — 12 px of air, the 32 px badge, 4.5 px, the 12 px title, 3 px, the 11 px state line = 74.5. There was no room left to fix this by nudging the text, so the tile is 84 px tall now (row pitch 84 → 92, which moves the slider card and the bottom edge down 16 px in total). The text is 26 px deep and the tile now leaves it the same air under it as the badge has above it.
Measured (logical px, air between the lowest ink of the state line and the tile's bottom edge; the badge keeps its 12 px above):
Portuguese is the tightest because of the descender in "Desligado"; the live-captions tile, which has no state line, goes from 14 to 22.
The Bluetooth tile at 2× (before left, after right):
All five languages, rendered with the panel's own code at 200 %:
Also in here. The tile's parts moved into
QT_*andqt_tile/qt_badge/qt_label/qt_state:rects()(the hit test) and the painter had the same numbers written out twice, and the geometry a test checks has to be the geometry that is drawn.paint()is split intodraw(dc, k)(the panel into a DC) andpaint(hw, k)(BeginPaint, the double buffer), so a test can render the real panel and measure it. While doing that I noticedtopbar --preview quick|wifinever setSCALE, so the preview drew its flyout at 100 % on a HiDPI screen; it reads the DPI now like the bar does.Tests (
cargo test -p topbar, 16 pass):quick_tiles_keep_air_under_the_text— the panel is drawn bydraw()into a memory DC at 100, 125, 150, 175, 200 and 250 %, read back pixel by pixel, and every tile's state line has to leave it 8–14 px (11 px in the test's language). With the old 76 px tile this fails with "ends 3 px above the tile's edge".every_languages_state_word_keeps_its_air— the state words of en, ru, ja, pt and zh drawn with the tile's own font into the tile's own rect, the same 8–14 px rule.