[okular] [Bug 461390] EPub rendered with HUGE font.
bugzilla_noreply at kde.org
bugzilla_noreply at kde.org
Sun Jun 23 16:49:01 BST 2024
https://bugs.kde.org/show_bug.cgi?id=461390
milahu at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |milahu at gmail.com
--- Comment #1 from milahu at gmail.com ---
still an issue
Okular Version 23.08.5
EPub Backend Version 0.2.3
sample epub file
https://annas-archive.org/md5/6985fb6687007f71313d73356e71dbcc
on page 2 there are 2 lines
»Sei du selbst die Veränderung, die du dir wünschst für diese Welt«
Mahatma Ghandi (1869–1948)
for the curious, the quote translates to
"Be the change you want to see in the world"
html: OEBPS/xhtml/halftitle.html
<p class="noindentd1"><i>»Sei du selbst die Veränderung ...«</i></p>
<p class="right">Mahatma Ghandi (1869–1948)</p>
css: OEBPS/css/9783280037188.css
.noindentd1 { font-size: 1em; }
.right { font-size: .9em; }
line 1 has normal size
line 2 is too large
line 1 has height 21px
line 2 has height 186px
186px should be 19px
so apparently
font-size: .9em
is parsed as
font-size: 9em
workaround: convert font size from short float to full float
#!/usr/bin/env python3
# convert css font size from short float to full float
# fix too large fonts in okular
import re
import sys
with open(sys.argv[1], "r") as f:
css = f.read()
def replace(match):
a, b, c = match.groups()
#b = str(round(float(b) * 100)) + "%" # convert em to percent
b = str(float(b)) + "em" # convert short float to full float: .9 to 0.9
return a + b + c
css =
re.sub(r"(font-size:\s*)([0-9]+|[0-9]+\.|\.[0-9]+|[0-9]+\.[0-9]+)em(\s*;)",
replace, css, re.S)
print(css)
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Okular-devel
mailing list