thorium-reader
thorium-reader copied to clipboard
EPUB: monospace rendering for code examples
Reading some programming books in EPUB format, I thought it would be cool to render code snippets, that are styled in CSS accordingly, in monospace font.
Hello, I am not able to reproduce this problem with the default user settings, which do not override the authored font faces. However, as a user if I choose to override the publisher styles with a custom font, then this is applied to all text, including the monospace code sections. @JayPanoz this sounds like something that is controlled by https://github.com/readium/readium-css right?
@danielweck, sorry, looks like I have instinctively switched the font because default one looks so Windows9x-ish and it's hard to read, I honestly don't remember when I did this 🙄 And default monospace is almost disappearing on 1920x1080 display. It wood be so cool if it could override fonts by category, e.g. 'Humanist' for sans serif, 'Monospace' for monospace etc.
this sounds like something that is controlled by https://github.com/readium/readium-css right?
Indeed but we’re only applying font-family
to a subset of HTML elements, which doesn’t contain markup elements for code, etc.
So it seems to me the user setting is applied to code because it’s using p class
in this publication. If the markup in the book was using pre + code
it shouldn’t have been overridden.
That said, it wouldn’t solve this rendering issue raised by @weiss-d
And default monospace is almost disappearing on 1920x1080 display. It wood be so cool if it could override fonts by category, e.g. 'Humanist' for sans serif, 'Monospace' for monospace etc.
That’s quite tricky with CSS only since emulating defaults (for sans-serif
, serif
, monospace
, script
, etc.) is not really a thing it was meant for. It’s more of an app concern as they have easier access to that (+ installed fonts) and then there’s the issue of force-overriding the authors’ stylesheets (cf. browsers).
But I can imagine Electron has something for that?
It seems I have a similar problem: I read books that contain code snippets in a monospace font. In order to still be able to read something, I have to greatly enlarge the font, but the code display remains very small in places. Also, the contrast in these areas is too weak. Changing the font and size in the settings does not change anything.
(Thorium-Reader on Windows 10, epub)
Even though I can read the "normal" text with the screen reader, it is better understanding to read the code examples myself.
Helpful would be therefore:
- a possibility to increase the font size of code examples.
- a better contrast for the areas
But otherwise this is a really nice program, thanks!
Moving to https://github.com/readium/readium-css/issues/112