08-21-2017, 08:55 AM | #1 |
Fanatic
Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
|
Strange result (font embedding)
I finished a book in calibre, and I wanted to embed a font since the text contains also other characters than ASCII and their support may vary.
I remember that this is a PITA and somehow it looks to me a question of chance rather than method. I know that somehow I manage this, yet the time outs between these results lays a memory-erase blanket upon my mind - I simply do not remember how I did it. As always I instruct calibre to embed fonts, and it does. Then I subset it, to save some space. Usually the problems appear to be linked to the missing style, either Bold or Italic, or the Bold-Italic. In this case however, only two characters of a word are shown in Italic, both the same é, but not the rest of the word. In other places, the Italics are not observed at all (it should have been 076.384 Universitate Has anyone of you ever met this strange situation? And if yes, is there any explanation and a cure? |
08-21-2017, 09:44 AM | #2 |
Fanatic
Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
|
It is important to add that the font used has 4 variants for each format.
So far, the only solution I have found is to rename in CSS the name of the font to differ, for instance from Georgia to GeorgiaBold or to GeorgiaItalic accordingly- yet this is not a perfect solution, because the changed name does no longer reflect the internal name. |
Advert | |
|
08-21-2017, 01:24 PM | #3 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
That should not be required. Perhaps it is an unexpected result of the subsetting feature of Calibre. Why don't you open an issue there to see if it is?
|
08-21-2017, 02:18 PM | #4 |
Resident Curmudgeon
Posts: 73,645
Karma: 127838196
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Code:
@font-face { font-family: Georgia; font-style: normal; font-weight: normal; src: url(../fonts/georgia.ttf); } @font-face { font-family: Georgia; font-style: normal; font-weight: bold; src: url(../fonts/georgiab.ttf); } @font-face { font-family: Georgia; font-style: italic; font-weight: normal; src: url(../fonts/georgiai.ttf); } @font-face { font-family: Georgia; font-style: italic; font-weight: bold; src: url(../fonts/georgiabi.ttf); } |
08-22-2017, 04:31 AM | #5 |
Fanatic
Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
|
Well, the fonts.css automatically generated by calibre (I assume calibre knows how to generate embedded fonts, shouldn't it?) is similar.
Apparently, the subsetting of fonts does something wrong. If I keep the fonts as they are, everything is as it should. After subsetting, sometimes the Italics go wrong, othertimes Bolded ones go wrong, and the damn thing, the preview in calibre does not give any hint, as it is displayed as I intended, only to find the error hours and days later when reading on the Sony. I'll see deeper in the matter, and when I'm finished I'll write a definitive guide to embedding fonts - as I couldn't find any before asking this question. Yes, there are questions answered, but not a guide to prevent such questions asked in the future. |
Advert | |
|
08-22-2017, 04:39 PM | #6 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
I often use Calibre to transform epubs to Kindle format, and it does that quite well. I would never use it to format a book for publication, if that's what you're doing.
|
08-22-2017, 05:07 PM | #7 |
Resident Curmudgeon
Posts: 73,645
Karma: 127838196
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Please post the CSS so we can see what might be going on.
Is your code in the XHTML files just spanning the special characters or the entire words? Are you using the embedded fonts as the font for the entire eBook? |
08-23-2017, 06:03 AM | #8 |
Fanatic
Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
|
I rarely mix up fonts in ePubs, for a simple reason - it's hard to line them up if one needs this.
So, yes, it's the main font - and I embed it only because I need to be sure all non-ASCII characters are correctly displayed. The method I use is to do the book, and at the end, to do the font embedding - using the calibre's own macro/function. After I check by sampling whether the letters are OK, I do the subset. Sometimes, calibre adds a second font definition (the first being added during embedding). I am still investigating this behaviour. What I did in the past was to have the fonts.css and the fonts renamed as calibre does in a special directory and to import both (or all of them, should they have different names for each format) in ePub. I know that most issues are related to improper addressing the fonts. |
08-23-2017, 07:41 AM | #9 |
Resident Curmudgeon
Posts: 73,645
Karma: 127838196
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
There's nothing anyone can do to maybe help if you do not post the CSS.
|
08-23-2017, 09:08 AM | #10 |
Fanatic
Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
|
There's no difference except the fonts' name. The font names have been changed by calibre, that's they are different from yours. I added the ; myself to the last line.
Code:
@font-face { src: url(fonts/Georgia-Bold.ttf); font-weight: bold; font-family: "Georgia"; font-style: normal; } @font-face { font-style: italic; src: url(fonts/Georgia-Bold-Italic.ttf); font-weight: bold; font-family: "Georgia"; } @font-face { font-style: italic; src: url(fonts/Georgia-Italic.ttf); font-family: "Georgia"; font-weight: normal; } @font-face { src: url(fonts/Georgia.ttf); font-family: "Georgia"; font-style: normal; font-weight: normal; } |
08-23-2017, 02:58 PM | #11 |
A Hairy Wizard
Posts: 3,068
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
just off the bat...you need to fix the path for the files...
Code:
@font-face { font-family: Georgia; font-style: normal; font-weight: normal; src: url(../fonts/georgia.ttf); } @font-face { font-family: Georgia; font-style: normal; font-weight: bold; src: url(../fonts/georgiab.ttf); } @font-face { font-family: Georgia; font-style: italic; font-weight: normal; src: url(../fonts/georgiai.ttf); } @font-face { font-family: Georgia; font-style: italic; font-weight: bold; src: url(../fonts/georgiabi.ttf); } Last edited by Turtle91; 08-23-2017 at 03:00 PM. |
08-24-2017, 03:01 AM | #12 |
Fanatic
Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
|
I am aware of a path-to-fonts issue, as I mentioned it in message #8 last paragraph.
The path is correct (can be checked quickly in calibre by double clicking the path - if it's correct it will complain one way, if it's wrong it will complain that it cannot find the file). Update: I worked a lot in calibre, and as I said, I do the embedding only at the end. Towards the end, after many trials, I got a lack of memory error and I restarted the software. I think (needs confirmation) this was the culprit - after restarting it could do the embedding and subsetting correctly. |
08-24-2017, 05:24 AM | #13 |
Resident Curmudgeon
Posts: 73,645
Karma: 127838196
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
If you are running a 64-bit Windows and have the 32-bit Calibre installed, uninstall the 32-bit version and install the 64-bit version.
|
08-24-2017, 05:49 PM | #14 | |
Bookmaker & Cat Slave
Posts: 11,447
Karma: 157030631
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
FWIW. Hitch |
|
08-24-2017, 07:26 PM | #15 |
Resident Curmudgeon
Posts: 73,645
Karma: 127838196
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I've never had a problem with Calibre's font subsetting after the bugs were fixed so long ago. Another possible fix is to reboot the computer and try again.
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Embedding fonts - strange issue | sparklemotion | Amazon Kindle | 152 | 11-21-2013 08:05 PM |
Embedding font in books that already have embedded font | Barty | Calibre | 2 | 10-16-2013 11:38 PM |
Embedding font produces strange spacing | northstar7 | Sigil | 6 | 09-17-2013 01:52 PM |
Do I need a font license if all I'm doing is referring to the font (not embedding)? | Stodder | Workshop | 21 | 04-21-2011 04:19 AM |
Strange result in Search | KlondikeGeoff | Feedback | 18 | 08-20-2007 11:19 AM |