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 10-18-2014, 10:06 PM   #1
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,205
Karma: 144286760
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Accessing fonts from CSS

Is there a way to reference fonts that are installed someplace on the Kobo Reader without actually embedding them? I ask because while you can use your choice of fonts, you cannot use more then one font family. So if I want true small caps (for example), I'd have to embed both font families. On 650 & T1, I can use CSS code to access the fonts installed on the Readers without having to embed them in the eBooks. Can I do this on a Kobo Reader using firmware 3.8.0?

Last edited by JSWolf; 10-19-2014 at 11:01 AM.
JSWolf is offline   Reply With Quote
Old 10-18-2014, 10:48 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
Quote:
Originally Posted by JSWolf View Post
Is there a way to embed fonts that are installed someplace on the Kobo Reader without actually embedding them? I ask because while you can use your choice of fonts, you cannot use more then one font family. So if I want true small caps (for example), I'd have to embed both font families. On 650 & T1, I can use CSS code to access the fonts installed on the Readers without having to embed them in the eBooks. Can I do this on a Kobo Reader using firmware 3.8.0?
Yes, this post explains how to reference your sideloaded fonts from a book's stylesheet: https://www.mobileread.com/forums/sho...1&postcount=12
GeoffR is offline   Reply With Quote
Advert
Old 10-18-2014, 10:50 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,249
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by JSWolf View Post
Is there a way to embed fonts that are installed someplace on the Kobo Reader without actually embedding them? I ask because while you can use your choice of fonts, you cannot use more then one font family. So if I want true small caps (for example), I'd have to embed both font families. On 650 & T1, I can use CSS code to access the fonts installed on the Readers without having to embed them in the eBooks. Can I do this on a Kobo Reader using firmware 3.8.0?
Yes, you can. This is what I use for small-caps in the kobo_extra.css file used by calibre's KOBOTOUCH driver's 'Modify CSS' option
Code:
@font-face {font-family: "SCfont"; font-weight: normal; font-style: normal; src: url("res:///fonts/normal/Charis SIL SmCp")}
@font-face {font-family: "SCfont"; font-weight: bold; font-style: normal; src: url("res:///fonts/bold/Charis SIL SmCp")}
@font-face {font-family: "SCfont"; font-weight: normal; font-style: italic; src: url("res:///fonts/italic/Charis SIL SmCp")}
@font-face {font-family: "SCfont"; font-weight: bold; font-style: italic; src: url("res:///fonts/bolditalic/Charis SIL SmCp")}
My label "SCfont" can be anything you like as long as it matches what you've used in the epub's main css file.
The Charis SIL SmCp must match the font's internal and external name.
jackie_w is offline   Reply With Quote
Old 10-19-2014, 04:09 AM   #4
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by JSWolf View Post
Is there a way to embed fonts that are installed someplace on the Kobo Reader without actually embedding them?
That's use or reference fonts, not embed.
Jellby is offline   Reply With Quote
Old 10-19-2014, 11:00 AM   #5
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,205
Karma: 144286760
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 Jellby View Post
That's use or reference fonts, not embed.
True that. My mistake.
JSWolf is offline   Reply With Quote
Advert
Old 10-25-2014, 11:04 AM   #6
dmapr
Evangelist
dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.
 
Posts: 469
Karma: 600816
Join Date: Sep 2009
Device: Kobo Aura HD, Kobo Aura One
A somewhat related question. I have tried to use the technique described by jackie_w to add monospace fonts and occasionally it would result in the book ignoring ALL CSS, while other books worked fine. Can anyone spot anything wrong with my kobo_extra.css?

Code:
@font-face {font-family: monospace; font-weight: normal; font-style: normal; src: url("res:///fonts/normal/Consolas")}
@font-face {font-family: monospace; font-weight: bold; font-style: normal; src: url("res:///fonts/bold/Consolas")}
@font-face {font-family: monospace; font-weight: normal; font-style: italic; src: url("res:///fonts/italic/Consolas")}
@font-face {font-family: monospace; font-weight: bold; font-style: italic; src: url("res:///fonts/bolditalic/Consolas")}

pre, code, tt {
   font-family: monospace; 
   font-size: 80%;
}
dmapr is offline   Reply With Quote
Old 10-25-2014, 11:26 AM   #7
Anak
Guru
Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.
 
Posts: 600
Karma: 641742
Join Date: Mar 2012
Location: DE
Device: Kobo Glo
Quote:
Originally Posted by dmapr View Post
book ignoring ALL CSS, while other books worked fine.
@dmapr. There is nothing wrong with your code.
Are you sure that the original stylesheet is correct?
A minor error (i.e. a missing semicolon ; ) will break the CSS on Kobo ereaders while Sigil displays the output as intended.

CSS Validation Tool: http://jigsaw.w3.org/css-validator/validator
Anak is offline   Reply With Quote
Old 10-25-2014, 12:25 PM   #8
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,249
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by dmapr View Post
A somewhat related question. I have tried to use the technique described by jackie_w to add monospace fonts and occasionally it would result in the book ignoring ALL CSS, while other books worked fine. Can anyone spot anything wrong with my kobo_extra.css?
Another thing to try... I've also experienced all css being ignored. Find a book with the problem and have a look at its internal css. Do you see any occurrences of !important in there? If so remove them and try again.
jackie_w is offline   Reply With Quote
Old 10-25-2014, 02:11 PM   #9
dmapr
Evangelist
dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.
 
Posts: 469
Karma: 600816
Join Date: Sep 2009
Device: Kobo Aura HD, Kobo Aura One
Quote:
Originally Posted by Anak View Post
@dmapr. There is nothing wrong with your code.
Are you sure that the original stylesheet is correct?
A minor error (i.e. a missing semicolon ; ) will break the CSS on Kobo ereaders while Sigil displays the output as intended.

CSS Validation Tool: http://jigsaw.w3.org/css-validator/validator
I did not spot anything obvious like that while looking at the merged CSS file, and the original CSS works if I don't use the extras. I suppose I should try to run the merged one through the validator if I run into this again, thanks for the link.

Quote:
Originally Posted by jackie_w View Post
Another thing to try... I've also experienced all css being ignored. Find a book with the problem and have a look at its internal css. Do you see any occurrences of !important in there? If so remove them and try again.
Thanks for the tip. Next time I run into this I'll check for that.
dmapr is offline   Reply With Quote
Old 07-01-2015, 08:43 AM   #10
dmapr
Evangelist
dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.
 
Posts: 469
Karma: 600816
Join Date: Sep 2009
Device: Kobo Aura HD, Kobo Aura One
Quote:
Originally Posted by jackie_w View Post
Another thing to try... I've also experienced all css being ignored. Find a book with the problem and have a look at its internal css. Do you see any occurrences of !important in there? If so remove them and try again.
@jackie_w, finally ran into this again — you're right, the CSS had a few (seemingly unrelated) rules with !important. Removing the !important fixed things. Any idea why adding font references would cause such an effect?
dmapr is offline   Reply With Quote
Old 07-01-2015, 10:42 AM   #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,249
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by dmapr View Post
@jackie_w, finally ran into this again — you're right, the CSS had a few (seemingly unrelated) rules with !important. Removing the !important fixed things. Any idea why adding font references would cause such an effect?
None at all, I'm afraid

It may have absolutely nothing to do with adding font references. It may be some toxic combination of !important and the cssutils Python package which is used to apply the rules from your kobo_extra.css file - which just happen to be font references in your case. However, this doesn't make any sense to me either as I've no reason to believe there's anything wrong with cssutils (which I use every day for css tweaking) and !important is valid css.

If you want to troubleshoot it, have you tried temporarily disabling kobo_extra.css and adding your font rules manually - also leaving the !important occurrences as-is? Does the Kobo still reject the whole css file?

For myself I've side-stepped the problem by auto-removing all occurrences of !important whenever I tweak css because I can see no good reason for a well-constructed book to need them in the internal css.
jackie_w is offline   Reply With Quote
Old 07-03-2015, 10:49 AM   #12
dmapr
Evangelist
dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.dmapr ought to be getting tired of karma fortunes by now.
 
Posts: 469
Karma: 600816
Join Date: Sep 2009
Device: Kobo Aura HD, Kobo Aura One
Quote:
Originally Posted by jackie_w View Post
None at all, I'm afraid

It may have absolutely nothing to do with adding font references. It may be some toxic combination of !important and the cssutils Python package which is used to apply the rules from your kobo_extra.css file - which just happen to be font references in your case. However, this doesn't make any sense to me either as I've no reason to believe there's anything wrong with cssutils (which I use every day for css tweaking) and !important is valid css.

If you want to troubleshoot it, have you tried temporarily disabling kobo_extra.css and adding your font rules manually - also leaving the !important occurrences as-is? Does the Kobo still reject the whole css file?

For myself I've side-stepped the problem by auto-removing all occurrences of !important whenever I tweak css because I can see no good reason for a well-constructed book to need them in the internal css.
I have certainly seen some differences in the book rendering in my experimentation between CSS being added manually and auto-applied from kobo_extra.css, but that made no sense either I do not recall if !important was involved in that particular setup, and I think the only issue was whether it would actually use the monospace font or not, the remainder of the CSS worked fine.

I ended up doing the same thing you do — I strip out all !important from the CSS. In all cases I've seen so far it was in the CSS I had absolutely no interest in to begin with.

Last edited by dmapr; 07-03-2015 at 11:02 AM.
dmapr is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to invoke different fonts in CSS 2.3.1? xuyn2003 Kobo Reader 32 01-06-2013 09:52 PM
working with fonts in css jayz Kindle Formats 9 10-29-2012 04:09 PM
PRS-T1 Adding two fonts into the CSS? WarGhSt Sony Reader 1 02-02-2012 01:41 AM
Opus Fonts directory for Calibre -> External CSS fiery Bookeen 12 02-20-2011 10:05 PM
nook fonts via CSS danrodney Barnes & Noble NOOK 1 12-21-2010 07:56 AM


All times are GMT -4. The time now is 05:17 PM.


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