View Full Version : iBooks sans-serif weirdness


xrm0
01-25-2013, 09:43 PM
Although by the title it may look this is the same as the thread at Sans-serif fonts and iBooks (http://www.mobileread.com/forums/showthread.php?t=100377) it isn't.

I've got an epub show text in sans in iBooks without embedding fonts nor adding com.apple.ibooks.display-options.xml but somehow in one file, a line of text in sans serif is rendered as serif.

There's a test case epub attached. You'll see three pages, nearly identical:

Section0001:

<p>no font family specified</p>
<p class="serif">serif</p>
<p class="sans">sans-serif</p>
<p class="serif"><span class="sans">initially serif, overridden with sans-serif</span></p>

Section 01 screenshot:
http://www.mobileread.com/forums/attachment.php?attachmentid=100063&stc=1&d=1359166232

Section0002:

<p>no font family specified</p>
<p class="serif">serif</p>
<p class="sans">sans-serif</p>
<p class="sans"><span class="serif">initially sans-serif, overridden with serif</span></p>

Section 02 screenshot:
http://www.mobileread.com/forums/attachment.php?attachmentid=100064&stc=1&d=1359166255

And here's what I don't understand.

Section0003:

<p>no font family specified</p>
<p class="serif">serif</p>
<p class="sans">sans-serif</p>
<p class="serif"><span class="sans">initially serif, overridden with sans-serif</span></p>
<p class="sans"><span class="serif">initially sans-serif, overridden with serif</span></p>

Section 03 screenshot:
http://www.mobileread.com/forums/attachment.php?attachmentid=100065&stc=1&d=1359166255

In this last file, the <p> with the text "sans-serif" is rendered as serif. Does anyone know why this happens? Am I doing something wrong or it's a bug?

The serif and sans css classes are defined as:

.serif {
font-family: serif;
}

.sans {
font-family: sans-serif;
}


After finishing writing this post I've realized I had a typo (overriden), I've changed it in the post/epub but not on the screenshots!

dgatwood
01-25-2013, 10:28 PM
Adding the following com.apple.ibooks.display-options.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<display_options>
<platform name="*">
<option name="specified-fonts">true</option>
</platform>
</display_options>

in the META-INF folder appears to fix this problem, so this is probably a curious quirk behavior designed to avoid some problem that the iBooks folks saw with old, broken eBooks.

I would strongly suggest just adding the file. It will save you lots of problems and head scratching. :)

AlexBell
01-26-2013, 12:30 AM
Adding the following com.apple.ibooks.display-options.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<display_options>
<platform name="*">
<option name="specified-fonts">true</option>
</platform>
</display_options>

in the META-INF folder appears to fix this problem, so this is probably a curious quirk behavior designed to avoid some problem that the iBooks folks saw with old, broken eBooks.

I would strongly suggest just adding the file. It will save you lots of problems and head scratching. :)

Thanks for the information. Could you point me please to some source where I can read up on this file?

dgatwood
01-26-2013, 02:39 PM
If you're registered as a book publisher with iTunes, download the iBookstore Asset Guide. Otherwise, the following links cover it fairly well:

http://authoradventures.blogspot.com/2012/01/how-to-create-fixed-layout-ibooks-part_24.html

http://ideate.verioiponly.com/Noir%20Studio/za%20jugoslava/Elementi%20za%20Jugoslava/Apple%20Guides/Fixed%20Layout%20EPUBs%20Miniguide/FixedLayoutEPUBsMiniguide.pdf

AlexBell
01-27-2013, 01:00 AM
If you're registered as a book publisher with iTunes, download the iBookstore Asset Guide. Otherwise, the following links cover it fairly well:

http://authoradventures.blogspot.com/2012/01/how-to-create-fixed-layout-ibooks-part_24.html

http://ideate.verioiponly.com/Noir%20Studio/za%20jugoslava/Elementi%20za%20Jugoslava/Apple%20Guides/Fixed%20Layout%20EPUBs%20Miniguide/FixedLayoutEPUBsMiniguide.pdf

Thanks, dgatwood. I'm not an Apple user, so I looked at the two guides. Is the file only used in fixed layout ePubs?

Turtle91
01-27-2013, 08:15 AM
From what I understand it fixes some quirkiness on flowable books as well. I just include it in all my ebooks in case someone really wants to use iBooks. It's a very small file and doesn't add to the size of the book anymore than some of the other 'hacks' we have to do to accomodate devices/apps inconsistent implementations.
I just have the file already incorporated into my template when I create a new ePub (I use Sigil) so I don't ever have to think about it being there.

Cheers!

Hitch
01-27-2013, 05:43 PM
Thanks, dgatwood. I'm not an Apple user, so I looked at the two guides. Is the file only used in fixed layout ePubs?

No. Many fonts won't work on iBooks reflowable without it.

Hitch

dgatwood
01-27-2013, 08:02 PM
Thanks, dgatwood. I'm not an Apple user, so I looked at the two guides. Is the file only used in fixed layout ePubs?

No, but with the exception of the specified-fonts option, all the other options are specific to fixed-layout EPUB books, IIRC.

In other words, the snippet I posted is pretty much everything that reflowable book authors need to know or care about, AFAIK.

AlexBell
01-27-2013, 11:53 PM
Thanks again.