View Single Post
Old 01-04-2011, 09:59 PM   #39
Junior Member
artshim began at the beginning.
Posts: 2
Karma: 10
Join Date: Jan 2011
Device: kobo
Modification? Version 3?

Originally Posted by P.T View Post
I created a simple plugin for Calibre that embeds fonts into epub as a part of the conversion process.

Any feedback is welcome.

I put some additional code for some more flexibility. Below are usage,

* To use proper font, the resources folder need to be populated with following rule, please take a look the sample.bmp
- Parent folder for the fonts : Under Calibre installation folder, \resources\fonts
- font folder name : All smaller case, the font name like liberation
- font files in the folder : font family name + -Regular, -Italic, -BoldItalic, -Bold (Should have all 4 with proper name)
-As an example, additional Droid fonts can be located under C:\Program Files\Calibre2\resources\fonts\droid. In this case droid(all smaller case) is the font name. The font files in this folder are DroidSerif-Regular.ttf, DroidSerif-Italic.ttf, DroidSerif-BoldItalic.ttf, DroidSerif-Bold.ttf. In this case DroidSerif is font family name(font name + decal). The font file names are case-sensitive. The plugin will not work if there are no font files.
* The ExtraCss will be like this. Please note that the font-family name is the font name from the file name. So far this is what I can do without making big changes(same naming convention, folder location from liberation font)

body {
	font-family: "DroidSerif";
* Advanced : You can put DroidSans under same folder. But the font file name should be some like DroidSans-Regular.ttf etc.

* Advanced : You can put any free font from Internet. As an example, if you downloaded SantaSerif, the folder name should be santa. And 4 style fonts need to be saved under the folder as SantaSerif-Regular.ttf, SantaSerif-Italic.ttf, SantaSerif-BoldItalic.ttf, SantaSerif-Bold.ttf. All the remains are change the EXTRA-CSS.

Thank you.
Attached Images
File Type: bmp sample.bmp (169.0 KB, 1251 views)
Attached Files
File Type: zip (1.9 KB, 1859 views)
artshim is offline   Reply With Quote