02-26-2009, 08:12 PM | #1 |
Jackass Crazyfish
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% ; } — @yg -=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=- Cygfrydd Llewellyn | cygfrydd@gmail.com -=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=- Guilt was the grease in which the wheels of the authority turned. — (Terry Pratchett, Small Gods) |
02-26-2009, 09:20 PM | #2 |
Reticulator of Tharn
Posts: 618
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.
|
Advert | |
|
02-27-2009, 10:52 AM | #3 | |
frumious Bandersnatch
Posts: 7,533
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
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. |
|
02-27-2009, 12:53 PM | #4 | |
Enthusiast
Posts: 33
Karma: 54
Join Date: Apr 2008
Device: PRS-505, Cybook Opus
|
Quote:
That's what I use and what I found in e.g. the books from Penguin. -maarten |
|
02-27-2009, 02:22 PM | #5 |
Jackass Crazyfish
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 |
Advert | |
|
02-27-2009, 03:08 PM | #6 |
frumious Bandersnatch
Posts: 7,533
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
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
|
03-02-2009, 05:10 PM | #7 |
Resident Curmudgeon
Posts: 75,912
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Where in the Reader do the fonts go so they don't have to be included in the ePub?
|
03-02-2009, 05:13 PM | #8 |
zeldinha zippy zeldissima
Posts: 27,827
Karma: 921169
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
|
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.
|
03-02-2009, 05:25 PM | #9 |
Resident Curmudgeon
Posts: 75,912
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I'll give it a go. Thanks!
|
03-02-2009, 05:26 PM | #10 | |
Jackass Crazyfish
Posts: 7
Karma: 10
Join Date: Jan 2007
Location: St. Petersburg, Florida, US
Device: Sony Reader PRS-505
|
Quote:
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% ; } -=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=- 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) |
|
03-02-2009, 05:55 PM | #11 |
Resident Curmudgeon
Posts: 75,912
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
It works the same on the 505 as it does on the 700.
|
03-02-2009, 05:56 PM | #12 |
zeldinha zippy zeldissima
Posts: 27,827
Karma: 921169
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
|
|
Tags |
epub font mimetype |
|
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 |