mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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 <https://github.com/koreader/koreader/issues/5859>.
This commit is contained in:
@@ -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 <dd>.
|
||||
|
||||
if self.css then
|
||||
return css .. self.css
|
||||
|
||||
Reference in New Issue
Block a user