Re: [css3-text] better way to do forced last-line justification

Alan Stearns wrote:

> >But using a new property for this seems like overkill, there seem
> >to be lots of combinations that have no real use case.
> >
> >  p {
> >    text-align: justify;
> >    text-align-last: center;
> >  }
> 
> I actually prefer this setting to text-align:center in some cases
> where you want a visual centering without so many ragged line edges.
> This does get used in figure captions where a single-line caption is
> centered but a multi-line caption has lines justified to the figure
> width, and the last line centered.

Ah, very good point.

Yet the full set of combinations of text-align/text-align-last still
leaves lots of combinations for which I don't think there's a clear
use case.  

  p {
    text-align: right;
    text-align-last: left;
  }

  p {
    text-align: left;
    text-align-last: center;
  }

  p {
    text-align: center;
    text-align-last: right;
  }

Curiously, the documentation for IE's 'text-justify' property includes
these values [1]:

  distribute
    Handles spacing much like the newspaper value. This form of
    justification is optimized for documents in Asian languages, such
    as Thai.
  
  distribute-all-lines
    Justifies lines of text in the same way as the distribute value,
    except that it also justifies the last line of the paragraph. This
    form of justification is intended for ideographic text.
  
  distribute-center-last
    Not implemented.
  
But IE also implements 'text-align-last', with no description of how
the two properties interact.

Example (what should happen?):

  p {
    text-justify: distribute-center-last;
    text-align-last: left;
  }

Another approach is the Line Justification enumeration from Adobe's
Flash Text Engine [2]:

  ALL_BUT_LAST  
    Justify all but the last line.
  
  ALL_BUT_MANDATORY_BREAK
    Justify all but the last line and lines ending in mandatory breaks.
  
  ALL_INCLUDING_LAST
    Justify all lines.
  
  UNJUSTIFIED
    Do not justify lines.
  
The value covering mandatory breaks is interesting, I'm assuming that
'text-align-last' doesn't cover mandatory breaks.

So I think we could either include values like 'justify-all' and
'justify-center-last' in the text-align property or fiddle with it
within the 'text-justify' property.

Or how about something like this?

  line-justification: normal | all-lines | center-last

where 'normal' means justify all but the last line, 'all-lines' means
justify the last line too and 'center-last' means justify all lines but
center the last line. I think that probably better covers the plausible
use cases.

I'm not sure if handling mandatory breaks is important or not...

Cheers,

John

[1] http://msdn.microsoft.com/en-us/library/ie/ms531172(v=vs.85).aspx
[2] http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/engine/LineJustification.html

Received on Thursday, 29 November 2012 07:16:04 UTC