Handling of widows

0 views
Skip to first unread message

Matt McManus

unread,
May 6, 2009, 10:49:05 AM5/6/09
to cufón
Hey all,

I was wondering if there were plans for cufon to deal with widows. A
widow is a single word that wraps to the next line. It is generally
accepted as undesirable in the type community. I've been looking over
the JS and while I haven't had a chance to implement this on my own I
have a suggestion for how this could work.

By default, cufon wraps each word in a cufon-canvas span. The easiest
and most practical solution in my mind is to wrap the last two words
in a span called cufon-tail or cufon-widont (ala, Shaun Inman) and put
a display inline-block or just block on that span. This way if it
needs to wrap it will bring over the last two words instead of just
one.

Thoughts? Better implementations?

Simo Kinnunen

unread,
May 6, 2009, 2:35:29 PM5/6/09
to cu...@googlegroups.com
Hi Matt,

Interesting. I guess it would be possible to add basic support for
widows, but it wouldn't work in the following situation (imagine a
line break after the word "few"):

<h1>text text text ...... last <strong>few</strong> words</h1>

Do you think this would be an acceptable limitation?

About the implementation: it would be better to use white-space:
nowrap than display: block/inline-block, because it's less likely to
break the layout. But an even better solution would be to simply use
one canvas for the last two words.

Also, would you mind creating a feature request over at our issue
tracker (http://github.com/sorccu/cufon/issues)? It's the best way to
get things done.

Simo

Erik Vorhes

unread,
May 6, 2009, 3:47:07 PM5/6/09
to cufón
If there were an &nbsp; before "words" in your example, would it be
possible for Cufon to encode it as U-00A0 (a.k.a. "no-break-space") if
the Latin-1 supplement is included? I'm not sure if it would
accomplish anything different than what's already been discussed,
though. (However, I'd also advise against setting that last span as
display: block; you'd have a break before the last two words even when
not having a widow issue.)

Erik

On May 6, 1:35 pm, Simo Kinnunen <sor...@gmail.com> wrote:
> Hi Matt,
>
> Interesting. I guess it would be possible to add basic support for  
> widows, but it wouldn't work in the following situation (imagine a  
> line break after the word "few"):
>
> <h1>text text text ...... last <strong>few</strong> words</h1>
>
> Do you think this would be an acceptable limitation?
>
> About the implementation: it would be better to use white-space:  
> nowrap than display: block/inline-block, because it's less likely to  
> break the layout. But an even better solution would be to simply use  
> one canvas for the last two words.
>
> Also, would you mind creating a feature request over at our issue  
> tracker (http://github.com/sorccu/cufon/issues)?It's the best way to  

Matt McManus

unread,
May 7, 2009, 9:29:26 AM5/7/09
to cufón
The white-space: nowrap is a great idea. I can't believe I've never
used that.

Issue has been created: http://github.com/sorccu/cufon/issues#issue/20

On May 6, 2:35 pm, Simo Kinnunen <sor...@gmail.com> wrote:
> Hi Matt,
>
> Interesting. I guess it would be possible to add basic support for  
> widows, but it wouldn't work in the following situation (imagine a  
> line break after the word "few"):
>
> <h1>text text text ...... last <strong>few</strong> words</h1>
>
> Do you think this would be an acceptable limitation?
>
> About the implementation: it would be better to use white-space:  
> nowrap than display: block/inline-block, because it's less likely to  
> break the layout. But an even better solution would be to simply use  
> one canvas for the last two words.
>
> Also, would you mind creating a feature request over at our issue  
> tracker (http://github.com/sorccu/cufon/issues)?It's the best way to  

DanB

unread,
May 11, 2009, 9:56:04 PM5/11/09
to cufón
I would suggest that this feature could easily be implemented using a
separate script--possibly using the Widont technique, which adds a non-
breaking space before the last word of every paragraph. Then all that
would be needed would be for cufon to treat words separated by a non-
breaking space as one word and wrap them both in one span element.
Unfortunately, this is not how it behaves currently, but may I suggest
that the project maintainer consider implementing this change?

On May 7, 8:29 am, Matt McManus <mattmcma...@gmail.com> wrote:
> The white-space: nowrap is a great idea. I can't believe I've never
> used that.
>
> Issue has been created:http://github.com/sorccu/cufon/issues#issue/20
>
> On May 6, 2:35 pm, Simo Kinnunen <sor...@gmail.com> wrote:
>
> > Hi Matt,
>
> > Interesting. I guess it would be possible to add basic support for  
> > widows, but it wouldn't work in the following situation (imagine a  
> > line break after the word "few"):
>
> > <h1>text text text ...... last <strong>few</strong> words</h1>
>
> > Do you think this would be an acceptable limitation?
>
> > About the implementation: it would be better to use white-space:  
> > nowrap than display: block/inline-block, because it's less likely to  
> > break the layout. But an even better solution would be to simply use  
> > one canvas for the last two words.
>
> > Also, would you mind creating a feature request over at our issue  
> > tracker (http://github.com/sorccu/cufon/issues)?It'sthe best way to  

Simo Kinnunen

unread,
May 12, 2009, 5:31:11 PM5/12/09
to cu...@googlegroups.com
Hi Dan,

Ok, non-breaking spaces (\u00a0) are now supported.

Simo
Reply all
Reply to author
Forward
0 new messages