Better vertical centering of text in its box

Decide baseline vertical position according to font metrics, instead
of the hardcoded 0.7 (in textwidget, which made the text a little
bit up in its box), and 0.75 (in toggleswitch, which made the text a
little bit down in its box). This usually gives a value around 0.72
or 0.73 with our ui fonts, which looks about right.
ReaderFooter: add bottom padding, now that our text goes a few pixels lower
This commit is contained in:
poire-z
2017-10-08 17:50:05 +02:00
committed by Frans de Jonge
parent ea033431aa
commit 2fc8076139
3 changed files with 21 additions and 3 deletions

View File

@@ -116,6 +116,7 @@ local ReaderFooter = WidgetContainer:extend{
height = Screen:scaleBySize(DMINIBAR_CONTAINER_HEIGHT),
horizontal_margin = Screen:scaleBySize(10),
text_left_margin = Screen:scaleBySize(10),
bottom_padding = Screen:scaleBySize(1),
settings = {},
-- added to expose them to unit tests
textGeneratorMap = footerTextGeneratorMap,
@@ -186,6 +187,7 @@ function ReaderFooter:init()
background = Blitbuffer.COLOR_WHITE,
bordersize = 0,
padding = 0,
padding_bottom = self.bottom_padding,
}
self.footer_container = BottomContainer:new{
dimen = Geom:new{ w = 0, h = self.height*2 },