View Full Version : Another font embedding problem


b.tarde
03-01-2010, 07:29 PM
This is driving me a little crazy. I've made an e-pub with embedded fonts, and it displays correctly in Calibre and ADE. I've read the thread from last December recommending testing by loading a page from the unzipped epub in FireFox: I've done that, and the font gets displayed correctly. The epub validates with epubcheck and the CSS validates as version 3 in the W3C validator. But the font does not get displayed in the FireFox EPubReader. So what can be going on? Here are the the @font-face declarations:

@font-face{font-family: JunWeb;
font-weight: normal;
font-style: normal;
src: url("JunWeb-Regular.ttf") format("truetype");}
@font-face{font-family: JunWeb;
font-weight: bold;
font-style: normal;
src: url("JunWeb-Bold.ttf") format("truetype");}
@font-face{font-family: JunWeb;
font-weight: normal;
font-style: italic;
src: url("JunWeb-Italic.ttf") format("truetype");}
@font-face{font-family: JunWeb;
font-weight: bold;
font-style: italic;
src: url("JunWeb-BoldItalic.ttf") format("truetype");}

And the invocation of the font:

body {font-family: JunWeb, serif;}

And in case anyone want to look at this in context, I've posted the whole epub here:

http://faculty.virginia.edu/OldEnglish/secret/oeg.epub

I'd hugely appreciate any advice here. EPubReader is a terrific add-on, and I'd like to get my files to work correctly with it!

Thanks,
Peter

mikelv
03-02-2010, 06:03 AM
This is driving me a little crazy. I've made an e-pub with embedded fonts, and it displays correctly in Calibre and ADE. I've read the thread from last December recommending testing by loading a page from the unzipped epub in FireFox: I've done that, and the font gets displayed correctly. The epub validates with epubcheck and the CSS validates as version 3 in the W3C validator. But the font does not get displayed in the FireFox EPubReader. So what can be going on?
Hi Peter, thanks for your feedback!

I had a look at your ePub and must admit that I couldn't see a difference between loading it in EPUBReader and loading it in FF directly.

I guess you have checked the FF option for embedded fonts, because you say you can see the right font when you open it in FF directly.

Please post a screenshot from Calibre or ADE and from EPUBReader. Please mention additionally which page you opened.

b.tarde
03-02-2010, 09:05 AM
Thanks for the quick reply. Here's ADE:

http://faculty.virginia.edu/OldEnglish/secret/ADE.jpg

And here's Calibre:

http://faculty.virginia.edu/OldEnglish/secret/calibre.jpg

Calibre has got issues of its own: this version does not display italics (an acknowledged bug), and it looks as if it may be having trouble with bold as well. But it is loading the embedded font(s).

The font is definitely embeddable (Open Source, etc.), but I've double-checked just to make sure.

mikelv
03-02-2010, 09:48 AM
Thanks for uploading.

Attached you find a screenshot how it looks like in EPBUReader. If I open the file directly in FF, I can see no difference. This would mean, if there is a problem, it's not a special EPUBReader problem, but a FF problem.

Okay, perhaps I'm blind, but I can't see a big difference between my screenshot and your screenshots ;). Where do you see a problem?

b.tarde
03-02-2010, 10:12 AM
You're not blind: you are definitely seeing the correct font. And I'm completely flummoxed, for I am definitely *not* seeing the correct font in FF 3.6/Mac or FF 3.5.x/Linux. Here's what I'm seeing (sorry I haven't figured out that neat thumbnail thing):

http://faculty.virginia.edu/OldEnglish/secret/epubreader.jpg

Definitely Times. My copy of FF is set to allow pages to choose their own fonts: and they do! I suppose there must be a difference in my configuration directory somewhere. But where?

b.tarde
03-02-2010, 12:23 PM
Further notes:

I've tried this with other Open Source fonts (Gentium, DejaVu): no dice.

I've cleaned out the Mac font cache and restarted the computer: no dice.

I've tried it out in a new, clean user account: no luck.

I am completely flummoxed.

mikelv
03-02-2010, 01:12 PM
I think I found the reason for the problem. Because the font you use seems to be very similar to Times, I didn't see that the pages in EPUBReader look different than the one directly in FF ;).

It is probably caused by this statement in EPUBReader's css-file:

"font-family: parent !important;"

This statement is used for "body, div, span, p". The css is applied to the pages of the epub-file. I've added this line because the users should be able to change the font of the epub. If the users want to have "arial", "parent" is replaced by "arial" and everything works fine.

"parent" is used, when the font defined in the book should be used. Obviously seems "parent" not the right value to reach this goal. Any idea which is the right value?

Sorry for the headache this may have caused ;).

b.tarde
03-02-2010, 02:34 PM
I'm glad if my little problem ends up contributing to an improvement in EPubReader. But unfortunately my CSS is not nearly advanced enough to understand the issue, let alone help to solve it.

I'll hope for a fix in the next release.

wdonne
03-03-2010, 05:26 AM
Hello,

Those values are not supported, in which case they should be treated as "none". In understand Firefox doesn't understand it and hence uses the default display type, which is "inline". A simply way to implement this is to scan all CSS-files and replace those values with "none". You don't even need a proper CSS-parser for this.

Best regards,

Werner.

vizca
03-09-2010, 09:18 AM
Hi, sorry, i forget my inglish, but i will try ;)

Don't use embebed fonts.

The philosophy of epubs is that can be readed in all platforms. If you embebed the font, the first problem is the doc size, and the permissions to reproduce asociated to this font (© or whatever)... ADE work properly in this cases if you did' correctly, but i think it's just the one program that can do it. Calibre ignore this fonts and use the fonts that you selected on preferences: one kind of font for serif and one for non-serif.

The first way:

If you want use fonts on epubs, try to use opentype fonts, actually are usefull than truetype. Never use postscript fonts.

I can't download your epub, so i don't know if you add the fonts nut i can read your template and i think where is the problem
Try to put a folder inside the OEBPS folder and name it “Fonts” (obviously...) and ad this lines on the template.css:
@font-face {
font-family: "Adobe Garamond Pro";
font-style: normal;
font-weight: normal;
src:url(Fonts/AGaramondPro-Regular.otf);
}

@font-face {
font-family: "Adobe Garamond Pro";
font-style: italic;
src:url(Fonts/AGaramondPro-Italic.otf);
}

@font-face {
font-family: "Adobe Garamond Pro";
font-weight: bold;
src:url(Fonts/AGaramondPro-Semibold.otf);
}

@font-face {
font-family: "Adobe Garamond Pro";
font-style: italic;
font-weight: bold;
src:url(Fonts/AGaramondPro-SemiboldItalic.otf);
}

I have used Adobe Garamond Pro for this example. Look at this line:
src:url(Fonts/AGaramondPro-SemiboldItalic.otf);

in the url camp must wirte the corect route to the FONTS folder, just the folder place inside OEBPS.

If you need a example, write me a pm and i will send you a complet epub... :)

Second way:

Maybe the problem is that you only want to use italics and bolds fonts.

How to explain?... i'll try to resume.

Use character stiles on your program (i use Indesign) for bold and italic; use paragraph styles to try to mantein the paragraph structure. Them export the doc like ADE including the styles like template.

You will lose all the styles, but everything (paragraphs and characters) are marked now. Open the template in Dreamwaver, Coda or oxygen and change the span like this:

span.italic {
font-style:italic;
}
span.bold-italic{
font-weight:bold;
font-style:italic;
}
span.bold{
font-weight:bold;
}

Look that i named the span like the style but you can use span.anothername but is the same name used on the character/paragraph styles Indesign palettes

Save, close, and compress the MIMETYPE, META-INF and OEBPS in zip format. rename the extension with epub and voila!

Finally always try the epub in other system or ereader hardware.

I know that this methods are less friendly, but is the way that report better results. Maybe you do something similar

Espero que te sea de ayuda (I hope that help you)

Un saludo.

b.tarde
03-09-2010, 10:27 AM
Thanks for the feedback. I've read in various places that it's bad form to embed fonts, but in some cases it's unavoidable. My book uses phonetic characters and other odd things that aren't found on all systems. ADE in particular is infamous for its extremely limited character set: it won't even display Eastern European languages properly. It's often pointed out that Math and science texts need embedded fonts.

I can't help wondering where the recommendation that epubs use .otf fonts comes from. I've seen it in the Adobe specs, and that's no surprise, since that's what Adobe sells; but my TrueType font works well in ADE and (mostly) Calibre. Does anyone know why it's so often stated that .otf fonts are preferable in epubs? i don't get it.

I tried various directory arrangements while working with this problem, on the theory that EPubReader or Firefox was being picky about their locations: nothing made any difference. And it seems pretty well established now that there's a problem in the CSS that ships with EPubReader.

Finally I'll just say that if our excellent developer wants any help testing a fix, I'll be more than glad to help!

mikelv
03-11-2010, 08:51 AM
Finally I'll just say that if our excellent developer wants any help testing a fix, I'll be more than glad to help!

I've created a special version which doesn't change the font in the EPUBReader css. If you still don't see your font with this version, it's not a problem caused by EPUBReader. If you like to try it, please send me a private message with your emailaddress.

mikelv
03-11-2010, 02:40 PM
I've created a special version which doesn't change the font in the EPUBReader css. If you still don't see your font with this version, it's not a problem caused by EPUBReader. If you like to try it, please send me a private message with your emailaddress.

Peter made some tests with this version and the problem seems to be fixed. The fix will be available in the next official version.