MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Calibre (https://www.mobileread.com/forums/forumdisplay.php?f=166)
-   -   Embedding fonts with Sigil and Calibre (https://www.mobileread.com/forums/showthread.php?t=79735)

JaneFancher 04-08-2010 10:38 PM

Embedding fonts with Sigil and Calibre
 
I'm posting here, hoping maybe somebody has some ideas.

I'm having mixed success in embedding my fonts into my epub files. I make a nice clean html file of my entire book. Views perfectly in FireFox. I import the html into Calibre, add cover and metadata and convert to epub.

I import the file into Sigil and while special fonts don't show in Calibre, the .Calibre* definitions appear in the generated style.css file. I import the font files into the font folder and add the following to the style.css file (bold is the calibre generated code:

@namespace h "http://www.w3.org/1999/xhtml";


.calibre {
display: block;
font-family: "Times New Roman", serif;
font-size: 1em;
font-style: normal;
font-weight: normal;
margin-bottom: 0;
margin-left: 5pt;
margin-right: 5pt;
margin-top: 0;
page-break-before: always;
text-align: justify
}

@font-face {
font-family: "Vivaldi", cursive;
font-style: normal;
font-weight: normal;
src:url(../Fonts/Vivaldii.TTF) format(opentype);;
}

@font-face {
font-family: "Trajan Pro", serif;
font-style: normal;
font-weight: normal;
src:url(../Fonts/TrajanPro-Bold.otf) format(opentype);;
}

@font-face {
font-family: "HansonsHand", sans-serif;
font-style: normal;
font-weight: normal;
src:url(../Fonts/HANSON-H.TTF) format(opentype);;
}

@font-face {
font-family: "Schwarzwald", sans-serif;
font-style: normal;
font-weight: normal;
src:url(../Fonts/SCHWARZW.TTF) format(opentype);;
}

@font-face {
font-family: "BankGothic Md BT", sans-serif;
font-style: normal;
font-weight: normal;
src:url(../Fonts/BNKGOTHM.TTF) format(opentype);;
}

@font-face {
font-family: "Brush Script MT Italic", cursive;
font-style: normal;
font-weight: normal;
src:url(../Fonts/BRUSHSCI.TTF) format(opentype);;
}

.calibre1 {
display: block;
font-size: 2em;
font-weight: bold;
margin-bottom: 0.67em;
margin-left: 0;
margin-right: 0;
margin-top: 0.67em;
page-break-before: always;
text-align: justify;
text-indent: 0.2in
}


Saving down, this epub file looks perfect in mobipocket and firefox epub reader, but when I bring it back into Calibre, the special fonts don't show and the default font has suddenly gone huge and bold...almost like h1, but I've checked all the files and there are not orphan h1 or h2 tags.

Does anyone have any idea what might be going on?

Many thanks

JaneFancher 04-09-2010 01:35 AM

Update: I got to really looking at the handful of paragraphs showing correctly in Calibre and found a single code that they [I]didn't[I] have in common with the paragraphs appearing incorrectly. It was an apparently extraneous font definition. Extraneous because the "body style" description should have taken care of that.

So...I wiped that one line and got it out of the way of the default font and everything seems ok now in Calibre, at least, although it still doesn't show the specialty fonts.

More confusingly...I wonder why the problem didn't show up until I put the @font code in.

For the record, I wrote my original file in WordPerfect. When I published to html, WP put a font style code in every paragraph, as well as a default font style at the top of the file. Department of redundancy department. That is the source of the extraneous style code.

Anyway, just a heads up for anyone trying to do this font embedding stuff.


All times are GMT -4. The time now is 06:53 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.