Created attachment 153447 [details] screenshot When opening an EPub file, the font is rendered in a HUGE size. I've checked the settings for the EPub backend, and changed them from the default to serif, 12 point. This is ignored... the text is displayed in a sans-serif font, with a size so large that only 5 characters will display on a line, 2 lines per page. (See screenshot attached.)
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)
fixed python code #!/usr/bin/env python3 # convert css values from short float to full float # example: .9 to 0.9 # aka: expand minified float values # fix too large fonts in okular # TODO regex is bad. use a proper css linter: stylelint # https://bugs.kde.org/show_bug.cgi?id=461390 import re, sys with open(sys.argv[1], "r") as f: css = f.read() print(re.sub(r":\s*\.([0-9]+)([a-zA-Z]+)\s*;", r":0.\1\2;", css))