Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-14-2015, 03:58 PM   #1
Shadowjack
Enthusiast
Shadowjack began at the beginning.
 
Posts: 44
Karma: 10
Join Date: Apr 2009
Location: Champaign, IL
Device: Sony PRS-500, PRS-505, PRS-650, Kobo H2O, H2Ov2, Libra H2O
ereader font options vs ebook stylesheet

With most of my ebooks, the font settings (i.e. readingFontFamily) in the "kobo ereader.conf" file work and the books look the same. But some ebooks don't. Is it some setting in the ebook's stylesheet that determines when an ebook uses the H2O's settings or use's the ebooks? Is it ebooks that have explictly defined a font family in the stylesheet that overides the H2O's selected font?
Shadowjack is offline   Reply With Quote
Old 05-14-2015, 10:14 PM   #2
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
The publisher is able to override the reader's choice of font family and many other settings from the book if they choose to do so. Converting a book to epub with Calibre can also have a similar unfortunate effect due to the CSS 'flattening' that Caibre does.

There are some firmware patches that can help with some settings such as line spacing, but they are not a perfect solution. The only real solution is to edit the book's stylesheet before sideloading the book and remove the publisher's overriding styles.

Edit: To better answer the question: There isn't usually one specific setting that you can change in the stylesheet to fix the problem, but for font-family a general procedure that often works is to remove the font-family property from div/p/span elements that are used for the main body of text and add it to the body element instead, and let the div/p/span inherit the property from body. Leave in place the font-family properties for special elements such as headings etc. That way you can see the publisher's original setting by selecting the "Document Default" font, and special elements such as headings will remain in the publisher's font, but selecting a different font from the device will change the main body of text.

Edit2: A blunter approach for font-family is simply to strip all font-family styles and all embedded fonts from the book. However that can spoil some books which depend on different font styles as an integral part of the story, e.g. to indicate different speakers; and detract from other books which simply make some nice use of fonts in appropriate places, such as fancy headings or a handwriting font for extracts from a diary.

Last edited by GeoffR; 05-14-2015 at 11:09 PM. Reason: o better answer the question ...
GeoffR is offline   Reply With Quote
Advert
Old 05-15-2015, 10:06 AM   #3
Shadowjack
Enthusiast
Shadowjack began at the beginning.
 
Posts: 44
Karma: 10
Join Date: Apr 2009
Location: Champaign, IL
Device: Sony PRS-500, PRS-505, PRS-650, Kobo H2O, H2Ov2, Libra H2O
Thank you for the information. Let me see if I understand correctly:

All of my books are side-loaded epubs (using Calibre) and many of those are Calibre converts. Before I got my H2O I had a sony PRS-650, so I am comfortable using the book editor function in Calibre to fix the formatting (such as adding justification). So looking at a typical book: it will have a body element (often labeled calibre), a .p element and a div element (such as .indent). Do the device settings wrap around everything (and be affected by .css inheritance rules) or replace the .body element? From your explanation it sounds like it replaces the .body element and would then be overridden by the .p and .indent division elements.

Again, thanks.

Last edited by Shadowjack; 05-15-2015 at 10:12 AM.
Shadowjack is offline   Reply With Quote
Old 05-16-2015, 04:12 AM   #4
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
For epubs most of the device settings are set in the body element (using !important). If you have a stylesheet like this:
Code:
body {line-height: 1.5;}
p {text-indent: 1em;}
then the line spacing set from the device will override the one set in the body, and the paragraph p will inherit its line-height from body, and everything will work as you expect.

But there is a problem with the way that Calibre creates epubs. When Calibre converts a book with the stylesheet above, it creates class for body like:
Code:
.calibre {line-height: 1.5;}
and then uses it in the html like this:
Code:
<body class="calibre">
which then overrides the device setting in body because Calibre has increased the specificity of the styles.

What you need to do with Calibre-created/converted books is to remove the settings such as line-height from the .calibre class and specify them directly in body as the first example above.

Edit: The above applies to the EPUB reader, which interprets !important differently than the KEPUB reader.

Last edited by GeoffR; 05-16-2015 at 04:26 AM. Reason: ... applies to the EPUB reader ...
GeoffR is offline   Reply With Quote
Old 05-16-2015, 08:18 AM   #5
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
I use Calibre's style filtering to get rid of most offending styles.
Attached Thumbnails
Click image for larger version

Name:	2015-05-16 14:14:03.418069591+02:00.png
Views:	268
Size:	16.6 KB
ID:	138353  
frostschutz is offline   Reply With Quote
Advert
Old 05-16-2015, 08:45 AM   #6
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
That could be too destructive, best way is to take a look to the book itself.
GERGE is offline   Reply With Quote
Old 05-16-2015, 08:52 AM   #7
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
Quote:
Originally Posted by frostschutz View Post
I use Calibre's style filtering to get rid of most offending styles.
Here is an example of a problem that can occur if you simply strip all line-height styles, instead of just the ones used for the main text:

On the left is an epub with a raisecap, the raisecap span has its line-height set to zero to prevent it affecting the line spacing of the rest of the paragraph. On the right is what happens when that line-height style is removed:
Attached Thumbnails
Click image for larger version

Name:	with-lh.png
Views:	310
Size:	27.9 KB
ID:	138354   Click image for larger version

Name:	without-lh.png
Views:	230
Size:	28.1 KB
ID:	138355  
GeoffR is offline   Reply With Quote
Old 05-16-2015, 09:18 AM   #8
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
In the case that a book has special needs, I also use Search&Replace (or similar tools) to fix things. Don't get me wrong, I'd happily do without any style filtering - and without Calibre conversion which is lossy at best - except very many books are borderline unreadable without this procedure.
frostschutz is offline   Reply With Quote
Old 05-17-2015, 12:15 AM   #9
Shadowjack
Enthusiast
Shadowjack began at the beginning.
 
Posts: 44
Karma: 10
Join Date: Apr 2009
Location: Champaign, IL
Device: Sony PRS-500, PRS-505, PRS-650, Kobo H2O, H2Ov2, Libra H2O
I played around with a couple of my converted books and think I have it working so that format changes in the device, show up when reading. One strange thing I ran into is that sometimes a Calibre converted book with have a font-size of 1.29167 for the .calibre class and the main text of the book will then be set .77419 (equivalent to using a font size of 1 for both). Why would it do this? Is there a easy way to set the conversion so that the main text is always 1em?
Shadowjack is offline   Reply With Quote
Old 05-17-2015, 01:02 AM   #10
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
Quote:
Originally Posted by Shadowjack View Post
One strange thing I ran into is that sometimes a Calibre converted book with have a font-size of 1.29167 for the .calibre class and the main text of the book will then be set .77419 (equivalent to using a font size of 1 for both). Why would it do this? Is there a easy way to set the conversion so that the main text is always 1em?
I think that is a result of the font size rescaling option, which you can disable, but I don't know if there is an easy way to reverse the process.

Edit: As to why Calibre does this: I think it must be to cater for ereaders which don't have a way to change the font size from the device.

Last edited by GeoffR; 05-17-2015 at 01:07 AM. Reason: ... why Calibre does this ...
GeoffR is offline   Reply With Quote
Old 05-17-2015, 01:40 PM   #11
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
Quote:
Originally Posted by Shadowjack View Post
Is there a easy way to set the conversion so that the main text is always 1em?
If you don't want to disable font size rescaling, have you tried setting the box underneath it, 'Base font size', to 12pt. I'm not sure whether it always works, but if you have it set to anything else I don't believe the resulting body css will ever be 1em.
jackie_w is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Built-in-Light, TTS, good font options - possible? Shadowplay Which one should I buy? 10 10-21-2013 04:34 PM
Aura: font options for side-loaded content? miquele Kobo Reader 4 07-05-2013 06:58 PM
EReader Alternatives/Options tedwards70 Kindle Fire 4 11-18-2011 10:43 AM
What Fonts are used in various eReaders? What Font options are available? tomereader General Discussions 28 08-20-2010 05:40 AM
cyrillic font and all languages options PJ45 Sony Reader 5 06-26-2009 09:34 AM


All times are GMT -4. The time now is 09:22 AM.


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