![]() |
#1 |
Connoisseur
![]() Posts: 66
Karma: 10
Join Date: Jul 2023
Device: None
|
CSS font error in Calibe
-- CSS font error in Calibe --
Greetings, I validated again and I still get the same error in Calibre. The font displays as expected yet I keep getting the font related error, but only in Calibre. Can anyone shed any light on this? Thanks, WV-Mike ==== Pagina: Validating using EPUB version 2.0.1 rules. (https://github.com/w3c/epubcheck) September 18, 2023 6:20:38 AM EDT No errors or warnings detected. EPUB is valid! ===== https://www.ebookit.com/tools/bp/Bo/...epub-validator No errors reported ===== Calbre OEBPS/Styles/mnc_toc.css The font family name specified in the CSS @font-face rule: "Fontin-SmallCaps" does not match the font name inside the actual font file: "Fontin SmallCaps". This can cause problems in some viewers. You should change the CSS font name to match the actual font name. Change the font name Fontin-SmallCaps to Fontin SmallCaps everywhere ==== Here is the font file: C:\Users\defaultuser0.LAPTOP-5UQ4L9LI.000\AppData\Local\sigil-ebook\sigil\workspace\Sigil-mEHozG\OEBPS\Fonts\Fontin-SmallCaps.otf Here is the CSS: h1 { font-family: "Fontin-SmallCaps", sans-serif; font-size: 1.3em; font-weight: bold; text-align: center; margin-top: 0; } @font-face { font-family: "Fontin-SmallCaps"; font-weight: bold; font-style: normal; font-variant: small-caps; src: url(../Fonts/Fontin-SmallCaps.otf); } |
![]() |
![]() |
![]() |
#2 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 71,903
Karma: 122094787
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Drop the font-variant in the @font-face. That's incorrect.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Connoisseur
![]() Posts: 66
Karma: 10
Join Date: Jul 2023
Device: None
|
CSS font error in Calibe
|
![]() |
![]() |
![]() |
#4 | |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,890
Karma: 18274621
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2 & Air/Surface Pro/Kindle PW
|
JSWolf is correct. Font-variant does not go in the @font-face declaration it goes in the css for the style you wish to apply.
Example from your code: Code:
h1 {
font-family: "Fontin-SmallCaps", sans-serif;
font-variant: small-caps;
font-size: 1.3em;
font-weight: bold;
text-align: center;
margin-top: 0;
}
@font-face {
font-family: "Fontin-SmallCaps";
font-weight: bold;
font-style: normal;
src: url(../Fonts/Fontin-SmallCaps.otf);
}
As for the Calibre warning… just read what it says. Your font name declaration is not the same as the internal name IN the font. You may have problems. It tells you to change the font name to match. Quote:
font-family: "Fontin SmallCaps"; Last edited by Turtle91; 09-18-2023 at 07:46 AM. |
|
![]() |
![]() |
![]() |
#5 | |
Connoisseur
![]() Posts: 66
Karma: 10
Join Date: Jul 2023
Device: None
|
Quote:
src: url(../Fonts/Fontin-SmallCaps.otf); h1 { font-family: "Fontin-SmallCaps", sans-serif; Thanks, WV-Mike |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 71,903
Karma: 122094787
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,252
Karma: 82988365
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Oasis 2, iPad, Nexus 7
|
The file name (src url) is not the same as the actual name of the font. In your case the file name is "Fontin-SmallCaps.otf", but it could be anything you want. The actual name of the font as encoded within the file is "Fontin SmallCaps".
|
![]() |
![]() |
![]() |
#8 | |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,890
Karma: 18274621
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2 & Air/Surface Pro/Kindle PW
|
Quote:
filename: "Fontin-SmallCaps.otf" internal metadata name: "Fontin SmallCaps" @font-face declaration: "Fontin-SmallCaps" Filename doesn't matter. What matters is the font-face declaration does not match the internal metadata name. This MAY cause an issue on SOME readers. To be safe though it is better to make them the same by changing the declaration and any references to match the internal name: Code:
font-family: "Fontin SmallCaps", sans-serif; Last edited by Turtle91; 09-18-2023 at 09:22 AM. |
|
![]() |
![]() |
![]() |
#9 | |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,890
Karma: 18274621
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2 & Air/Surface Pro/Kindle PW
|
Quote:
Besides, it doesn't really matter if you use the font-variant:small-caps style on a font that is a small-caps font...it doesn't change anything, and it doesn't throw an error. |
|
![]() |
![]() |
![]() |
#10 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 71,903
Karma: 122094787
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#11 | |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,890
Karma: 18274621
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2 & Air/Surface Pro/Kindle PW
|
No, I said:
Quote:
As far as displaying properly, try it... It is the same philosophy as putting an <i> or <em> tag in an area that is using an italics font...not necessary, but it doesn't hurt. And, if you decide to change the font at some point it still displays as italic. |
|
![]() |
![]() |
![]() |
#12 | |
Connoisseur
![]() Posts: 66
Karma: 10
Join Date: Jul 2023
Device: None
|
Quote:
I still don't get why the font names (Fontin-SmallCaps.otf/Fontin SmallCaps) don't have to match. I will have to cogitate on that. I know it was explained to me but that doesn't mean I understand stand it. The story of my life... ![]() Regardless, I made the changes and there is no long an error in Calibe. Thanks to all for their time and patience. WV-Mike |
|
![]() |
![]() |
![]() |
#13 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 313
Karma: 5743642
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe
|
Quote:
"Fontin SmallCaps" is a name of the font in the font data inside the file. It does not have to match the filename, or anything else. There is more than one font name inside the font file, because of historical reasons (Apple had their own way of naming fonts, so one of the extra names is there for compatibility with older MacOS versions). It is rare for all the font names in the font file to match each other, and your EPUB checker is only talking about one of them, so it's wrong from the start. There is also a font name that you specify in the @font-face declaration: Code:
font-family: "Fontin SmallCaps"; Code:
.myclass { font-family: "Fontin SmallCaps"; } The @font-face declaration is used to tell the renderer about the characteristics of the font in the file. That declaration is the final arbiter, and does not have to reflect what is actually in the font file. The renderer will believe whatever you put in the declaration. So, if you declare the font to be "Fontin-SmallCaps" and always refer to it that way, it will work, regardless of what is in the font file. |
|
![]() |
![]() |
![]() |
#14 | |
Connoisseur
![]() Posts: 66
Karma: 10
Join Date: Jul 2023
Device: None
|
Quote:
This a new realm for me and the rules seem different than what I am used to. WV-Mike |
|
![]() |
![]() |
![]() |
#15 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 850
Karma: 4091120
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
I've come across this error a few times also. Sometimes I have ignored it, other times I have modified the metadata of the font file.
I am no expert on fonts, but as far as I can tell, if you check the internal metadata of the font file using something like FontForge or similar, you can check the internal naming. I am not really sure which field is used, but looks like "Name for Humans" is the correct font name. Maybe one of the guru's could confirm? But for this particular font, it seems to be full of errors according to the warnings in FontForge -Edit- I gave up on using smallcaps fonts. Instead I use, when necessary, fake smallcaps... PHP Code:
Last edited by Karellen; 09-18-2023 at 04:21 PM. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
What font is best to use for viewing CSS in Sigil? | Rindr | Sigil | 5 | 03-26-2019 02:33 PM |
CSS: Spans vs Font Families | SigilBear | ePub | 32 | 06-17-2017 08:00 PM |
ADE breaks CSS --> CSS Validation: Parse Error / Value Error | dasboeh | ePub | 4 | 12-10-2012 03:25 AM |
CSS: font-family fallbacks | ElMiko | Sigil | 4 | 02-08-2012 03:43 PM |
Font fail with Epub CSS | gregcd | Sony Reader | 0 | 10-28-2010 03:45 PM |