10-22-2008, 02:12 PM | #1 |
Member
Posts: 19
Karma: 10
Join Date: Oct 2008
Device: Sony PRS-505
|
Embedding fonts in EPUB?
I'm creating some EPUB files using html2epub. Is it possible to embed a font to be used? If so, how? Thanks in advance...
|
10-22-2008, 02:57 PM | #2 |
creator of calibre
Posts: 44,551
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Not yet...
|
Advert | |
|
10-22-2008, 04:00 PM | #3 |
reader
Posts: 6,975
Karma: 5183568
Join Date: Mar 2006
Location: Mississippi, USA
Device: Kindle 3, Kobo Glo HD
|
If you are targeting your own PRS-505, an alternative might be ePub with external font. Referencing an external font is less practical for wide distribution, although an embedded font is replicated in every ePub that uses it (a huge waste of resources).
|
10-22-2008, 04:20 PM | #4 |
creator of calibre
Posts: 44,551
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
embedding an external font is pretty simple with the --override-css option.
|
10-23-2008, 04:24 PM | #5 |
Lector minore
Posts: 655
Karma: 1738720
Join Date: Jan 2008
Device: Aura One, Paperwhite Signature
|
|
Advert | |
|
10-23-2008, 04:42 PM | #6 |
creator of calibre
Posts: 44,551
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Code:
--override-css "@font-face {font-family: "f1";src:url(res:///Data/FONT/tt0003m_.ttf);}\n\nbody {font-family: f1}" |
10-29-2008, 05:09 PM | #7 |
Lector minore
Posts: 655
Karma: 1738720
Join Date: Jan 2008
Device: Aura One, Paperwhite Signature
|
Excellent; thank you!
|
02-01-2009, 04:28 PM | #8 | ||
Pulps and dime novels...
Posts: 343
Karma: 1952003
Join Date: Jan 2009
Device: Kobo Aura/Kobo Aura One LE/iPad Air
|
Just found this thread. I posted the following in the "EPUB output" sticky yesterday, but thought it might be worth cross-posting here in case anyone is able to test whether the following approach will actually work on the Sony PRS-505 or PRS-700 (basically the external font approach, but using TrueType fonts stored within the .epub itself):
Quote:
Quote:
If anyone wants to donate a PRS-505 or PRS-700 to me, I'd be happy to test further on this end! In the book I authored this morning, I used three separate TrueType fonts: David Rakowski's "UpperWestSide" for titles, chapter headings and drop-caps, Monotype Typography, Ltd's "Garamond" and the italicized version of same. When I originally tried a direct conversion, Calibre would only add the first noted font. In order to convince Calibre to import all the three .ttf files into the .epub, I placed each within its own style element in the XHTML - and I also gave "UpperWestSide" an oblique style, since there were certain places I had artificially italicized the font within the text, although I linked it to the same font file - as follows: Code:
<style type="text/css"> @font-face { font-family: UpperWestSide; font-style: oblique; font-weight: normal; src: url(UpperWestSide.ttf); } </style> <style type="text/css"> @font-face { font-family: UpperWestSide; font-style: normal; font-weight: normal; src: url(UpperWestSide.ttf); } </style> <style type="text/css"> @font-face { font-family: Garamond; font-style: normal; font-weight: normal; src: url(gara.ttf); } </style> <style type="text/css"> @font-face { font-family: Garamond; font-style: oblique; font-weight: normal; src: url(garait.ttf); } </style> Next I opened the .epub file as if it were a .zip (no need to rename, just open it in whatever utility you would use to view the contents of any other .zip). Browsing the directory structure I saw that all three .ttf fonts were located in "content\resources," but when I checked the relative path structure in (name)_0.css I discovered that the font links were erroneously pointing to a recursive "resources" directory, as follows: Code:
@font-face { font-family: UpperWestSide; font-style: oblique; font-weight: normal; src: url(resources/UpperWestSide_0_0.ttf) } @font-face { font-family: UpperWestSide; font-style: normal; font-weight: normal; src: url(resources/UpperWestSide_0_0.ttf) } @font-face { font-family: Garamond; font-style: normal; font-weight: normal; src: url(resources/gara_1_1.ttf) } @font-face { font-family: Garamond; font-style: oblique; font-weight: normal; src: url(resources/garait_2_2.ttf) } Code:
@font-face { font-family: UpperWestSide; font-style: oblique; font-weight: normal; src: url(UpperWestSide_0_0.ttf) } @font-face { font-family: UpperWestSide; font-style: normal; font-weight: normal; src: url(UpperWestSide_0_0.ttf) } @font-face { font-family: Garamond; font-style: normal; font-weight: normal; src: url(gara_1_1.ttf) } @font-face { font-family: Garamond; font-style: oblique; font-weight: normal; src: url(garait_2_2.ttf) } - M. |
||
02-03-2009, 05:15 PM | #9 | |
Pulps and dime novels...
Posts: 343
Karma: 1952003
Join Date: Jan 2009
Device: Kobo Aura/Kobo Aura One LE/iPad Air
|
Quote:
- M. |
|
02-27-2009, 12:07 AM | #10 | |
Jackass Crazyfish
Posts: 7
Karma: 10
Join Date: Jan 2007
Location: St. Petersburg, Florida, US
Device: Sony Reader PRS-505
|
Quote:
— @yg -=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=- Cygfrydd Llewellyn | cygfrydd@gmail.com -=<>=-=<>=-=<>=-=<>=-=<>=-=<>=-=<>=- “Worlds only harmonica-playing dog. Tuppence.” — Gaspode the wonder dog (Terry Pratchett, Moving Pictures) |
|
04-20-2010, 03:26 AM | #11 |
Zealot
Posts: 109
Karma: 556
Join Date: Nov 2009
Location: SaiGon VietNam
Device: PRS T1, Kobo Forma 8G, Kobo Libra H2O
|
|
07-24-2010, 10:23 PM | #12 |
Connoisseur
Posts: 98
Karma: 161
Join Date: May 2010
Location: Quebec, Canada
Device: PRS-600
|
|
07-24-2010, 11:50 PM | #13 |
creator of calibre
Posts: 44,551
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Put it in the extra css box in conversion settings under look & Feel
|
07-25-2010, 12:11 PM | #14 |
Connoisseur
Posts: 98
Karma: 161
Join Date: May 2010
Location: Quebec, Canada
Device: PRS-600
|
|
11-03-2011, 12:12 AM | #15 |
Zealot
Posts: 109
Karma: 556
Join Date: Nov 2009
Location: SaiGon VietNam
Device: PRS T1, Kobo Forma 8G, Kobo Libra H2O
|
I have problem with my new PRS T1. I do convert in the same way that I used to do with my PRS 650:
- Add extrac css as below: @font-face { font-family: "Gentium Book"; font-weight: normal; font-style: normal; src: url(res:///Data/fonts/GenBkBasR.ttf); } @font-face { font-family: "Gentium Book"; font-weight: bold; font-style: normal; src: url(res:///Data/fonts/GenBkBasB.ttf); } @font-face { font-family: "Gentium Book"; font-weight: normal; font-style: italic; src: url(res:///Data/fonts/GenBkBasI.ttf); } @font-face { font-family: "Gentium Book"; font-weight: bold; font-style: italic; src: url(res:///Data/fonts/GenBkBasBI.ttf); } body { font-family: "Gentium Book", serif; } - Copy all gentium font files to fonts folder in root directory of the reader. But PRS T1 still cannot display correctly Vietnamese characters. (PRS 650 display well) |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Embedding fonts | JaneFancher | Calibre | 14 | 04-10-2010 10:28 PM |
Embedding fonts | AprilHare | ePub | 6 | 01-02-2010 12:42 PM |
Embedding fonts into PDFs | lordsilent | 2 | 03-20-2009 06:51 AM | |
Embedding Fonts with Indesign...... | brewt | ePub | 6 | 01-01-2009 11:07 PM |
Embedding fonts | jash | Calibre | 2 | 09-09-2008 06:05 PM |