View Full Version : Calibre has no choice on font size unit in css?


naisren
09-29-2012, 09:57 PM
During conversion from a recipe or an ebook to an epub, I found in all the rendered css files the font size just uses em unit, like .calibre {...font-size: 1em...}, which gives style to <body> tag in a point of fact.

When I open these epubs with Mantato ereader and the font size is very big, I have to decrease the size again and again.

To solve the problem, I tried many ways to change my extra css in the recipe, no good results at all.

After hard study, I guessed the problem is the em unit in the .calibre element, and you'll find the font size becomes normal after a change from em to % in the converted epubs as the belows, no need to edit other em in the css, just the .calibre.

Origin
.calibre {
display: block;
font-size: 1em;
margin-bottom: 0;
margin-left: 5pt;
margin-right: 5pt;
margin-top: 0;
page-break-before: always;
text-align: left
}

Change
.calibre {
display: block;
font-size: 80%;
margin-bottom: 0;
margin-left: 5pt;
margin-right: 5pt;
margin-top: 0;
page-break-before: always;
text-align: left
}

Because the Calibre converter has no choice for the unit, and I wish there would be such a unit or % choice there.

Toxaris
09-30-2012, 04:30 AM
Actually em is the best choice, but it is the same as %. In fact, 1em = 100%. If you put it on 1em, the font size is the default/standard size as defined by your reader.
You must not put it as pt or px, because then resize is no longer possible on the readers.

DiapDealer
09-30-2012, 08:24 AM
Your selected output profile in calibre has a lot to do with the base (default) font size of converted documents.

Also note that calibre has a font scaling feature that you can use for conversions. There's a wizard in the Look & Feel section of the conversion dialogue that allows you to "map" sizes from the input document to the output document.

Calibre user manual (font rescaling) (http://manual.calibre-ebook.com/conversion.html#font-size-rescaling)

naisren
09-30-2012, 09:09 AM
Actually em is the best choice, but it is the same as %. In fact, 1em = 100%. If you put it on 1em, the font size is the default/standard size as defined by your reader.
You must not put it as pt or px, because then resize is no longer possible on the readers.
Thanks for your kind reply.
1em = 100%, good point, I tried to change the .calibre font-size to 0.8em in the converted epub, the result is the same as the 80%.
Now the new problem is how to set .calibre font-size to 0.8em throught extra css, I added
body {font-size: 0.8em;}
.calibre{font-size: 0.8em;}
in the template css and extra css, but it is always 1em after the conversion through Calibre Management.

Is there a way to force the .calibre font-size is always 0.8em after the conversion?

naisren
09-30-2012, 09:33 AM
Your selected output profile in calibre has a lot to do with the base (default) font size of converted documents.

Also note that calibre has a font scaling feature that you can use for conversions. There's a wizard in the Look & Feel section of the conversion dialogue that allows you to "map" sizes from the input document to the output document.

Calibre user manual (font rescaling) (http://manual.calibre-ebook.com/conversion.html#font-size-rescaling)
Thanks for your reply.
My trouble is about how to set the font-size by less than 1em (100%) in the body tag (or in .calibre as the above), which seems an important factor to decide the font size for other tags.

DiapDealer
09-30-2012, 09:43 AM
Thanks for your reply.
My trouble is about the font-size unit in the body tag (or in .calibre as the above), which seems an important factor to decide the font size for other tags.
Your trouble is exactly what calibre's output profile and/or font scaling feature is all about.

naisren
09-30-2012, 10:41 AM
Your trouble is exactly what calibre's output profile and/or font scaling feature is all about.
Maybe you are right, I tried to believe and do as you suggest, but I could not get the font-size of 0.8em in the body tag after a conversion, no matter how I change the profile or base font-size.
I set the font-size to 0.8em in the body tag before a conversion, but it goes to 1em after the conversion. (My profiles are both default ones.)