View Single Post
Old 11-13-2016, 10:30 PM   #24
nabsltd
Fanatic
nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.
 
Posts: 528
Karma: 9529956
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe, Kindle 4 Touch
Quote:
Originally Posted by JSWolf View Post
As for font weight, don't use a number. It usually doesn't work.
Except for when you have to, like if the "Bold" font is actually "demi" (weight 600) instead of "bold" (weight 700). Or, if the "normal" version is actually "medium" (like all the DejaVu fonts) in the font file. Then, you must use weight of 500 instead of "normal" (which is 400).

This, in a nutshell, is exactly why requiring the CSS selector exactly match the font on disk before it can be embedded is the wrong way to do it. 99% of the time, we know exactly what font file we want to embed, and can then write CSS that matches it after it is embedded.

Or, you can just "lie" in the CSS and make sure things match. This is how every ebook produced by the big publishing companies does it, like this snippet from one:
Code:
@font-face {
font-family: "MinionPro-SemiboldCnIt";
font-style: normal;
font-weight: normal;
src:url("../fonts/00004.otf");
}

span.font2 {
font-family: "MinionPro-SemiboldCnIt";
}
Given the CSS selector, Calibre wouldn't find the font that was actually embedded in the ebook, instead requiring the following selector (I know, because I have that font, straight from Adobe, and that's what it took to match it, because that's what's in the font file):
Code:
span.font2 {
font-family: "Minion Pro";
font-weight: 600;
font-stretch: condensed;
}
And, yet, the CSS in the ebook worked perfectly, and the font showed up where it was supposed to.
nabsltd is offline   Reply With Quote