Re: Typographical psuedo selectors

John Anthony Lewis writes:

> In printing, I believe it's common that, e.g., a 
> comma is italicized if the word before the comma is 
> italicized. Now, let's say I'm marking up a document 
> in XML, and I have a 'movie' element for marking 
> movies. I don't want to have '<movie>American 
> Beauty,</movie>' because the comma isn't part of the 
> movie's title. However, assuming I have a style 
> sheet that renders all movies in italic type, what 
> can I do to italicize the comma without introducing 
> extraneous markup?

Yes, it is an interesting problem. In some similar cases I have
already resorted to using color instead of italics, because the
mark-up didn't enclose the punctuation...

Quotation marks are another difficult case: in some typographical
traditions, commas and periods are put inside the quotes:

   "Tomorrow," he said, "I will."
   They are called "blobs," whether you like it or not.

With proportional fonts it definitely looks better. But the structural
mark-up would be something like:

   <q>Tomorrow</q>, he said, <q>I will</q>.
   They are called <x>blobs</x>, whether you like it or not.

or, as some people claim:

   <q>Tomorrow<inter>, he said, </inter>I will</q>.

(because some styles have a line break + em dash at the start of a
quote, rather than quotes around it: q:before {content: "\A\2014"}.)

The rules of grammar, typography and XML don't quite fit together. A
sentence isn't always a tree and the style doesn't always align with
the structure. 

In the case of a comma after an italic word, the visual difference is
usually small (depending on the font), but in the case of a larger
symbol (semicolon, exclamation mark...) some care has to be taken that
either the symbol is in italics or some extra space is inserted before
it. (TeX call this space the "italic correction.")

In CSS we have so far avoided these fine points of typography.
Renderers were allowed to be smart and automatically adjust the
typography in areas not explicitly covered by any properties. But as
CSS increases its coverage and becomes more precise, maybe these
things should be put under the control of the designer as well.

For example, in some cases (user manuals, in particular) you would
want to avoid ambiguity at the cost of beauty and keep the punctuation
outside the quotes:

   Type the word "move," followed by a space and...
   Type the word "move", followed by a space and...

I don't know what the best solution would be, but here are some
possibilities:

1) Use more mark-up, such as attributes:

    ... the movie <movie title="American Beauty">American
      Beauty,</movie> which...

2) A property to turn certain kinds of automatic adjustments on (cf.
   TeX's \frenchspacing):

    body { typographic-corrections: italic smart-quotes line-ends }

3) A pseudo-element to address typographic units:

    *:punc-after-italic { font-style: italic }



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France

Received on Tuesday, 4 September 2001 09:36:51 UTC