Key to referencing your custom fonts from within an ePub is the understanding how the reader device interprets paths:
When you connect your reader to your computer it shows up as two drives:
Code:
READER (F:)
SETUP (G:)
On the READER drive you will find a directory structure containing your Books:
Code:
READER (F:)
+ Sony_Reader
+ database
+ Digital Editions
+ media
+ books
+ images
+ notepads
As you may have guessed your books are located in
Code:
F:\Sony_Reader\media\books\…
as seen from the windows point of view.
As seen from inside your Android T3 device this path translates to
Code:
/ebook/fonts/../../mnt/sdcard/Sony_Reader\media\books\…
(Remember that Android is after all just another linux flavor using slashes instead of backslashes. Also remember case sensitivity.)
Knowing this we can start our home run. Whatever directory structure you create on your device, it's always known to your T3 as prefixed with
Code:
/ebook/fonts/../../mnt/sdcard/
Now we can create a directory under F:\ containing the fonts:
Code:
READER (F:)
+ Sony_Reader
+ fonts
+ myfonts
In the
fonts directory create a file named
mycustomfonts.css referencing your font files in
myfonts:
Code:
/* Sans-Serif Fonts */
@font-face {
font-family: sans-serif;
font-weight: normal;
font-style: normal;
src: url(res:///ebook/fonts/../../mnt/sdcard/fonts/myfonts/Candara.ttf);
}
@font-face {
font-family: sans-serif;
font-weight: bold;
font-style: normal;
src: url(res:///ebook/fonts/../../mnt/sdcard/fonts/myfonts/Candarab.ttf);
}
@font-face {
font-family: sans-serif;
font-weight: normal;
font-style: italic;
src: url(res:///ebook/fonts/../../mnt/sdcard/fonts/myfonts/Candarai.ttf);
}
@font-face {
font-family: sans-serif;
font-weight: bold;
font-style: italic;
src: url(res:///ebook/fonts/../../mnt/sdcard/fonts/myfonts/Candaraz.ttf);
}
Repeat the block above as necessary varying
font-family: and
src: accordingly.
Now we are done with the creation of the underlying font infrastructure. All that remains to do is make your newly installed fonts known to the reader application. Don't worry—that's easy.
All we have to do is referencing our
mycustomfonts.css stylesheet from inside our ePubs. This we can do easily with Sigil or the calibre book editor:
Open your ePub with the Editor of your choice and insert one line at the top of the main stylesheet:
Code:
@import url('res:///ebook/fonts/../../mnt/sdcard/fonts/mycustomfonts.css');
With this we can use every font-family in our ePubs that is listed in
mycustomfonts.css.
Have fun.