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

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 02-26-2009, 08:12 PM   #1
Cygfrydd
Jackass Crazyfish
Cygfrydd began at the beginning.
 
Cygfrydd's Avatar
 
Posts: 7
Karma: 10
Join Date: Jan 2007
Location: St. Petersburg, Florida, US
Device: Sony Reader PRS-505
ePub + Embedded Fonts

Totally new to these forums, so this seems like a splended time for a first post.

I'm hand-making ePubs for my Sony Reader PRS-505 (not entirely by hand, using some custom Python scripts to help things along), and have been embedding TTF fonts to override the standard Reader fonts (as well as gaining true italics, etc.); that is to say, including them in the "zip" instead of pointing at fonts already loaded in the Data directory on the Reader. The following works just fine in both the desktop version of ADE, and on the Reader:

Code:
@font-face {
  font-family: BerlingAntiqua ;
  font-style: normal ;
  font-weight: normal ;
  src: url(fonts/base/berling.ttf) ;
}
...
p {
  font-family: BerlingAntiqua ;
  margin: 0 ;
  padding: 0 ;
  text-align: justify ;
  text-indent: 1em ;
  font-size: 120% ;
}
I got to thinking about the consequences of this. It seems to me that the font files themselves ought to be listed in the <manifest> portion of content.opf; obviously it works fine without, and epubcheck doesn't complain. But if they were listed... what media-type should I use? Googling has been no help, except to locate a few posts with proposals for media-types for fonts, but nothing concrete. Has anyone else explored this?


— @yg

-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-
Cygfrydd Llewellyn | cygfrydd@gmail.com
-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-

Guilt was the grease in which the wheels of the authority turned.
— (Terry Pratchett, Small Gods)
Cygfrydd is offline   Reply With Quote
Old 02-26-2009, 09:20 PM   #2
llasram
Reticulator of Tharn
llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.llasram ought to be getting tired of karma fortunes by now.
 
llasram's Avatar
 
Posts: 622
Karma: 400000
Join Date: Jan 2007
Location: EST
Device: Sony PRS-505
The OPF 2.0 spec is very clear that font files must be listed in the <manifest/> for the book to be correct. (Epubcheck doesn't parse or check CSS and thus doesn't see the references to complain.) But you are correct -- there is no official assigned MIME type for TrueType or OpenType fonts. Most common seems to be 'application/x-font-opentype' and 'application/x-font-truetype', which is what calibre uses.
llasram is offline   Reply With Quote
 
Enthusiast
Old 02-27-2009, 10:52 AM   #3
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: 6,193
Karma: 4800739
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by llasram View Post
Most common seems to be 'application/x-font-opentype' and 'application/x-font-truetype', which is what calibre uses.
I used "application/x-truetype-font", I don't know where I copied that from...

Anyway, the usual recomendation is not to force a particular font on the main text of the book, you can use embedded fonts for titles, banners, etc., but let the user select the font he/she likes best for the tex.
Jellby is offline   Reply With Quote
Old 02-27-2009, 12:53 PM   #4
hekkel
Enthusiast
hekkel is on a distinguished road
 
Posts: 33
Karma: 54
Join Date: Apr 2008
Device: PRS-505, Cybook Opus
Quote:
Originally Posted by Cygfrydd View Post
It seems to me that the font files themselves ought to be listed in the <manifest> portion of content.opf; obviously it works fine without, and epubcheck doesn't complain. But if they were listed... what media-type should I use?
application/x-font-ttf

That's what I use and what I found in e.g. the books from Penguin.

-maarten
hekkel is offline   Reply With Quote
Old 02-27-2009, 02:22 PM   #5
Cygfrydd
Jackass Crazyfish
Cygfrydd began at the beginning.
 
Cygfrydd's Avatar
 
Posts: 7
Karma: 10
Join Date: Jan 2007
Location: St. Petersburg, Florida, US
Device: Sony Reader PRS-505
Outstanding and helpful reply, folks. As far as the suggestion about leaving the fonts up to the user, I think I’ll go with the url('res:///Data/fonts/foobar.ttf') scheme, storing the fonts on the Reader itself, instead of packing them inside the ePub, unless there’s a pressing need for something custom... even then, if it’s a one-off instance, I could just convert the type to outlines and embed it as a SVG. Makes for a drastically smaller ePub when you're using fonts with a lot of glyphs, as well.

— @yg
Cygfrydd is offline   Reply With Quote
Old 02-27-2009, 03:08 PM   #6
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: 6,193
Karma: 4800739
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by Cygfrydd View Post
Outstanding and helpful reply, folks. As far as the suggestion about leaving the fonts up to the user, I think I’ll go with the url('res:///Data/fonts/foobar.ttf') scheme, storing the fonts on the Reader itself, instead of packing them inside the ePub
I wouldn't rely on that, that'd work only in the Sony reader, other readers may have fonts stored in different places (and with different filenames). If you need/want a specific font, include it in the ePub file (if the license allows it). This, of course, applies only if you plan to distribute the ePub file, if it's only for you, do whatever works for you
Jellby is offline   Reply With Quote
Old 03-02-2009, 05:10 PM   #7
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: 37,666
Karma: 18475502
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
Where in the Reader do the fonts go so they don't have to be included in the ePub?
JSWolf is offline   Reply With Quote
Old 03-02-2009, 05:13 PM   #8
zelda_pinwheel
zeldinha zippy zeldissima
zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.
 
zelda_pinwheel's Avatar
 
Posts: 27,828
Karma: 908606
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
Quote:
Originally Posted by JSWolf View Post
Where in the Reader do the fonts go so they don't have to be included in the ePub?
it might be different on the 505, but on the 700 you just create a folder called "fonts" (no quotes) at the root of the main memory, next to the other folders. then specify the file path as indicated.
zelda_pinwheel is offline   Reply With Quote
Old 03-02-2009, 05:25 PM   #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: 37,666
Karma: 18475502
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
I'll give it a go. Thanks!
JSWolf is offline   Reply With Quote
Old 03-02-2009, 05:26 PM   #10
Cygfrydd
Jackass Crazyfish
Cygfrydd began at the beginning.
 
Cygfrydd's Avatar
 
Posts: 7
Karma: 10
Join Date: Jan 2007
Location: St. Petersburg, Florida, US
Device: Sony Reader PRS-505
Quote:
Originally Posted by JSWolf View Post
Where in the Reader do the fonts go so they don't have to be included in the ePub?
On a PRS-505/700, you can access the Reader’s internal memory like a flash drive; it should mount automatically when you connect the USB. On that mount, create a directory (I just call mine "fonts"), and put the fonts there.

You can then access them from your stylesheets by using something akin to this:
Code:

@font-face {
  font-family: BerlingAntiqua ;
  font-style: normal ;
  font-weight: normal ;
  src: url('res:///Data/fonts/berling.ttf') ;
}

@font-face {
  font-family: BerlingAntiqua ;
  font-style: oblique ;
  font-weight: normal ;
  src: url('res:///Data/fonts/berlingi.ttf') ;
}

@font-face {
  font-family: BerlingAntiqua ;
  font-style: normal ;
  font-weight: bold ;
  src: url('res:///Data/fonts/berlingb.ttf') ;
}

@font-face {
  font-family: BerlingAntiqua ;
  font-style: oblique ;
  font-weight: bold ;
  src: url('res:///Data/fonts/berlingz.ttf') ;
}

p {
  font-family: BerlingAntiqua, serif ;
  margin : 0 ;
  padding : 0 ;
  text-align : justify ; /* not working on Sony yet */
  text-indent : 1em ;
  font-size: 120% ;
}
— @yg

-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-
Cygfrydd Llewellyn | cygfrydd@gmail.com
-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-

Old Tom was the single cracked bronze bell in the University bell tower.
The clapper dropped out shortly after it was cast, but the bell still
tolled out some tremendously sonorous silences every hour.
— (Terry Pratchett, Eric)
Cygfrydd is offline   Reply With Quote
Old 03-02-2009, 05:55 PM   #11
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: 37,666
Karma: 18475502
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
It works the same on the 505 as it does on the 700.
JSWolf is offline   Reply With Quote
Old 03-02-2009, 05:56 PM   #12
zelda_pinwheel
zeldinha zippy zeldissima
zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.
 
zelda_pinwheel's Avatar
 
Posts: 27,828
Karma: 908606
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
Quote:
Originally Posted by JSWolf View Post
It works the same on the 505 as it does on the 700.
good to know !
zelda_pinwheel is offline   Reply With Quote
Reply

Tags
epub font mimetype

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML -> EPUB with no embedded fonts doremifaso Calibre 10 09-25-2010 05:56 AM
iPad iBooks, ePub, embedded fonts & encryption pdurrant Apple Devices 37 06-08-2010 01:24 PM
Embedded fonts in epub erik5000 ePub 7 12-08-2009 11:55 AM
Opus Opus, ePub and 'embedded' fonts AnemicOak Bookeen 5 11-10-2009 12:21 PM
ePub embedded fonts JSWolf Ectaco jetBook 9 09-14-2009 08:43 PM


All times are GMT -4. The time now is 10:49 AM.


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