From 159fe03f4798a501b7bc52aecff36754a91b7872 Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Sat, 15 Feb 2020 12:23:22 +0100 Subject: [PATCH] Make dictionary margin depend on font size (#5865) The default left margin on blockquote and dd is `40px`, but unfortunately that doesn't scale. rem is calculated using a hardcoded16px, so em or % is the best compromise in this case. PS If we assume 1em = 16px then 40px is actually 2.5em, not 1em. This reduction in indentation is mainly intended for the benefit of smaller E Ink devices. Closes . --- frontend/ui/widget/dictquicklookup.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/ui/widget/dictquicklookup.lua b/frontend/ui/widget/dictquicklookup.lua index 83349d991..0cb2f7493 100644 --- a/frontend/ui/widget/dictquicklookup.lua +++ b/frontend/ui/widget/dictquicklookup.lua @@ -190,7 +190,20 @@ function DictQuickLookup:getHtmlDictionaryCss() line-height: 1.3; ]]..css_justify..[[ } + + blockquote, dd { + margin: 0 1em; + } ]] + -- MuPDF doesn't currently scale CSS pixels, so we have to use a font-size based measurement. + -- Unfortunately MuPDF doesn't properly support `rem` either, which it bases on a hard-coded + -- value of `16px`, so we have to go with `em` (or `%`). + -- + -- These `em`-based margins can vary slightly, but it's the best available compromise. + -- + -- We also keep left and right margin the same so it'll display as expected in RTL. + -- Because MuPDF doesn't currently support `margin-start`, this results in a slightly + -- unconventional but hopefully barely noticeable right margin for
. if self.css then return css .. self.css