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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 04-05-2010, 02:57 PM   #1
jswinden
Nameless Being
 
Calibre not overwriting ePub CSS font info

In the Conversion--Look and feel window, the Extra CSS field is described as follows, "Either the path to a CSS stylesheet or raw CSS. This CSS will be appended to the style rules from the source file, so it can be used to override those rules."

However, it does not work correctly for font info. For example, I've added the font Segoi UI to my Sony PRS-300. Therefore I should be able to add he following in the Extra CSS field with the result of my ePub using bold Segoi UI rather than the Sony default serif font.

@font-face {
font-family: "Segoe UI";
font-weight: normal;
font-style: normal;
src: url(res:///Data/fonts/segoeuib.ttf);
}

@font-face {
font-family: "Segoe UI";
font-weight: bold;
font-style: normal;
src: url(res:///Data/fonts/segoeuib.ttf);
}

@font-face {
font-family: "Segoe UI";
font-weight: normal;
font-style: italic;
src: url(res:///Data/fonts/segoeuiz.ttf);
}

@font-face {
font-family: "Segoe UI";
font-weight: bold;
font-style: italic;
src: url(res:///Data/fonts/segoeuiz.ttf);
}

body { font-family: "Segoe UI", sans serif; }


However, this results not in the substitution of bold Segoi UI but in the default Sony serif font.

If I copy the ePub file and rename it from *.epub to *.zip, extract it, open the CSS file and change all occurences of font-family: serif; to font-family: "Segoe UI";, re-zip the file, change the name back to *.epub, then enter the extra CSS in the Extra CSS field Calibre converts the epub so that it uses bold Segoi UI.

My whole point here is that the Calibre Extra CSS field is not able to override the epub's CSS file font-family: serif; code.
  Reply With Quote
Old 04-05-2010, 03:56 PM   #2
kiklop74
Guru
kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.
 
kiklop74's Avatar
 
Posts: 800
Karma: 194644
Join Date: Dec 2007
Location: Argentina
Device: Kindle Voyage
You are placing this in your css:

Code:
body { font-family: "Segoe UI", sans serif; }
While instead you should put this:

Code:
body { font-family: "Segoe UI",serif; }
Also you should make sure that your font definition is applied to all appropriate classes and elements. Calibre will not do that for you.
kiklop74 is offline   Reply With Quote
Advert
Old 04-06-2010, 11:54 AM   #3
jswinden
Nameless Being
 
Quote:
Originally Posted by kiklop74 View Post
You are placing this in your css:

Code:
body { font-family: "Segoe UI", sans serif; }
While instead you should put this:

Code:
body { font-family: "Segoe UI",serif; }
Also you should make sure that your font definition is applied to all appropriate classes and elements. Calibre will not do that for you.
Actually, Segoi UI is a sans serif font, so sans serif is correct. I prefer sans serif when using e-Ink.

However, you are correct about the elements. the epub had the font defined in a P element rather than the BODY element so it was overriding the BODY element definition. My bad--I should have looked more closely.

This whole ePub book was a mess. I bought it from Sony and deDRMed it. It has hundreds of footnotes linked and almost every link included the entire paragraph such that hundreds of paragraphs were completely underlined. I had to use Dreamweaver to strip out all the A element tags to make the book readable. Fortunately dreamweaver can do that for an entire folder of files and it only took a few seconds, so it was a quick fix.
  Reply With Quote
Old 04-06-2010, 12:04 PM   #4
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,406
Karma: 305065800
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
Quote:
Originally Posted by jswinden View Post
Actually, Segoi UI is a sans serif font, so sans serif is correct.

sans serif is incorrect. You can't have a space in the value. The correct name for the sans serif generic family is "sans-serif"

There are three generic family types defined in the CSS used in ePubs:
  • serif
  • sans-serif
  • monospace
pdurrant is offline   Reply With Quote
Old 04-06-2010, 01:29 PM   #5
eping
ePub Maker
eping began at the beginning.
 
eping's Avatar
 
Posts: 120
Karma: 16
Join Date: Dec 2009
Location: Mordor
Device: iPad,Kindle 3, Nook 2
Quote:
Originally Posted by jswinden View Post
This whole ePub book was a mess. I bought it from Sony and deDRMed it. It has hundreds of footnotes linked and almost every link included the entire paragraph such that hundreds of paragraphs were completely underlined.
Could you send me a sample part of this HTML?
I'm studying on the auto method of cleaning such mess,
I need plenty of examples of various dirty HTML code.
I would be appreciated, thanks.
My email box: service(at)htmlcleaner(dot)com
eping is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
epub change font calibre ploik000 Calibre 2 08-16-2010 11:34 AM
Basic CSS Font family question! kjk ePub 2 05-27-2010 01:28 PM
converting to epub with my css fbrzvnrnd Calibre 3 04-15-2010 02:46 AM
ePub to ePub - just replace CSS? ChristopherTD Calibre 21 02-11-2010 02:50 AM
Embedding Chinese font using CSS override? kome17 Calibre 0 09-18-2009 12:57 AM


All times are GMT -4. The time now is 08:07 AM.


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