![]() |
#1 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Mar 2015
Device: Kobo Aura
|
How to force ePub reader to use books' CSS?
I have a few programming epubs and the Kobo Aura's epub reader doesn't seem to respect the epubs' CSS. It seems that people expect the reader to ignore books' CSS so that all books have a uniform look, but this is crucial for programming books because if monospace fonts and margins are not respected, it's impossible to read the code examples.
My workaround right now is to use KOReader but if it's possible I'd prefer to use the Kobo's native ePub/kepub reader. Any ideas? Sorry if this has been posted before, but I tried searching to no avail. Tbh I don't even know what to search to begin with so I searched 'CSS' and went through most of the results, but none were helpful. Thanks. |
![]() |
![]() |
![]() |
#2 |
Dead account. Bye
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
|
Strange...
AFAIK eBook CSS is always respected but in two cases:
But margins should perfectly work at least if you use relative units like em. Could you post a test book? Last edited by arspr; 03-08-2015 at 04:58 PM. |
![]() |
![]() |
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,251
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
To begin with, my best advice for getting css styles to work as coded is to read books as standard epub, not kepub. If you're a calibre user it would require using the standard KOBOTOUCH driver not the Kobo Touch Extended driver plugin.
However, to get monospace fonts requires some more work. Kobos don't have a built-in monospace font (odd, I know). You can try embedding the 4 monospace files (regular, italic, bold, bolditalic) into each and every book if you like but I prefer to sideload them once to the Kobo /fonts directory and then externally reference them from the epub. Read this post for more details about how to code the relevant css @font-face statements. I use HP's Dark Courier font, which is free. If you haven't sideloaded fonts before post #1 of this thread should help. If you're a calibre user and you don't want to hand-edit every epub, take a look at the Modify CSS option in the KOBOTOUCH driver. Adding the monospace @font-faces to the kobo_extra.css file on your Kobo will mean that they get auto-added to every epub during the calibre send-to-device process. This is the method I've been using for ages, it's painless and it works. If the above isn't detailed enough feel free to ask and I can elaborate where necessary. |
![]() |
![]() |
![]() |
#4 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 733
Karma: 5797160
Join Date: Jun 2010
Location: Istanbul
Device: Kobo Libra
|
Kobo respects CSS of the epub. There must a problem.
Could you send us the book maybe with 4-5 pages only? |
![]() |
![]() |
![]() |
#5 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 264
Karma: 2121470
Join Date: Oct 2011
Location: Arlington, TX
Device: Kindle PW4, Moon+ Reader on a cheap Android tablet
|
I don't know specifically about kobo, but if it's reader is based on ADE, it probably ignores the entire CSS if it has a single syntax error. Have you tried running it through a css validator such as http://www.css-validator.org/ ?
|
![]() |
![]() |
![]() |
#6 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,210
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Code:
@font-face { font-family: monospace; font-weight: normal; font-style: normal; src: url('res:///fonts/normal/Dark Courier'); } @font-face { font-family: monospace; font-weight: normal; font-style: italic; src: url('res:///fonts/italic/Dark Courier'); } @font-face { font-family: monospace; font-weight: bold; font-style: normal; src: url('res:///fonts/bold/Dark Courier'); } @font-face { font-family: monospace; font-weight: bold; font-style: italic; src: url('res:///fonts/bolditalic/Dark Courier'); } code { font-family : "Dark Courier", monospace; } Code:
<p class="nonindent1 bold"><code>PATHFINDER LOG: SOL 0</code></p> <p class="indent2"><code>BOOT SEQUENCE INITIATED</code></p> <p class="indent2"><code>TIME 00:00:00</code></p> <p class="indent2"><code>LOSS OF POWER DETECTED, TIME/DATE UNRELIABLE</code></p> <p class="indent2"><code>LOADING OS...</code></p> <p class="indent2break"> </p> <p class="indent2"><code>VXWARE OPERATING SYSTEM (C) WIND RIVER SYSTEMS</code></p> <p class="indent2"><code>PERFORMING HARDWARE CHECK:</code></p> <p class="indent2"><code>INT. TEMPERATURE: -34C</code></p> <p class="indent2"><code>EXT. TEMPERATURE: NONFUNCTIONAL</code></p> <p class="indent2"><code>BATTERY: FULL</code></p> <p class="indent2"><code>HIGAIN: OK</code></p> Last edited by DNSB; 03-08-2015 at 06:57 PM. |
|
![]() |
![]() |
![]() |
#7 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Mar 2015
Device: Kobo Aura
|
Here's the book guys, it's free:
http://www.git-scm.com/book/en/v2 Okay, I didn't check, but I don't think there's anything wrong with the CSS, because it reads just fine on basically everything else. iBooks, KOReader, etc. Last edited by HarryGeez; 03-08-2015 at 11:17 PM. |
![]() |
![]() |
![]() |
#8 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
As jackie_w and others have said, the Kobo firmware does not include a monospace font. Adding one on your device or into the epub will fix that. I think you need to tell us where the problems are so we can see for ourselves. A screenshot of what you are expecting might be a good idea as well. |
|
![]() |
![]() |
![]() |
#9 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,756
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#10 | |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Mar 2015
Device: Kobo Aura
|
Quote:
Perhaps, a better example would be Apple's The Swift Programming Language. Here's what I see in calibre: [Image violates guidelines for size - MODERATOR] But this what I see on my Aura: [Image violates guidelines for size - MODERATOR] Granted, even KOReader can't display this correctly, but it'll be nice if I can get something remotely close. Also, this is only simple code, so it doesn't look that bad. Last edited by Dr. Drib; 03-09-2015 at 01:35 PM. |
|
![]() |
![]() |
![]() |
#11 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,441
Karma: 59592133
Join Date: Jan 2007
Location: Peru
Device: KINDLE: Oasis 3, Scribe (1st), Matcha; KOBO: Libra 2, Libra Colour
|
Moderator Notice
Please take a few moments to read our Posting Guidelines, in particular the part about the maximum image size allowed (600x600 pixels). Images that violate those guidelines will be deleted. Thanks. |
![]() |
![]() |
![]() |
#12 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 129
Karma: 2934438
Join Date: Jan 2014
Location: Winnipeg MB Canada
Device: aura hd
|
I've attached a pic (not the greatest tablet camera) of how it looks (the Swift programming book) on my Aura HD when converted to kepub. Pretty much as expected, with the colored text coming out in fairly light shades.
|
![]() |
![]() |
![]() |
#13 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Mar 2015
Device: Kobo Aura
|
May I know what do you use to convert? Do you use KePub Outputter?
|
![]() |
![]() |
![]() |
#14 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 733
Karma: 5797160
Join Date: Jun 2010
Location: Istanbul
Device: Kobo Libra
|
Kepub output plugin is the only reliable way.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
force an addition to main body css ? | cybmole | Conversion | 5 | 01-17-2014 02:35 AM |
In an ePub reader, what are the rules for processing styles/CSS? | mattcurtis | ePub | 1 | 04-05-2013 11:11 AM |
Image Size CSS for Sony Reader epub? | srascal | ePub | 6 | 03-25-2013 04:45 PM |
Force a CSS Refresh? | zephyrmays | Sigil | 15 | 02-03-2013 12:53 PM |
Force Sony Reader Library to re-download all my books? | stodge | Sony Reader | 4 | 11-13-2010 03:45 PM |