Hyphenation in iBooks
UPDATE: Since iBooks Version 1.2 there is no need for any Javascript hacks. iBooks does hyphenation natively.
The iBooks eReader Software for iPad and iPhone does currently not do any automated hyphenation. To add to the problem iBooks comes with a default setting that forces body text to justified alignment. Typesetting guys seem to agree that justified text and no hyphenation is a no-go.
Rick Gordon asked on Twitter if it was possible to use the Javascript based Hyphenator. As iBooks is based on WebKit it should be possible. So I did a test and it works fine. See the results here:
It also looks better with left aligned text:
I am not sure if such an ePub will make it into the iBookstore. You will have to try for yourself. Matteo asked for a demo ePub to see how this is done. You can download the Hyphenation ePub Demo and take a look at the code. It is fairly simple, just stick to the hypenator documentation. The hyphenation ePub validates epubcheck 1.0.5. I also tested it in Adobe Digital Editions but it does not seem to work there.

September 5th, 2010 at 8:37 pm
Hi Titusz,
Thanks for doing the legwork on this. The results look promising.
One thing to note: The project is licensed as either GPL or LGPL (the project site lists it as GPL and the code headers as LGPL), both of which would require making the text of the book available for modification.
-Steve
September 5th, 2010 at 9:17 pm
Yes that might be an issue. I am not an expert in LGPL but this sounds like you don´t need to make the epub itself availiable for modification:
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
Maybe someone can clarify this…
September 7th, 2010 at 2:44 pm
Good to see an real example of a feature so important to readability and book design. Other question that arises is: why hyphenation wasn’t considered a default feature in these e-readers from the start?
September 18th, 2010 at 2:59 am
My own try to incorporate hyphenation.js in an iBooks EPUB generates the following error:
“Result of expression ‘el.getAttribute’ [undefined] is not a function.”
Still trying to figure out why mine fails and yours didn’t.
September 20th, 2010 at 10:34 am
Answering my own question, I need to change the line in the head from:
to:
November 30th, 2010 at 3:22 am
Rick, can you post that again? Your post says:
Answering my own question, I need to change the line in the head from:
to:
I.e. it does not say what you actually changed.
December 15th, 2010 at 9:33 pm
iBooks was just updated with a built-in hyphenation feature today (12/15/2010). Progress! Now if they can add better kerning and an algorithm to avoid “widows,” they’re almost there…
January 17th, 2011 at 5:24 pm
Has anyone tried this with iOS4.2, which allows hyphenation? iBooks is breaking words before/after 2 characters and I’d like to change it to 3.