Fix: make efficient use of available display area #1729
Merged
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 calculation of the text baselines, using
getAscent()
in favor ofgetMaxCharHeight()
, which includes ascent and descent. This moves the first text up and allows to insert margin between the lines until the display area is fully utilized.On large displays, if the small diagram is selected, keep the first line rather low to avoid collision with the diagram y-axis label. in this mode, there is still more space between the text lines as before, allowing for improved readability.
I always thought that the display was quite crammed, especially the last line. While implementing hoylabs#658 I noticed that something was off with the baselines and that we could do better without compromising, since the previous implementation wastes lines mainly on the bottom of the display, also on the top if no diagram is drawn. The y of today nearly touches the l of total.
I found that especially the baseline (
_lineOffsets
) for the first line was off. The reason is thatgetMaxCharHeight()
returns a value greater than the font's ascent, i.e., it includes the font's descent. The value which should be used isgetAscent()
. The next line's baseline is then advanced by the previous line's descent, making sure that they will not collide.The placement is such that even when using the screensaver with the small diagram, the solar power will not collide with the diagram y-axis label.
Using this code
I made sure that the change works for small displays as well.