Re: A proposed standard for CSS-controlled sentence spacing

On 1/12/13 6:48 PM, Markus Ernst wrote:
> Whether sentence spacing belongs to formatting, or rather to type
> design, is debatable. As a typographer I'd see it rather as a part of
> type design, similar to word spacing.

Word spacing is completely adjustable via CSS right now.

> (Besides, typing double spaces looks content-based to me, too.)

My objection to using spaces directly via entities or pre-wrap is that 
this if formatting akin to a typewriter, or ascii terminal artwork.  I'm 
advocating for using content to be interpreted by the rendering engine 
and then formatted accordingly.  This isn't unprecedented, as 
text-autospace already provides formatting purely based on content, as I 
understand it.

> Though I personnally don't like double spaces at sentence boundaries, I
> agree with you that it would be nice to have a solution for it in
> HTML/CSS, but I'd prefer a solution that covers other use cases, too (as
> I mentioned in an other branch of this thread).

I prefer a dedicated approach, because of semantic benefits for 
text-to-speech and machine translation, and because of how it could 
interact with existing settings, e.g. I'd expect sentence spacing to be 
relative to word spacing, i.e. make sentence spacing 0.5 em wider than 
word spacing.

Nevertheless, I've thought about a couple of different approaches that 
are more generic that could achieve sentence spacing, but also 
potentially be useful for many other things.

1. A generic spacing parameter to apply to inline elements.  NOT the box 
model, as I don't think it's appropriate to extend that.  But rather 
something that describes how inline elements relate to each other.  I've 
thought of some schemes but they're complicated, because what if two 
adjacent elements don't agree on how they should be spaced with each 
other.  I don't think you should simply have an additive thing, because 
in the most common case, sentence spacing, you'd end up specifying a 
value that's always half of what you actually want.  It's possible that 
you could have a spacing-right and a spacing-left parameter, and people 
who wanted sentence spacing would then pick just one of them.

I think this solution would end up too convoluted, but maybe I just 
haven't tried hard enough.

2. A pseudo-element that would match any text and format it accordingly. 
  You could match by regular expressions, glob patterns, or straight 
string matches.  This is what it might look like when used to convert 
the two-space sentence separation into CSS-controlled spacing:

body:match { regexp:"[.!?]  "; word-spacing:0.75em; }

You could also implement single space sentence boundary detection and 
formatting with a set of patterns:

body:match { regexp:"[a-z][.!?] [A-Z]"; word-spacing:0.75em; }
body:match { regexp:"Mr. [A-Z]"; word-spacing:0em; }
body:match { regexp:"Mrs. [A-Z]"; word-spacing:0em; }
body:match { regexp:"Ms. [A-Z]"; word-spacing:0em; }

And so on; a lot more rules would probably be needed for that particular 
usage.

I think this solution would be too expensive during page rendering.  But 
wow it would be powerful in a lot of situations.

       tom

Received on Sunday, 13 January 2013 07:55:09 UTC