![]() |
#1 |
Bookish
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,008
Karma: 2003162
Join Date: Jun 2011
Device: PC, t1, t2, t3, Clara BW, Clara HD, Libra 2, Libra Color, Nxtpaper 11
|
![]()
Kovid, I tried to embed in some documents a TTF font and got mix results with my ref in the stylesheet resulting in the font not being found.
I expected the font to be found in "src: url(../Fonts/<font>.ttf)", but it turned out to be placed after importing (function: "Import files into book") in a different location "src: url(../../fonts/<font>.ttf)". The next time I imported the same font in another document, it was not even located in a sub-folder "fonts", but at the same hierarchy level as "mimetype" so I had to change the ref into "src: url(../../<font>.ttf);" for it to be found. Using the "Arrange into folders" function to force the font into sub-folder "Fonts" so it could be found via ref "src: url(../Fonts/<font>.ttf)" also failed as this function created the sub-folder "fonts" in lower-case. As my results seems to differ each time, I currently import the font with the "Import files into book" function, open then the resulting zipped epub to look where it happens to be situated and then manually update the ref in the stylesheet. Apparently I have the wrong font location expectations, but can you provide me a pointer on how it is supposed to be to cure my confusion? |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,225
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Fonts are placed in the folder fonts/ and referred to from a newly created stylesheet called fonts.css, where they are referred to as
url(fonts/fontname-style.ttf) |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Bookish
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,008
Karma: 2003162
Join Date: Jun 2011
Device: PC, t1, t2, t3, Clara BW, Clara HD, Libra 2, Libra Color, Nxtpaper 11
|
Ok, well that's not happening for me. No new font.css is created in styles/ and the fontfile is not placed in a fonts/ directory. I just tried that in an existing epub which did not had any previous embedded fonts. Can it be that I'm missing a setting?
To rule out that it had something to do with a possibly corrupted epub, I tried an empty dummy epub with same result. Last edited by DrChiper; 02-24-2014 at 07:58 AM. |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,225
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
How are you embedding the fonts? I was referring to the action of Tools->Embed referenced fonts
|
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,412
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'm not seeing the expected behavior either, Kovid.
After adding the font file, it immediately appears in the "Files Browser" under Fonts; but in the OPF file, it's manifested as being in the same folder as the OPF file "../garamond-regular.ttf". No new css file gets created. Deleting the font file doesn't remove it from the manifest either. If you add the file again, you wind up with two entries in the manifest. 1.25 (32-bit) on Vista. EDIT: actually... no file deleted from the Files browser appears to be removed from the OPF until the book is saved and re-opened (but this doesn't work for the deleted fonts; their manifest entries appear to be well and truly orphaned). I'm using File-->New file (images/fonts/HTML/etc. Or File-->Import files into book. Same behavior with both. In my case, there ARE no referenced fonts in my epub. I'm trying to add my own embedded fonts and use them. Is there another way we should be doing that? Last edited by DiapDealer; 02-24-2014 at 08:21 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Bookish
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,008
Karma: 2003162
Join Date: Jun 2011
Device: PC, t1, t2, t3, Clara BW, Clara HD, Libra 2, Libra Color, Nxtpaper 11
|
Ok, this is my workflow:
Using the "Embed referenced fonts" does not find anything, but I can understand that as the font I want to use is not located in the windows fonts dir. @DiapDealer: Hmm, Did not used "New file (images/fonts/HTML/etc." before, but yes, that could also be an option. Last edited by DrChiper; 02-24-2014 at 08:37 AM. |
![]() |
![]() |
![]() |
#7 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,225
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
When you add files using Import files it is placed into whatever folder int he book contains the most files of the same type. So if you add an image and the book contains images in images/ the new image will be added into images and so on.
I cant recall what happens if there are no files of the same type already in the book, I'll have to look at the code for that later. Last edited by kovidgoyal; 02-24-2014 at 08:54 AM. |
![]() |
![]() |
![]() |
#8 |
Bookish
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,008
Karma: 2003162
Join Date: Jun 2011
Device: PC, t1, t2, t3, Clara BW, Clara HD, Libra 2, Libra Color, Nxtpaper 11
|
Ok, that possibly explains the fact the font file is not located in a fonts/ dir. But what is causing the fonts.css file not to be created?
|
![]() |
![]() |
![]() |
#9 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,225
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
When you add using add new file, the file is placed in whatever folder you specify in the add ilfe dialog, or the root if you specify no folder.
|
![]() |
![]() |
![]() |
#10 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,225
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
![]() |
![]() |
![]() |
#11 |
Bookish
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,008
Karma: 2003162
Join Date: Jun 2011
Device: PC, t1, t2, t3, Clara BW, Clara HD, Libra 2, Libra Color, Nxtpaper 11
|
Ok, so summarizing:
Thanks for clearing that up, Kovid! |
![]() |
![]() |
![]() |
#12 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,225
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
1. You can always rename the file after import even if you use add files
2. Yes, calibre cannot know where you want the fonts referenced, whereas if you use embed referenced fonts, it knows exactly where the fonts are referenced. 3. Yes. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Embedding fonts - so confused | EkkoJohnny | Sigil | 12 | 03-27-2012 01:39 PM |
Fonts embedding | 1drey | Writer2ePub | 3 | 06-17-2011 11:15 PM |
Embedding fonts | JaneFancher | Calibre | 14 | 04-10-2010 09:28 PM |
Embedding fonts | AprilHare | ePub | 6 | 01-02-2010 11:42 AM |
Embedding fonts | jash | Calibre | 2 | 09-09-2008 05:05 PM |