View Full Version : How is smoothly justified text achieved?


polyfragmentiert
11-18-2009, 04:31 AM
I'm pretty new to ebooks in general and EPUB especially,

and wondered how devices, or creators of EPUBs, achieve smoothly justified formatting on-screen?

As far as I know, EPUB's output on the screen is based on XHTML. Browsers at least cannot hyphenate text without external help from scripting libs, so how is it done? Without hyphenation, there are bound to be ugly gaps in-text if there are longish words present in narrower columns, aren't there?

Looking forward to tipps and pointers.

- Thorsten

WillAdams
11-18-2009, 07:23 AM
If one wants nicely set text, use a .pdf, where one can use a decent H&J engine, and then manually tweak the text formatting to get the best possible results.

If doing epub, one is at the mercy of the formatting capabilities of whatever viewer the user has chosen and how that interacts w/ screen size / font size &c.

One can:

- manually tie together words or bits one believes shouldn't be broken (Dr. Livingston)
- put things which should not be broken, but might be into a no-break state (didn't)
- manually add discretionary hyphens where there's a possibility of the computer getting it wrong (pres-ent (a gift) vice pre-sent (to give to)) --- this won't work for instances in languages where the spelling has to change depending on whether or no it's hyphenated of course --- see above for a solution for that
- set the text ragged right

Above all, remove any manual line breaks which some idiot (or tormented Quark XPress user) inserted to force a particular linebreak

William

Terisa de morgan
11-18-2009, 07:48 AM
I'm pretty new to ebooks in general and EPUB especially,

and wondered how devices, or creators of EPUBs, achieve smoothly justified formatting on-screen?

As far as I know, EPUB's output on the screen is based on XHTML. Browsers at least cannot hyphenate text without external help from scripting libs, so how is it done? Without hyphenation, there are bound to be ugly gaps in-text if there are longish words present in narrower columns, aren't there?


Yes, that's true. But I don't think that external library is a problem, at the end you have a SW running into your reader.

Jellby
11-18-2009, 08:24 AM
and wondered how devices, or creators of EPUBs, achieve smoothly justified formatting on-screen?

As a creator, I don't do anything special, I don't even have text-align:justify in the CSS, because I think that should be an option left to the reader (the person) by the reader (the device and software). All I do is using   in the few places a line break should be forbidden, noting that in narrow screens you probably want to allow a line break in some places you wouldn't for normal book-size lines.

polyfragmentiert
11-19-2009, 09:59 AM
Thanks for your experience so far. :2thumbsup

NASCARaddicted
11-19-2009, 08:36 PM
If doing epub, one is at the mercy of the formatting capabilities of whatever viewer the user has chosen and how that interacts w/ screen size / font size &c.

One can:

- manually tie together words or bits one believes shouldn't be broken (Dr. Livingston)
- put things which should not be broken, but might be into a no-break state (didn't)
- manually add discretionary hyphens where there's a possibility of the computer getting it wrong (pres-ent (a gift) vice pre-sent (to give to)) --- this won't work for instances in languages where the spelling has to change depending on whether or no it's hyphenated of course --- see above for a solution for that
- set the text ragged right

Above all, remove any manual line breaks which some idiot (or tormented Quark XPress user) inserted to force a particular linebreak

William

Very good explanation, William.
In my youth, there was this book series that I really loved. Now I got all this books in pdf files, but I prefer epub. So at first I converted all the pdf files to html, edit them and then convert them epub so I can read them on my Bebook. (But to add this: I started to prove read, so I got all the paper books through ebay - when you think about it: I got the Bebook to reduce the amount of books in my house, but now it got bigger)
But then I noticed many errors and started to edit the html files.
The converter that I use (Calibre) justifies the text if you want, but of course, this still needs some work. Also, if you want, it adds a text intent on every new paragraph, so it really looks like in a real book.

One of the biggest problems however are the line breaks. Sometimes there is a line break in the middle of a sentence. And sometimes, a line break is missing, even though there should been one. So right now, when I read one of this ebooks and I see a line where a line break is missing or where there is one too much, I write this line down on paper and edit it later at home.

As for long words: I am not sure, but I think my e-reader (the Bebook 1) doesn't support hyphenation. I tried to add soft hyphenation on some long words, but somehow I never got it to work properly.
For example: a word like "Racecar" ... it was supposed to look like: Race- car, but in the end, it looked like Race car (the dash was missing).

I also tried the opposite. Words like e-commerce or Mary-Joe shouldn't be separated (at least imho), so I tried non breaking hyphen. Somehow this didn't work either. But I got it fixed with <nobr> tags. In all of the 27 books of the series, there is a guy named "Hans-Jürgen". A few times, the 2nd part of his name was moved to the next line, because of the "-" ... so now I edit all my ebooks to look like <nobr>Hans-Jürgen</nobr> ...

When I think about it: before I started to work with epub, I knew NOTHING about html ... but right now I am really getting into it (but of course I am still a novice)

JSWolf
11-19-2009, 11:13 PM
The problem is that novel length PDF never converts without errors. Even Adobe Acrobat cannot convert error free. This is why PDF is a terrible source format to convert to anything else.