tags:

views:

65

answers:

1

My fonts of choice usually default to text figures

Text figures

which is one reason I like them. However, for tables or headings I'd like to specify that lining figures should be used:

Titling figures

Is there a way to do so in CSS?

(To appease the search:

  • old-style numerals, text figures, non-lining figures, medieval numerals
  • lining numerals, titling figures)
+1  A: 

No, there's no such property in the CSS 2.1 specification. It's up to the web browser to chose a font available in the system and render it with whatever the ‘default’ style is.

A quick look in the CSS 3 Working Draft also doesn't reveal an option like this.

And although you can use the @font-face property in newer browsers, there doesn't seem to be an option to select OpenType features in general (like using lining or oldstyle figures).

A quick search revealed there has been a discussion about this on the W3 CSS mailing list.

Marcel Korpel
Hm, I feared as much. It's interesting that CSS allows quite fine-grained control over typesetting in some cases and almost completely neglecting typography.
Joey
@Johannes You can, of course, use that granularity to do what you want. Using @font-face, you can define the alternate style as "Font Name Lining" or assign it as you would a completely different font.
D_N
@D_N: agreed, though @font-face is [not that widely supported](http://webfonts.info/wiki/index.php?title=%40font-face_browser_support), yet.
Marcel Korpel
I have to disagree on that. Compare that table against what's currently in use and the adoption curve of most (non-IE) browsers. You easily have a supermajority of browsers. Besides, if you're going to use a custom font at all you have to either use @font-face or something similar which will have the same limitations (Cufon, etc.).
D_N
Ok, if I understand correctly, `@font-face` requires me to distribute a font I probably don't have permissions distributing *and* modify it appropriately that it uses the other numeral variants by default (which I likely also don't have permission to do). So is the `@font-face` rule only for people who do both webdesign and cut typefaces (I suspect their number is vanishingly small) or where freely-available fonts can be used.
Joey
@Johannes: Unfortunately, yes. But there's hope: the [Web Open Font Format (WOFF)](https://developer.mozilla.org/en/About_WOFF).
Marcel Korpel