![]() |
#1 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 244
Karma: 2112680
Join Date: Jan 2017
Device: iBooks
|
CSS: Spans vs Font Families
I'm using Sigil to create epubs and iBooks primarily to preview them, and I have a recurring CSS problem that's driving me nuts. I'm not really sure if it's just a problem with spans or with a variety of nested elements, but here goes...
Imagine a div that has a CSS style specifying font families, either inline or in an attacked style sheet... Code:
<div style="font-family: Arial, Verdana, sans-serif; font-size: 75%;">Text</div> Code:
<div style="font-family: Arial, Verdana, sans-serif; font-size: 75%;">Text <span style="font-family: Arial, Verdana, sans-serif; color: #f00;">Red Text</span></div> Things usually look OK in Sigil, but when I open my project in iBooks, the errors appear. I should add that I haven't installed any fonts in my epub. About all I'm using are Arial and Verdana, which are installed in my computer and presumably in most people's computers. Have any of you had a similar problem? |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,328
Karma: 59447733
Join Date: Jan 2007
Location: Peru
Device: KINDLE: Oasis 3, Scribe (1st), Matcha; KOBO: Libra 2, Libra Colour
|
Now moved out of the Writers' Forum and to the Sigil Forum.
The Writers' forum is not for technical programming issues or programming code. Don (Moderator) |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,353
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Nothing Sigil specific, here. Moving to the EPUB forum.
|
![]() |
![]() |
![]() |
#4 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 557
Karma: 400004
Join Date: Feb 2009
Device: ONYX M96
|
I see it right in ADE too. I think the problem is related to Ibooks and its way to handle embedded font. Try to add the configuration file in META-INF folder.
|
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,328
Karma: 59447733
Join Date: Jan 2007
Location: Peru
Device: KINDLE: Oasis 3, Scribe (1st), Matcha; KOBO: Libra 2, Libra Colour
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
The problem is that the ePub is picking up the fonts from your system. You have to embed the fonts in the epub for it to work properly and all that garbage you have in the XHTML should be in the CSS as a class.
And there is an XML file you need to put in the ePub (and correctly configured) so iBooks will display embedded fonts. You'll have to look up what that file is, how to write it, and where to put it. If this book is going to be sold, you'll need to have a license for the fonts you want to embed. Last edited by JSWolf; 06-12-2017 at 11:15 AM. |
![]() |
![]() |
![]() |
#7 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 244
Karma: 2112680
Join Date: Jan 2017
Device: iBooks
|
|
![]() |
![]() |
![]() |
#8 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 244
Karma: 2112680
Join Date: Jan 2017
Device: iBooks
|
I Googled for more information and found an interesting suggestion: Instead of specifying fonts, just make a class like this...
.Class { font-family: sans-serif; } Then let Kindle, iBooks or whatever use its sans-serif default font. I tried it, and it didn't fix the span issue I described in iBooks. But is this a scheme that works with Kindle or iBooks in general? Last edited by SigilBear; 06-12-2017 at 08:42 PM. |
![]() |
![]() |
![]() |
#9 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,303
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
You should use classes and CSS to style your files. Inline or embedded styling should be kept to a minimum.
As far as using a device's default fonts - or specifying any font for that matter - IMO you should avoid defining fonts at all. Let the user determine what font they wish to read in via their own device settings. Only if the font is very specific and helps tell the story should it be defined in the CSS - and then it is safest to embed the font in the ePub to ensure that it is used on the widest number of devices possible. Of course, there are some devices that just don't play well with fonts (and other standards) - you will just need to accommodate them if you must sell on that platform. |
![]() |
![]() |
![]() |
#10 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,897
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
The WHY
When you put it inline, then change your mind. you need to touch ALL those places. When you use a stylesheet: there is only 1 place to mess up ![]() |
![]() |
![]() |
![]() |
#11 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
(You can use DiapDealer's AddiBooksXML Sigil plugin to add this .xml file.) Last edited by Doitsu; 06-13-2017 at 01:16 AM. |
|
![]() |
![]() |
![]() |
#12 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
If memory serves, that file isn't needed any longer, BUT, if the OP is viewing this with a first-gen iPad, he might still have issues without it. FWIW. Hitch |
|
![]() |
![]() |
![]() |
#13 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,064
Karma: 144284144
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
#14 |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
|
![]() |
![]() |
![]() |
#15 | |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 244
Karma: 2112680
Join Date: Jan 2017
Device: iBooks
|
Quote:
.Class { font-family: sans-serif; } That would certainly make life easier. My first epub doesn't use any special fonts, though my second one will. Thanks. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Font families not working | JSWolf | Kobo Reader | 19 | 12-24-2014 07:42 PM |
Fonts and font families | troll05 | General Discussions | 3 | 05-06-2013 07:53 PM |
Font-families and justified alignment | ElMiko | Sigil | 46 | 03-04-2013 02:27 AM |
505 vs. different font families in LRF | pepak | Sony Reader | 8 | 09-29-2009 01:03 PM |