From 665cb3730822d587e67d21bca09ae72e96165c0c Mon Sep 17 00:00:00 2001 From: poire-z Date: Wed, 11 Jul 2018 17:24:37 +0200 Subject: [PATCH] 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. --- frontend/ui/widget/virtualkeyboard.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/ui/widget/virtualkeyboard.lua b/frontend/ui/widget/virtualkeyboard.lua index 6f80f8475..00b82c313 100644 --- a/frontend/ui/widget/virtualkeyboard.lua +++ b/frontend/ui/widget/virtualkeyboard.lua @@ -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{