Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 03-08-2015, 04:21 PM   #1
HarryGeez
Junior Member
HarryGeez began at the beginning.
 
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.
HarryGeez is offline   Reply With Quote
Old 03-08-2015, 04:54 PM   #2
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
Strange...

AFAIK eBook CSS is always respected but in two cases:
  1. UI overriding settings like font type or justification.
  2. Unsupported features like widows and orphans or page-break-whatever (in ACCESS I mean) or white-space: nowrap (in RMSDK)

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.
arspr is offline   Reply With Quote
Old 03-08-2015, 05:09 PM   #3
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
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.
jackie_w is offline   Reply With Quote
Old 03-08-2015, 05:10 PM   #4
GERGE
Guru
GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.
 
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?
GERGE is offline   Reply With Quote
Old 03-08-2015, 05:12 PM   #5
Section8
Addict
Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.
 
Section8's Avatar
 
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/ ?
Section8 is offline   Reply With Quote
Old 03-08-2015, 06:53 PM   #6
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,210
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by HarryGeez View Post
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.
First question would be what format are you reading the books in? The standard epub or Kobo's modified epub (generally called kepub). The ACCESS renderer used for kepubs does tend to disregard some CSS styles but the Adobe RMSDK renderer used for standard epubs does a pretty decent job of following the epub2 standard (other than using auto/auto for center stuff and smallcaps). Monospaced text is going to require you to install a monospace font since there is not one present by default and add the CSS references to it. For myself, I installed HP's Dark Courier font and the following CSS entries:

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;
    }
I then add the code start/end tags around any monospaced text. An example from Andy Weir's The Martian for a computer bootup sequence.

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">&nbsp;</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>
Several other ebooks I own already had the code tags wrapped around monospaced text so simply adding the CSS code to the start of the stylesheet is all that is needed.

Last edited by DNSB; 03-08-2015 at 06:57 PM.
DNSB is offline   Reply With Quote
Old 03-08-2015, 11:15 PM   #7
HarryGeez
Junior Member
HarryGeez began at the beginning.
 
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.
HarryGeez is offline   Reply With Quote
Old 03-09-2015, 12:12 AM   #8
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by HarryGeez View Post
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.
I've loaded this on my Aura H2O running FW3.13.1. And I have it opened in the calibre viewer and editor. I can't see any real differences other than the lack of a monospace font. I can different fonts, different colours (well, shades of grey), shaded areas and several different margin sizes.

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.
davidfor is offline   Reply With Quote
Old 03-09-2015, 11:36 AM   #9
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
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:
Originally Posted by davidfor View Post
I've loaded this on my Aura H2O running FW3.13.1. And I have it opened in the calibre viewer and editor. I can't see any real differences other than the lack of a monospace font. I can different fonts, different colours (well, shades of grey), shaded areas and several different margin sizes.

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.
Try turning on publisher default (with your H2O) as there is an embedded monospace font.
JSWolf is offline   Reply With Quote
Old 03-09-2015, 12:20 PM   #10
HarryGeez
Junior Member
HarryGeez began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Mar 2015
Device: Kobo Aura
Quote:
Originally Posted by davidfor View Post
I've loaded this on my Aura H2O running FW3.13.1. And I have it opened in the calibre viewer and editor. I can't see any real differences other than the lack of a monospace font. I can different fonts, different colours (well, shades of grey), shaded areas and several different margin sizes.

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.
Okay, maybe Pro Git wasn't the best example for what I was trying to show, because the only lacking thing is monospace fonts. However, it isn't as simple as just adding a monospace font to the device though. I did what DNSB suggested, and it worked, so thanks DNSB.

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.
HarryGeez is offline   Reply With Quote
Old 03-09-2015, 01:36 PM   #11
Dr. Drib
Grand Sorcerer
Dr. Drib ought to be getting tired of karma fortunes by now.Dr. Drib ought to be getting tired of karma fortunes by now.Dr. Drib ought to be getting tired of karma fortunes by now.Dr. Drib ought to be getting tired of karma fortunes by now.Dr. Drib ought to be getting tired of karma fortunes by now.Dr. Drib ought to be getting tired of karma fortunes by now.Dr. Drib ought to be getting tired of karma fortunes by now.Dr. Drib ought to be getting tired of karma fortunes by now.Dr. Drib ought to be getting tired of karma fortunes by now.Dr. Drib ought to be getting tired of karma fortunes by now.Dr. Drib ought to be getting tired of karma fortunes by now.
 
Dr. Drib's Avatar
 
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.
Dr. Drib is offline   Reply With Quote
Old 03-09-2015, 02:38 PM   #12
jandrew
Zealot
jandrew ought to be getting tired of karma fortunes by now.jandrew ought to be getting tired of karma fortunes by now.jandrew ought to be getting tired of karma fortunes by now.jandrew ought to be getting tired of karma fortunes by now.jandrew ought to be getting tired of karma fortunes by now.jandrew ought to be getting tired of karma fortunes by now.jandrew ought to be getting tired of karma fortunes by now.jandrew ought to be getting tired of karma fortunes by now.jandrew ought to be getting tired of karma fortunes by now.jandrew ought to be getting tired of karma fortunes by now.jandrew ought to be getting tired of karma fortunes by now.
 
jandrew's Avatar
 
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.
Attached Thumbnails
Click image for larger version

Name:	screenshot.jpg
Views:	312
Size:	226.1 KB
ID:	135786  
jandrew is offline   Reply With Quote
Old 03-09-2015, 04:18 PM   #13
HarryGeez
Junior Member
HarryGeez began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Mar 2015
Device: Kobo Aura
Quote:
Originally Posted by jandrew View Post
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.
May I know what do you use to convert? Do you use KePub Outputter?
HarryGeez is offline   Reply With Quote
Old 03-09-2015, 04:25 PM   #14
GERGE
Guru
GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.GERGE ought to be getting tired of karma fortunes by now.
 
Posts: 733
Karma: 5797160
Join Date: Jun 2010
Location: Istanbul
Device: Kobo Libra
Kepub output plugin is the only reliable way.
GERGE is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 05:32 AM.


MobileRead.com is a privately owned, operated and funded community.