VirtualKeyboard: scale icons to fit font height (#4069)

The 4 keys that use images could be too big or too small
depending on screen size and DPI. They are now scaled in
all cases to fit font height.
pull/4058/merge
poire-z 6 years ago committed by GitHub
parent 7eb2a32c5e
commit 665cb37308
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -60,8 +60,14 @@ function VirtualKey:init()
local label_widget
if self.icon then
-- Scale icon to fit other characters height
-- (use *1.5 as our icons have a bit of white padding)
local icon_height = math.ceil(self.face.size * 1.5)
label_widget = ImageWidget:new{
file = self.icon,
scale_factor = 0, -- keep icon aspect ratio
height = icon_height,
width = icon_height * 100, -- to fit height when ensuring a/r
}
else
label_widget = TextWidget:new{

Loading…
Cancel
Save