View Full Version : line breakup possible?


Justice Strike
09-17-2009, 05:16 AM
I am curious. Is it possible to give some sense of line break up in the epub format. For example, words knows how words end (with space) and even how words need to be broken up. I'm curious if it is possible to somehow to specify where words are broken up.

While this seems trivial... it's essential in asian languages. For example, the space in thai is used to signify the end of a sentence. For the reader however a sentence looks like a long word and if it's nearing the end of the page it needs some guidelines to know where it could be broken up correctly. BTW. The Sony ereader formats such books very weird. It just goes off page and you cannot see the words at all... anyone have a solution for this problem?

Jellby
09-17-2009, 06:30 AM
The best way would be using: space (& #32;), no-break space (& #160;), zero-width space (& #8203;), and zero-width no-break space (& #65279;) where needed, and hope the reading software supports them.

(no space between & and # above, by the way.)

Justice Strike
09-17-2009, 09:32 AM
thank you i've found some other tags besides the one you gave me. I did a little test.

<wbr> ==> does not work

& #8203; ==> does work but shows a ? on the place where this is inserted

& shy; ==> does not work, and ends the document.


i tried some other things... mainly using <wbr> now my prs600 has crashed :(

Jellby
09-17-2009, 11:08 AM
I don't think <wbr> is supported by the ePUB spec at all.

& shy; could work, but it gives (if implemented correctly) a hyphen at the end of broken lines, which you probably don't want in Asian scripts.

& #8203; giving a ? is probably a problem of the default font, try one of these fonts (http://www.fileformat.info/info/unicode/char/200b/fontsupport.htm).

pdurrant
09-17-2009, 11:12 AM
I don't know if this would work (I haven't tried it), but perhaps just enclosing parts of the sentence in <span>...</span> would be enough to allow/encourage line breaks between the spans rather than within spans?

For the reader however a sentence looks like a long word and if it's nearing the end of the page it needs some guidelines to know where it could be broken up correctly.

frabjous
09-17-2009, 11:17 AM
Does the CSS style

white-space: nowrap

works in ePubs? I just don't know how far thought would go towards solving your problems, though...

Justice Strike
09-17-2009, 12:19 PM
I don't think <wbr> is supported by the ePUB spec at all.

* could work, but it gives (if implemented correctly) a hyphen at the end of broken lines, which you probably don't want in Asian scripts.

& #8203; giving a ? is probably a problem of the default font, try one of these fonts (http://www.fileformat.info/info/unicode/char/200b/fontsupport.htm).

if implemented correctly <wbr> should not show a hyphen. & shy; should however show a hyphen... but the implementation is flawed, and it is adviced not to use it.

As for not able to support the & #8203... the font being used is an asian font... perhaps i should define multiple fonts and only use a different font when i want to use the zero width character.... however it's a problem which is also seen in some webbrowsers so i'm not totally convinced it's just the font.

Jellby
09-17-2009, 12:32 PM
if implemented correctly <wbr> should not show a hyphen. & shy; should however show a hyphen... but the implementation is flawed, and it is adviced not to use it.

Sorry, I meant that & shy; could work but would show a hyphen (I've corrected the message now). As I said, <wbr> does not seem to be supported in ePUB, so don't use it, it's not a problem of implementation, but of the format specification.

Justice Strike
09-17-2009, 05:59 PM
the & #8203; seems to work... in latin text... haven't tried it with thai though, i wouldn't know why it shouldn't work so i have good hopes :)

Now a automatic way of reformating thai text is needed :) but i think that's manageable.

Jellby
09-18-2009, 07:15 AM
In Thai, would you need to insert & #8203; between every two characters (is a line break permitted everywhere)? If that's the case, I believe that's only a workaround, and ePUB renderers should at some point suport proper linebreaking algorithms for different languages (especially if the rules are as simple as "break anywhere").

Justice Strike
09-18-2009, 08:17 AM
In Thai, would you need to insert & #8203; between every two characters (is a line break permitted everywhere)? If that's the case, I believe that's only a workaround, and ePUB renderers should at some point suport proper linebreaking algorithms for different languages (especially if the rules are as simple as "break anywhere").

i think you are correct. I was going to implement a line breaking algorithm though... to line break correctly for that language...