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

Go Back   MobileRead Forums > E-Book Readers > Sony Reader > Sony Reader Dev Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 04-29-2014, 07:11 AM   #1
Korben Dallas
Junior Member
Korben Dallas began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Dec 2010
Device: Sony Reader PRS-350
Sony PRS-T3 Custom Fonts Tutorial

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.
Korben Dallas 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
Custom Fields as Collections on Sony PRS-600? eosrose Library Management 0 11-05-2011 05:39 PM
Touch Fonts question (special characters in stock and custom fonts) levil Kobo Reader 20 09-23-2011 01:51 PM
Sony PRS 950 System Font Mod tutorial jessie102 Sony Reader 7 12-26-2010 07:06 AM
Sony PRS-505 Visual tutorial? Amalthia Sony Reader 2 02-12-2009 01:10 PM
Ended Custom Sony Prs-505 Book Light aapezzuto Flea Market 9 04-24-2008 02:08 PM


All times are GMT -4. The time now is 07:10 PM.


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