Re: [css-text] A proposal to replace 'tab-size' with 'tabstop-widths'

Since I recently considered proposing something similar myself, I’m responding to an older thread.

Nick Gravgaard 2012-12-22:
> 
> 
> I'm the inventor of elastic tabstops
> (http://nickgravgaard.com/elastictabstops/) […]
> 
> I would like to suggest something which is more powerful than 'tab-size'
> (http://www.w3.org/TR/css3-text/#tab-size) but should be easily
> implementable and would work like ''tab-size' when given one value. I
> propose a new attribute called 'tabstop-widths' which takes a list of
> widths measured in em and/or px values.

As others have pointed out back in early 2013, 
that could be handled by overloading ‘tab-size’.

> The default would be [8]

CSS has a unit for character widths: ‘ch’.

> It would however be possible to specify 
> values for the new 'tabstop-widths' attribute like '8em 70px 4em 30px' 
> which would mean the first tabstop should be positioned at a distance of 
> 8 'm's (in the current font) from the left, then at an additional 70 
> pixels, then a further 4 'm' character widths, and then a further 30 
> pixels. The last value would be repeated which would mean in the example 
> I gave the value of '30px' would be repeated for the length of the 
> element.

There’s a small i18n problem with tabbing the way you proposed: 
It’s not possible to specify the start edge. 
The default one of the box will do, though, most of the time.

If you really wanted to emulate horizontal tabulator stops and rulers 
as in word processors, you would also have to support alignment. 
Tabstops can mark left ‘⌊’, center ‘⊥’, right ‘⌋’ and decimal axes. 
In Word et alii, they’re also used for leaders (compare 
<http://dev.w3.org/csswg/css-gcpm/#leaders>) and vertical lines. 
<http://office.microsoft.com/en-us/word-help/set-tab-stops-or-clear-them-HA101854821.aspx>

Are the repeated tabstops, 30px in you example, measured 
from the end of the preceding one (12em+70px) or from the start edge? 
How would you reinstate the default 8ch to match other lines?

Why do you prefer relative, incremental tabstops 
over absolute ones measured from the start edge? 
Should both be possible to specify?

A popular use of tabstops in word processors and other software 
is in running headers and footers, even in browsers print output. 
It would suggest something like this for CSS:

 @pageheader {
   tab-position: 0% start, 50% center, 100% end; /* alias ‘tabstops’ … */
   content: string(heading, first) "\t" string(title) "\t" counter(page);
 }

The approach actually taken in GCPM is quite different, though. 
<http://dev.w3.org/csswg/css-gcpm/#running-headers-and-footers>

 @page {
   @top-left {content: string(heading, first);}
   @top-center {content: string(title);}
   @top-right {content: counter(page);}
 }

The whole thing could be part of the ‘text-align’ property, 
<http://dev.w3.org/csswg/css-text/#text-align-property>

 text-align:  0% start, 50% center, 100% end;

or the ‘text-indent’ property, as well. 
<http://dev.w3.org/csswg/css-text/#text-indent-property>

 text-indent: 0% start, 50% center, 100% end;

Although the latter already supports percentages, 
it is really just about various types of first lines. 
Therefore, as a first step, ‘text-align’ could gain percentages 
as an allowed value, where ‘0%’ = ‘start’, 
but ‘50%’ ≠ ‘center’ and ‘100%’ ≠ ‘end’.
That’s looking a bit like ‘padding-start’, of course, 
if you only consider ‘start’ alignment for tabstops.

Received on Thursday, 21 August 2014 12:24:18 UTC