![]() |
#1 |
Member
![]() Posts: 14
Karma: 10
Join Date: Aug 2018
Device: none
|
embedded fonts in epub
Hi,
I am using Sigil to convert html + css files to epub to create ebooks. I have found it quick and easy to use. I want to use a public domain chess font to present chess diagrams, so switching to another font will not do. I am struggling. In my css file I have @font-face { font-family: 'merida'; font-weight: normal; font-style: normal; src: url(“MERIFONT.TTF”); } .diagram{ font-family: ''merida"; font-size: 48px; } In my html file I have say <html xmlns='http://www.w3.org/1999/xhtml'> <html> <head> <title>chess</title> <link rel='stylesheet' type='text/css' href='merida.css'> </head> <body> <p class = 'diagram'> XABCDEFGHY<br> 8-+-wqk+-+(<br> 7+-+-+-+-'<br> 6-+-+-+-+&<br> 5+-+-+-+-%<br> 4-+-+-+-+$<br> 3+-+-+-+-#<br> 2-+-+-+-+"<br> 1+-+QmK-+-!<br> abcdefgh</p> testing </body></html> What am I doing wrong? I had it working but forget what I did. Also when it was working in sigil it would not work in adobe epub reader. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
If it wasn't working in the Adobe reader, something is probably wrong in your stylesheet. A missing semicolon for example.
Now, when you upload your font to Sigil (you have done that I assume), it will be placed in the directory Fonts and you need to adjust your code accordingly. I would also strongly advise to not use px in your stylesheet. That would not scale right if someone would change the font size. So, I would make it like this: Code:
@font-face { font-family: 'merida'; font-weight: normal; font-style: normal; src: url(“./Fonts/MERIFONT.TTF”); } .diagram{ font-family: ''merida"; font-size: 1em; font-weight: normal; font-style: normal; } Personally I would also display it different in the HTML and prevent usage of <br>, but that is not required. Just a different style. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Member
![]() Posts: 14
Karma: 10
Join Date: Aug 2018
Device: none
|
Thank you for your prompt reply.
You have already clarified a couple of points for me. One being the url line in the font-family block. Quote:
I would look at it some more in the morning when I am fresher. |
|
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,341
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Keep in mind that there are some fonts that are simply incompatible with ADE. I con't remember the exact name of the property, offhand. But there was a certain version-level that determined whether ADE would support it. It was a property that could be easily modified in FontForge (or something similar). If your font is opensource, it should be possible. Someone else will have to provide the details, though.
But none of that will matter until you get it working in Sigil. The only things I can recommend are using the Tools->Validate Stylesheets feature of Sigil to ensure there are no syntax errors (as Toxaris mentioned) and to double-check that the CSS is indeed linked to the html file. |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Another forum member also mentioned to me there is another issue with the code. You used two single quotes and curly quotes instead of straight quotes (I made the changes red). It should be like this:
Code:
@font-face { font-family: 'merida'; font-weight: normal; font-style: normal; src: url("./Fonts/MERIFONT.TTF"); } .diagram{ font-family: 'merida'; font-size: 1em; font-weight: normal; font-style: normal; } |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
|
|
![]() |
![]() |
![]() |
#7 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,341
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
I don't know why I have such a hard time remembering "Defunct Windows/IBM OS." ![]() |
|
![]() |
![]() |
![]() |
#8 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,633
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
![]() Code:
src: url("../Fonts/MERIFONT.TTF"); Below you can check the respective epub. By the way, to me is a good idea to use "px" or "pt" for the font-size IN THIS CASE. The diagram won't resize but will asure always is displayed fine, even with a big font-size. Regards Rubén Last edited by RbnJrg; 08-21-2018 at 02:10 PM. |
|
![]() |
![]() |
![]() |
#9 | |
Member
![]() Posts: 14
Karma: 10
Join Date: Aug 2018
Device: none
|
Quote:
I have Merida working in html and sigil with the help of forum members <font face="merida">, but not in ADE. I will keep reading. |
|
![]() |
![]() |
![]() |
#10 |
Member
![]() Posts: 14
Karma: 10
Join Date: Aug 2018
Device: none
|
This will be fantastic help. I will use it for my diagrams right away.
|
![]() |
![]() |
![]() |
#11 |
Member
![]() Posts: 14
Karma: 10
Join Date: Aug 2018
Device: none
|
online reader cannot find font
I add the case chess font to some chess ebooks I created. They worked in fine in Sigil and ADE. I then uploaded the epubs to Draft2Digital, downloaded and checked the epubs. They were fine.
Kobo is the only seller, whose online previewer can find the fonts (though I don't know about Apple, I cannot check those). Why cannot these onliner e-readers find the embedded Case font? I am not out of the woods yet. |
![]() |
![]() |
![]() |
#12 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Which online e-readers? Some readers just don't support embedded fonts and/or stylesheets.
|
![]() |
![]() |
![]() |
#13 |
Member
![]() Posts: 14
Karma: 10
Join Date: Aug 2018
Device: none
|
embedded fonts
|
![]() |
![]() |
![]() |
#14 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
Over here (Europe) it is mostly Kobo and Kindle. The others (Tolino/Pocketbook) are very small players. Even so, I would not be too concerned. If it is a valid ePUB and even ADE 2 shows it correctly, it is not the issue of the ePUB, but the reader. Embedded fonts can be quite a challenge sometimes. |
|
![]() |
![]() |
![]() |
#15 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
@serendipity22: IMHO, using embedded fonts to display chess diagrams is a bad idea, because many users disable publisher fonts or use older apps that don't support embedded fonts.
You might want to consider generating chess diagrams with one of the many free apps for making chess diagrams. If you're familiar with Python, you could also use python-chess to generate chess diagrams. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Embedded fonts in epub | Jellby | Kobo Reader | 8 | 07-25-2014 01:24 AM |
Fonts not being embedded (epub) | soundsfromsound | Calibre | 19 | 10-04-2013 01:31 PM |
Embedded fonts in epub | erik5000 | ePub | 7 | 12-08-2009 11:55 AM |
ePub embedded fonts | JSWolf | Ectaco jetBook | 9 | 09-14-2009 08:43 PM |
ePub + Embedded Fonts | Cygfrydd | ePub | 11 | 03-02-2009 05:56 PM |