Browse > Home / ePublishing / Automated Hyphenation in Apple iBooks

| Subscribe via RSS

Hyphenation in iBooks

September 5th, 2010 Posted in ePublishing

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:

iBooks Javascript Hyphenation Justified

It also looks better with left aligned text:

iBooks Hyphenation Left AlignedI 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.

8 Responses to “Hyphenation in iBooks”

  1. Steve Shepard Says:

    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


  2. Titusz Says:

    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…


  3. Marcio Duarte Says:

    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?


  4. Rick Gordon Says:

    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.


  5. Rick Gordon Says:

    Answering my own question, I need to change the line in the head from:

    to:


  6. Adam T Says:

    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.


  7. Matt B. Says:

    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…


  8. Tina Henderson Says:

    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.


Leave a Reply