Mobileread
CSS for line breaks after dashes?
#1  JaneFancher 04-04-2010, 02:52 PM
Is there some way to put into the ... I suppose CSS code some trigger so that the flowable type will automatically break at hyphens, em-, and en-dashes? Maybe even before or after ellipses?

I tend to use these a fair amount, especially in dialogue, and when you add flowable type and full justification, you can get a lot of unattractively spread out lines.

At the moment, I'm just putting a space at one side or the other (depending on where it occurs in the dialogue) but I'd sure rather just do it closed and have a break put in as necessary for the situation.
Reply 

#2  paulpeer 04-05-2010, 05:49 AM
As far as I know hypenation is controlled by the hyphenation dictionary. There are some CSS working drafts on hyphenation, but they give only a few possibilities to link to the dictionary such as
Code
{ hyphenate-dictionary: <uri>; }
See for more examples

http://www.w3.org/TR/2007/WD-css3-gcpm-20070205/#hyphenation

An alternative is adding a soft hyphen after every em- and en-dash, but this is generally not recommended, because many readers make a complete mess of ePubs with soft hyphens. See e.g. the top of this thread: http://www.mobileread.com/forums/showthread.php?t=28139
Reply 

#3  Jellby 04-05-2010, 08:45 AM
Whether or not a line break is allowed after a dash should be language and context dependent. The Mobipocket firmware on the Cybook does not break after dashes, which is OK for Spanish, but for English it can result in severely underfull lines (that's why I chose to use "space-endash-space" in my books). But the ePUB firmware does break lines after dashes, which is wrong and ugly for Spanish. I have reported this to Bookeen, and they've asked me a sample file and screen picture, so I guess they'll at least look into it. In French the dashes are usually spaced from the text, so one can use non-breaking spaces to prevent that, and I use it. The option that remains is using zero-width breaking (& #8203;) or non-breaking (& #8288;) spaces before and after each dash, but this is cumbersome, and I'm afraid support for them in different readers is as reliable as usual.
Reply 

#4  JSWolf 04-05-2010, 08:59 AM
ePub will be no issue. It does break the way you want.
Reply 

#5  JaneFancher 04-05-2010, 12:18 PM
Great! Thanks, all.
Reply 

Today's Posts | Search this Thread | Login | Register