View Full Version : Long words running off page


BKh
08-17-2012, 01:47 PM
I just noticed that on the Sony Reader and ADE, words that are longer than the line just run off the page. I'm accustomed to the Kindle where long words are broken and run on to the next line.

Is there something I could be putting in the CSS to tell the reading device to go ahead and break a word if it is too long for the line?

I'm not interested in inserting special characters in these long words.

I realize that the Kindle's method of just chopping at the end of the line is a little crude, but not displaying the text at all as ADE does seems unacceptable.

Toxaris
08-17-2012, 03:24 PM
There is something wrong in your stylesheet. I suspect there is a 'pre' value there. There was an mention about that about a week ago.

BKh
08-17-2012, 03:48 PM
Oh, I should have included my stylesheet. Sorry. But I don't use any pre tags.

Here is the css specificially for the text in question.

.bodytext {
border-bottom: 0;
border-top: 0;
font-size: 1em;
margin-bottom: 0em;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-top: 0;
text-indent: 1em
}

Here is the whole style sheet.

@namespace h "http://www.w3.org/1999/xhtml";

@font-face {
font-family : Verajja;
font-weight : normal;
font-style: normal;
src : url('../Fonts/Verajjan.ttf');
}
@font-face {
font-family : Verajja;
font-weight : normal;
font-style: italic;
src : url('../Fonts/Verajjai.ttf');
}

@font-face {
font-family : Verajja;
font-weight : bold;
font-style: normal;
src : url('../Fonts/Verajjab.ttf');
}

@font-face {
font-family : Verajja;
font-weight : bold;
font-style: italic;
src : url('../Fonts/Verajjat.ttf');
}

body {
font-family: Verajja;
}


p.sgc-1 {text-align: center; font-size:small}

.bodytext {
border-bottom: 0;
border-top: 0;
font-size: 1em;
margin-bottom: 0em;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-top: 0;
text-indent: 1em
}

.book {
border-bottom: 0;
border-top: 0;
display: block;
font-size: 1.83333em;
font-weight: bold;
margin-bottom: 0.5cm;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-top: 0;
text-align: center
}
.break {
page-break-after: always
}
.calibre {


font-size: 1em;
margin-bottom: 0;
margin-left: 5pt;
margin-right: 5pt;
margin-top: 0;
padding-left: 0;
padding-right: 0;
page-break-before: always
}
.calibre1 {
display: block
}
.calibre2 {
color: inherit;
cursor: inherit;
text-decoration: inherit
}
.calibre3 {
display: block;
page-break-after: always
}
/*
.center {
border-bottom: 0;
border-top: 0;
display: block;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;
margin-top: 0;
padding-bottom: 0;
padding-top: 0;
text-align: center
}
*/
.centered {
border-bottom: 0;
border-top: 0;
display: block;
font-size: 1em;
margin-bottom: 1em;
margin-left: auto;
margin-right: auto;
margin-top: 1em;
padding-bottom: 0;
padding-top: 0;
text-align: center;
font-style:italic;
}
/*
.centered1 {
border-bottom: 0;
border-top: 0;
display: block;
font-size: 1em;
margin-bottom: 0.5cm;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-top: 0;
text-align: center
}
*/
.chapter {
border-bottom: 0;
border-top: 0;
display: block;
font-size: 2em;
font-weight: normal;
margin-bottom: 0.5cm;
margin-left: 0;
margin-right: 0;
margin-top: 3em;
padding-bottom: 0;
padding-top: 0;
text-align: center
}

.title {
border-bottom: 0;
border-top: 0;
display: block;
font-size: 1.5em;
font-weight: normal;
margin-bottom: 0.5cm;
margin-left: 0;
margin-right: 0;
margin-top: 2em;
padding-bottom: 0;
padding-top: 0;
text-align: center
}

/* Gatha line 1 */
.gatha1 { font-size: 1em; margin-bottom: 0em; margin-left: 0em;margin-top:.5em; margin-bottom:0em; font-style:italic}

/* Gatha line 2 */
.gatha2 { font-size: 1em; margin-bottom: 0em; margin-left: 0em;margin-top:0em; margin-bottom:0em; font-style:italic;}

/* Gatha line 3 */
.gatha3 { font-size: 1em; margin-bottom: 0em; margin-left: 0em;margin-top:0em; margin-bottom:0em; font-style:italic;}

/* Gatha last line */
.gathalast { font-size: 1em; margin-bottom: .5em; margin-left: 0em;margin-top:0em; font-style:italic;}


/*
.gatha {
border-bottom: 0;
border-top: 0;
display: block;
font-size: 1em;
margin-bottom: 0;
margin-left: 1em;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-top: 0
}
.gathalast {
border-bottom: 0;
border-top: 0;
display: block;
font-size: 1em;
margin-bottom: 0.5cm;
margin-left: 1em;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-top: 0
}
*/

.hangnum {
border-bottom: 0;
border-top: 0;
display: block;
font-size: 1em;
margin-bottom: -14.4pt;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-top: 0;
text-indent: 2em
}
.logo {
height: 112px;
margin-bottom: -0.1em;
margin-left: 0.25em;
margin-right: 0.5em;
margin-top: 0;
width: 270px
}
.nikaya {
border-bottom: 0;
border-top: 0;
display: block;
font-size: 2em;
font-weight: bold;
margin-bottom: 0.5cm;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-top: 0;
text-align: center
}
.note {
color: gray;
font-size:small;
}
.paranum {
font-weight: normal;
font-size:small;
}
.subhead {
border-bottom: 0;
border-top: 0;
display: block;
font-size: 1em;
font-weight: bold;
font-style: italic;
margin-bottom: 0.5cm;
margin-left: 0;
margin-right: 0;
margin-top: 1em;
padding-bottom: 0;
padding-top: 0;
text-align: center
}
.sutta {
border-bottom: 0;
border-top: 0;
display: block;
font-size: 1.2em;
font-weight: normal;
margin-bottom: 0.5cm;
margin-left: 0;
margin-right: 0;
margin-top: 2em;
padding-bottom: 0;
padding-top: 0;
text-align: center
}

span.sutnum {
font-size:.75em;
}
span.chaptnum {
font-size:.75em;
}
span.pn {
font-size:small;
color:gray;
}

Doitsu
08-17-2012, 04:15 PM
Does your ebook contain non-Latin text or transliterated text? If so, did you make sure that:

your xhtml source files are encoded in Unicode
the embedded font is also Unicode-compatible
the language code of the epub is correct

Can you post a screen capture and the corresponding html source code section?

BKh
08-17-2012, 04:30 PM
Thanks for the ideas.

It does contain non-standard Latin characters. But the source files are encoded as utf-8, the font is absolutely unicode compatible and contains the correct characters, and the language is set correctly. It's Pali.

But ADE doesn't have any capacity to split words based on the language, does it? I'm not even hoping for that, just to have all the characters displayed.

I will work on a screen shot.

BKh
08-17-2012, 04:44 PM
OK, here's the code for an example:
<p class="bodytext"><a id="para813"></a><a id="para813_sn5"></a><span class="paranum">813</span>. “Cattārome <a id="T5.0326"></a><a id="V3.0328"></a><a id="M3.0222"></a><a id="P5.0254"></a><span class="pn">[254]</span> bhikkhave, iddhipādā bhāvitā bahulīkatā apārā pāraṃ gamanāya saṃvattanti. Katame cattāro? Idha, bhikkhave, bhikkhu chandasamādhippadhānasaṅkhārasamannāgataṃ iddhipādaṃ bhāveti, vīriyasamādhippadhānasaṅkhārasamannāgataṃ iddhipādaṃ bhāveti, cittasamādhippadhānasaṅkhārasamannāgataṃ iddhipādaṃ bhāveti, vīmaṃsāsamādhippadhānasaṅkhārasamannāgataṃ iddhipādaṃ bhāveti. Ime kho, bhikkhave, cattāro iddhipādā bhāvitā bahulīkatā apārā pāraṃ gamanāya saṃvattantī”ti. Paṭhamaṃ.</p>

Here is a screen shot in ADE with the page stretched wide enough so all the long words fit...
http://www.mobileread.com/forums/attachment.php?attachmentid=90935&stc=1&d=1345235994

And this is a shot when I make the page more narrow, simulating a smaller screen (note, I'm just changing the viewing window size). You can see that the fifth, seventh and ninth line run off the screen.

http://www.mobileread.com/forums/attachment.php?attachmentid=90936&stc=1&d=1345235994

Toxaris
08-17-2012, 05:40 PM
If the word cannot fit on one line, it will run off. It will not hyphenate. ADE will have no choice than to let the word run off.

BKh
08-17-2012, 06:05 PM
If the word cannot fit on one line, it will run off. It will not hyphenate. ADE will have no choice than to let the word run off.

Thank you. I'm not wanting it to hyphenate. That's asking a bit much. But of all the ways to deal with long strings of unbroken text, not displaying seems to be the worst. It may not be pretty, but at least on the Kindle (different format, I know) it wraps the text to the next line.

Thanks to all the folks who responded.:thanks:

Toxaris
08-18-2012, 03:18 AM
Wrapping is worse in my opinion. The break is guessed and is very strange. Then again, I cannot imagine too many words that would be longer than a line.

ADE does display the rest of the line, it is only not visible.

mrmikel
08-18-2012, 06:46 AM
You might want to make a note at the beginning of your book asking the reader to switch their book view to landscape, if that is possible on the Kindle. That is, they would hold and read their book with the longest screen dimension horizontal. That will allow longer lines. If editing for epub, also make sure you pull out all non breaking spaces to avoid compounding the problem of overlong words.

mmat1
08-18-2012, 01:05 PM
I'm not wanting it to hyphenate.


I noticed that most readers and reading software have serious problems with long words. I'm talking about standard-ascii. Like this:
Transvaaltruppentropentransporttrampelthiertreiber trauungsthraenentragoedie! :D

My solution was to insert small spaces after each letter. Lucklily, with this text this strategy was possible.

Even <span>s won't help. I guess, inserting something is the only way to help certain reader software to find a spot to break the word to the next line.

I know, you told us you don't want to do so. So i'm sorry, but i don't see any other way

edit: ----------------------------------------------------
It was not in my intention to add as space into the long word shown above. The MR-editor did it.

Jellby
08-19-2012, 03:16 AM
Newer ADE versions, like the 1.8 preview (is it still a preview? is it still available?) or the embedded versions in newer readers can hyphenate. It's not a perfect feature (my reader will sometimes leave a single letter in a line, or insert a hyphen between a letter and a punctuation character), but it won't allow words to overflow a line.

Or you could use a zero-width space (http://en.wikipedia.org/wiki/Zero-width_space) (& #8203;), but that's inserting special characters.

BKh
08-19-2012, 09:45 AM
Then again, I cannot imagine too many words that would be longer than a line.

Some languages make heavy use of compound words. It's not extremely common to have words that long, but it does happen.

You might want to make a note at the beginning of your book asking the reader to switch their book view to landscape, if that is possible on the Kindle. That is, they would hold and read their book with the longest screen dimension horizontal. That will allow longer lines. If editing for epub, also make sure you pull out all non breaking spaces to avoid compounding the problem of overlong words.

Actually, the Kindle just wraps the line if it is longer than the screen width. Since I personally use a Kindle, this is the behaviour I am accustomed to. It was when I used a Sony Reader that I saw the problem with long words not displaying.

Removing any non-breaking spaces is a great idea.

Thanks everyone.

HarryT
08-19-2012, 04:22 PM
What language is this? It'll be a problem in any "agglutinative" language which forms sentences by joining words together. Turkish is perhaps the most commonly encountered (for a European, anyway) agglutinative language.

BKh
08-20-2012, 08:25 AM
The language is Pali, the scriptural and liturgical language of Theravada Buddhism.

mrmikel
08-22-2012, 08:10 AM
I did go to a site that was a dictionary of sorts for Pali. I noted that he used hyphens on some of the larger words. Whether this is typical, it might be an acceptable way to display, assuming the device will break on hyphens. I frankly don't know how the various devices handle them.

BKh
08-22-2012, 08:47 AM
I did go to a site that was a dictionary of sorts for Pali. I noted that he used hyphens on some of the larger words. Whether this is typical, it might be an acceptable way to display, assuming the device will break on hyphens. I frankly don't know how the various devices handle them.
Wow. Thanks for taking the time to investigate that. It's true hyphens are used by some people, but I really want to avoid modifying the original text at all. I realize this is a big limitation I am setting.

Thanks all. I think I will just hope that in the future ADE finds a new way to work with this.

HarryT
08-22-2012, 01:06 PM
What solution are you looking for? The word either has to run off the end of the page or else be broken; there is no other alternative, is there?

Jellby
08-23-2012, 03:47 AM
Third option: render it with a reduced font size so it fits in the page (I hope no serious ebook reader does this ever).

I think he wants the word to be broken, but without having to modify the HTML code (just the CSS).