[css3-text] character-based alignment ambiguously defined

The current editor's draft of the CSS3 Text spec defines a way of
specifying character-based alignment as an additional property value
for text-align [1].  It doesn't seem clearly defined at an
implementation level and I'm not sure I see a strong use case for it. 
I would suggest this functionality be dropped in the interests of
moving more important features forward.

Example:

  td { text-align: "." center; }

  <table>
  <col width="40">
  <tr><td> $1.30</td></tr>
  <tr><td> $2.50</td></tr>
  <tr><td> $10.80</td></tr>
  <tr><td> $111.01</td></tr>
  <tr><td> $85</td></tr>
  <tr><td> $.05</td></tr>
  <table>

This would render the numeric values centered around the decimal point:

      $11.30
      $22.50
       $0.80
  $200567.01
      $85.  
      N/A   
        $.05

The spec defines the behavior with this wording:

  When multiple cells in a column have an alignment
  character specified, the alignment character of each such
  cell in the column is centered along a single
  column-parallel axis and the rest of the text in the
  column shifted accordingly. (Note that the strings do not
  have to be the same for each cell, although they usually are.)
  
There are a number of things that aren't clear from this wording.  In
the example above, is it the alignment character that's centered?  Or
the minimum containing rectangle for all the lineboxes in the column?
The example in the spec shows neither of these.  Where is the
alignment character placed when 'right' or 'left' values are used? 
Would the two examples below render with the decimal place at the same
point?

  td { text-align: "." right; }

  <table id="table1">
  <col width="40">
  <tr><td> $1.30</td></tr>
  <tr><td> $85</td></tr>
  <tr><td> $.05</td></tr>
  <table>

  <table id="table2">
  <col width="40">
  <tr><td> $85</td></tr>
  <tr><td> $1.30</td></tr>
  <tr><td> $.05</td></tr>
  <table>

The spec also includes:

  A keyword value may be specified in conjunction with the
  <string> value; if it is not given, it defaults to 'right'.
  This value is used:

  - when character-based alignment is applied to boxes that
    are not table cells.

So the effect of 'text-align: "." center;' on an element that isn't a
table cell is what exactly?  Is it equivalent to 'text-align: center;'?

Is there a use case for left-aligned character alignment?

What happens in the example below?

  td.a { text-align: "." left; }
  td.b { text-align: "." right; }

  <table>
  <col width="40">
  <tr><td class="a"> $1.30</td></tr>
  <tr><td class="b"> $1.30</td></tr>
  <tr><td class="a"> $85</td></tr>
  <tr><td class="b"> $85</td></tr>
  <tr><td class="a"> $.05</td></tr>
  <tr><td class="b"> $.05</td></tr>
  <table>

I don't know table algorithms well enough to comment authoritatively
but it seems like this feature as specified is going to introduce some
hairy column adjustment code into table implementations.  I think the
problem is that you're trying to set column-level attributes from
within individual cells which is funky at best.

Overall, I think this is a very awkward way of specifying
decimal-alignment and it doesn't really seem to fit a natural use
case; most numeric tables include the same number of decimal places
throughout a table for consistency.  If there aren't other clear use
cases, I suggest this be dropped or at least moved to CSS4 Text.

Regards,

John Daggett

[1] http://www.w3.org/TR/css3-text/#character-alignment

Received on Wednesday, 28 November 2012 06:51:32 UTC