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 12-22-2012, 01:56 AM   #1
xuyn2003
Connoisseur
xuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texan
 
Posts: 71
Karma: 18140
Join Date: Jul 2011
Device: PRS-T1&KOBOTOUCH
How to invoke different fonts in CSS 2.3.1?

Dear all,
After updated glo to 2.3.1, some thing went wrong.

for example CSS:

Quote:
@font-face {
font-family:"zw";
url(res:///fonts/zw.ttf)
}

@font-face {
font-family:"ht";
url(res:///fonts/ht.ttf)
}
is worked well on 2.2, but failed on firmware 2.3.1.

Is anybody know how to fix the url?
Thanks!
xuyn2003 is offline   Reply With Quote
Old 12-22-2012, 02:31 AM   #2
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,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
I didn't know you could do that. The path used when referring to the books includes "mnt/onboard/". I would try:

res:///mnt/onboard/fonts/ht.ttf
davidfor is offline   Reply With Quote
Old 12-22-2012, 02:40 AM   #3
xuyn2003
Connoisseur
xuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texan
 
Posts: 71
Karma: 18140
Join Date: Jul 2011
Device: PRS-T1&KOBOTOUCH
Thank you Davidfor, I will have a try through this directory.
xuyn2003 is offline   Reply With Quote
Old 12-22-2012, 04:01 PM   #4
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,205
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
I got quite hopeful for a moment when I read xuyn2003's OP.

I have been successfully using variations on this theme for several years on my Sonys and PocketBook. When I first got the Kobo Glo I tried every 'magic path' I could think of to access external fonts in /fonts to display monospace and small-caps fonts for the few of my epubs which need them. (BTW the Kobo is the first reader I've owned which doesn't contain a monospace font. It must be difficult to read programming manuals without one.)

I'm pretty sure I tried both res:///mnt/onboard/fonts/xxx.ttf and res:///fonts/xxx.ttf but had no success whatsoever on fw2.1.5. In the end, the only way I could successfully use the special fonts was by embedding them in the epub when necessary. I've just retested with res:///fonts/xxx.ttf, but still no joy.

Given the problems I'm reading about fw 2.3.1 I've decided to stick with fw 2.1.5 for the time being, but if this unofficial v2.2 really works I'd be quite tempted to try it.

Has anyone else had success accessing the Kobo font directory from within an epub's css file?
jackie_w is offline   Reply With Quote
Old 12-22-2012, 05:22 PM   #5
robko
Wizard
robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.
 
Posts: 2,454
Karma: 5469320
Join Date: Jul 2010
Device: Kobo
Quote:
Originally Posted by jackie_w View Post
Has anyone else had success accessing the Kobo font directory from within an epub's css file?
Any particular reason you're trying to do it this way rather than just dump the font on the Kobo and picking it as the desired font when you open the book the 1st first time? It should maintain the font setting for each book, so you only need to change font once.
robko is offline   Reply With Quote
Old 12-22-2012, 05:35 PM   #6
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by jackie_w View Post
Has anyone else had success accessing the Kobo font directory from within an epub's css file?
Not strictly from an epub's css, but from an kepub.epub's. There, it is sufficient to write the font name without path. For instance,

Code:
body {font-family:"Arial Unicode MS"}
.sa {font-size: 130%;
      font-family:"Sanskrit 2003"}
The Kobo knows the location of the font files.

Edit: I am on 2.1.5

Last edited by tshering; 12-22-2012 at 05:57 PM.
tshering is offline   Reply With Quote
Old 12-22-2012, 06:29 PM   #7
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,205
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by robko View Post
Any particular reason you're trying to do it this way rather than just dump the font on the Kobo and picking it as the desired font when you open the book the 1st first time? It should maintain the font setting for each book, so you only need to change font once.
Perhaps I didn't explain it well enough. I have some books which have certain portions of text (not the whole book) with css style {font-family: monospace}. The Kobo seems to render these portions in the font selected in the font menu, i.e. as if the styling was {font-family: serif}.

For example, I do not want computer code snippets rendered in the book's main serif font. Neither do I want the same book's main body text rendered in a special monospace font. I want a serif font for the main book and a monospace font for the code snippets.

If I wanted to read a book which is a screenplay -- usually rendered completely in monospace -- it wouldn't be a problem to load and select a monospace font from the font list for the whole book.

I have a similar problem with some of my own created epubs which need some portions only in a small-caps font. I was quite happy to create them this way because rendering small-caps was not a problem on any of my previous readers -- mainly because of MR community hacking offerings it has to be said. I do not know of any ereader which can support font-variant: small-caps as standard.
jackie_w is offline   Reply With Quote
Old 12-22-2012, 06:33 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,205
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by tshering View Post
Not strictly from an epub's css, but from an kepub.epub's. There, it is sufficient to write the font name without path. For instance,

Code:
body {font-family:"Arial Unicode MS"}
.sa {font-size: 130%;
      font-family:"Sanskrit 2003"}
The Kobo knows the location of the font files.

Edit: I am on 2.1.5
Ah-ha, OK. I hadn't thought of that. I don't own any kepubs. I'll experiment a bit by renaming one of my sideloaded epubs.
jackie_w is offline   Reply With Quote
Old 12-22-2012, 07:19 PM   #9
robko
Wizard
robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.robko ought to be getting tired of karma fortunes by now.
 
Posts: 2,454
Karma: 5469320
Join Date: Jul 2010
Device: Kobo
Quote:
Originally Posted by jackie_w View Post
For example, I do not want computer code snippets rendered in the book's main serif font. Neither do I want the same book's main body text rendered in a special monospace font. I want a serif font for the main book and a monospace font for the code snippets.
That makes total sense. It would be a pain to not have those rendered monospace.
robko is offline   Reply With Quote
Old 12-23-2012, 02:40 AM   #10
xuyn2003
Connoisseur
xuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texan
 
Posts: 71
Karma: 18140
Join Date: Jul 2011
Device: PRS-T1&KOBOTOUCH
Quote:
Originally Posted by jackie_w View Post
Ah-ha, OK. I hadn't thought of that. I don't own any kepubs. I'll experiment a bit by renaming one of my sideloaded epubs.
Hi Jackie,
Have you find the solution?
xuyn2003 is offline   Reply With Quote
Old 12-23-2012, 02:42 AM   #11
xuyn2003
Connoisseur
xuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texan
 
Posts: 71
Karma: 18140
Join Date: Jul 2011
Device: PRS-T1&KOBOTOUCH
Quote:
Originally Posted by davidfor View Post
I didn't know you could do that. The path used when referring to the books includes "mnt/onboard/". I would try:

res:///mnt/onboard/fonts/ht.ttf
res:///mnt/onboard/fonts/ht.ttf, I failed on this directory, I think kobo 2.3.1 changed the mechanism of invoking fonts.
So grateful.
xuyn2003 is offline   Reply With Quote
Old 12-23-2012, 04:06 AM   #12
hubertphava
Connoisseur
hubertphava ought to be getting tired of karma fortunes by now.hubertphava ought to be getting tired of karma fortunes by now.hubertphava ought to be getting tired of karma fortunes by now.hubertphava ought to be getting tired of karma fortunes by now.hubertphava ought to be getting tired of karma fortunes by now.hubertphava ought to be getting tired of karma fortunes by now.hubertphava ought to be getting tired of karma fortunes by now.hubertphava ought to be getting tired of karma fortunes by now.hubertphava ought to be getting tired of karma fortunes by now.hubertphava ought to be getting tired of karma fortunes by now.hubertphava ought to be getting tired of karma fortunes by now.
 
hubertphava's Avatar
 
Posts: 69
Karma: 1134558
Join Date: Dec 2012
Location: Italy
Device: Cybook Opus, Onyx-Boox Poke5
I put this in my epubs:

Code:
font-face {
font-family: "Name of the Font";
font-weight: normal;
font-style: normal;
src: url(../Fonts/name_of_the_font.ttf);
}
and it'll works well, both in kobo and non-kobo devices.
This manner sigil would validate your epub and you'll be sure that you can read it correctly in every ereader you want.



HTH

HP
hubertphava is offline   Reply With Quote
Old 12-23-2012, 07:45 AM   #13
xuyn2003
Connoisseur
xuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texanxuyn2003 might easily be mistaken for a Texan
 
Posts: 71
Karma: 18140
Join Date: Jul 2011
Device: PRS-T1&KOBOTOUCH
Quote:
Originally Posted by hubertphava View Post
I put this in my epubs:

Code:
font-face {
font-family: "Name of the Font";
font-weight: normal;
font-style: normal;
src: url(../Fonts/name_of_the_font.ttf);
}
and it'll works well, both in kobo and non-kobo devices.
This manner sigil would validate your epub and you'll be sure that you can read it correctly in every ereader you want.



HTH

HP
Thank you hubertphava, what is the firmware version of your kobo?
I was sucessful in 2.2 but failed in 2.3 firmware.
xuyn2003 is offline   Reply With Quote
Old 12-23-2012, 01:01 PM   #14
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,205
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
@xuyn2003 & hubertphava,

I can get any font I want to display as long as I embed it inside the epub, which (if I'm not mistaken) is the method hubertphava is describing.

I've had no success at all typing something in the epub css file in an attempt to directly reference a font stored in the Kobo /fonts directory. I've tried both xuyn2003's and tshering's suggestions and neither work for me with fw 2.1.5.

In case anyone is interested I'll share a few other things that I found out.
  • For a sideloaded epub (see attached image sorry for my poor camera skills)
    Code:
    epub css style              displayed font
    --------------              ---------------
    no font-family specified    font selected from font list
    font-family: serif          built-in "Document Default" (Georgia)
    font-family: sans-serif     built-in "Avenir"
    font-family: monospace      font selected from font list
  • For a pseudo-kepub, i.e same sideloaded epub renamed to .kepub.epub
    Code:
    epub css style              displayed font
    --------------              ---------------
    no font-family specified    font selected from font list
    font-family: serif          font selected from font list
    font-family: sans-serif     font selected from font list
    font-family: monospace      font selected from font list

An accidental outcome is that for those people who would like to read with sans-serif font Avenir but don't because all italics are displayed instead as bold... If you add font-family: sans-serif; to your body css you should get the whole book displayed in Avenir with all italics, bold and bolditalics displayed correctly. If you look at line 3 in the attached image you can see this for yourself.
Attached Thumbnails
Click image for larger version

Name:	kobofont.jpg
Views:	316
Size:	44.5 KB
ID:	98119  
jackie_w is offline   Reply With Quote
Old 01-03-2013, 11:04 AM   #15
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by jackie_w View Post
I've had no success at all typing something in the epub css file in an attempt to directly reference a font stored in the Kobo /fonts directory. I've tried both xuyn2003's and tshering's suggestions and neither work for me with fw 2.1.5.
For me it seems partly to work and partly not to work. As one can see on the picture Avenir is not working, the rest seems ok to me.
I wondered what happens if I select a font from the font menu. If the whole text is displayed in the selected font how can I go back to the original settings? When I select Amasis, Avenir and so on the whole text is displayed in the selected font, only if I select Sanskrit 2003 the css settings become active again.
Attached Thumbnails
Click image for larger version

Name:	2013_01030009.jpg
Views:	277
Size:	607.4 KB
ID:	98679  
tshering 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
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
Motivation - can you invoke it? mukoan Writers' Corner 26 12-26-2010 07:57 AM
nook fonts via CSS danrodney Barnes & Noble NOOK 1 12-21-2010 07:56 AM


All times are GMT -4. The time now is 02:36 AM.


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