[css-text] css letter-spacing should affect tab stops

On 01/27/2015 01:31 PM, L. David Baron wrote:
>
> Though it's worth noting that the current spec computes tab stops
> based on the characteristics of the block, not based on inlines
> within them.
>
> If we want to change that, I think we should change it wholesale,
> and not have it one way (use inlines) for letter spacing and the
> other way (block characterisics only) for everything else (fonts).

Agreed.

Tab Atkins wrote:
>
> Changing this would presumably only affect the 'tab-size: <int>' case,
> not <length>, right?  Dunno how to interpret a <length> in order to
> add in letter-spacing.

Right. Relative lengths are just computed as absolute lengths and
can't accept magic.

> But yeah, I guess it makes sense for tabs sized with an integer to
> take into account 'letter-spacing'.

Yes, I think so too.

> There are two ways we could do this:
>
> 1. As dbaron says in the bug, make the tabs respond to
> 'letter-spacing' on their nearest block ancestor, since the tab stop
> positions are measured from the block edge.  (In other words, tabs are
> not just some number of spaces, they're "move to the next offset from
> the block edge".)
>
> 2. Make tabs respond to the 'letter-spacing' of their nearest
> (possibly inline) ancestor, meaning there are potentially multiple
> distinct tab-stop sets that different tabs would align to, each spaced
> out according to different 'letter-spacing' values..
>
> The stated use-case is using letter-spacing to make monospace fonts
> look a little more "spread out", and wanting tabs to line up with the
> resulting character spacing, so I don't see a use for the complication
> of case #2.  We should go with case #1, then.

As dbaron points out, we currently use the block font settings,
so should stay consistent with this. There's a good reason for
this: so that tab indentation lines up throughout the block,
regardless of any font changes.

Note that 'word-spacing' also affects the size of spaces, so
should probably also be taken into account.

Proposal therefore is that tab stops are calculated as

   n*( width of U+0020 plus letter-spacing plus word-spacing)

I'll add it to the issues list and the WG agenda.

~fantasai

Received on Wednesday, 28 January 2015 06:26:11 UTC