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.

#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
{ hyphenate-dictionary: <uri>; }
See for more examples

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:

#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.

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

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

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