¶ The font-stretch property was introduced in CSS 2.0 over ten years ago, but was culled in the transition to CSS 2.1. It now languishes in the CSS 3 Fonts module. The property instructed browsers to select a ‘normal, condensed, or extended face from a font family’. Its removal from CSS 2.1 was due to a complete lack of implementation by browsers. Unfortunately this leaves us with a gaping hole regarding font support.
Many professional typefaces are designed with extended and condensed styles. This is particularly prevalent in sans-serif faces such as Myriad Pro, Futura, Univers and of course Helvetica. Another such font is American Typewriter, which is shipped with Mac OS X and comes with a condensed style.
So how does one specify text to be rendered in American Typewriter Condensed? Using font-stretch we would have done this:
p {
font-family:"American Typewriter", monospace;
font-stretch:condensed; }
The font-stretch property is well defined. As you can see it takes keywords, covering the range from ultra-condensed to ultra-expanded. But as stated earlier, it is no longer in the CSS 2 spec, and hence (and because) it is not supported in any browser at the time of writing.
Using the methodology I described for font-weight, there is a workaround based on font-family. We can specify American Typewriter Condensed as follows:
p {
font-family:"AmericanTypewriter-Condensed",
"American Typewriter Condensed",
"American Typewriter", monospace}
As with specifying font weights in this manner, there is a caveat that any widened or otherwise styled text will require a further font-family rule. There is also the caveat – in this case – that it doesn’t work at all on Firefox 3. See for yourself in the test case.
Because Firefox 3 respects font-family rules properly; that is to say it goes by the font family name, not the individual font name; it ignores the ‘Condensed’ font names. This inherently eliminates the possibility of displaying the condensed style using the font-family workaround.
So how will this situation be rectified? If font-stretch were still in CSS 2, browser makers would be trying to support it. But Microsoft won’t implement anything from CSS 3 until it is nailed down to a Candidate Recommendation. Webkit and Mozilla have higher CSS 3 priorities. And the CSS working group won’t reintroduce font-stretch to CSS 2 until someone implements it. Catch 22.
As I see it, our hopes lay at the feet of someone attending to either Webkit Bug 12530 or Mozilla Bug 3512. I would if I could. Can you?













Comments
1
You can use @font-face to load the font you want :-) Ok, that eliminates Fx3 again, and some other browsers… But it is a step forward :-).
And I’m pretty sure that John Daggett has been working on this for Gecko, but he isn’t there yet. The issue is not easy, especially on the Windows platform, where fonts are typically grouped as in groups of four faces. Have you ever managed to get multiple font-weights to work correctly on Windows (with Firefox) ? I have Myriad and Minion installed on one of my VM’s but the browser only shows normal and bold. Works fine, of course, on Mac and Linux.
The same problem(s) apply to font-stretch.
2
Yeah, font-stretch fell off my plate for FF 3.5. I should get to this for the next version, modulo some of the issues Philippe mentions. Jonathan Kew is looking at the problem of font family unification.
3
Thanks for the comment John. I do appreciate this is a very difficult thing to solve, particularly so on Windows, but also due to inconsistent font handling and labelling across foundries, operating systems, and any other vagary one cares to mention.
Probably why the uptake of font-stretch was so low in the first place (that and the general low distribution of fonts with different widths). It’s good to hear there is an ongoing effort – it’s appreciated.
4
@font-face seems to be the beginning of the solution. It just needs fleshing out and expanding. Then it needs to get implemented by all the major browsers. Then it needs to be made to work the same way in all browsers. Oh yeah, after everyone is cool with the legal issues. What a mess!
5
I have always wanted to know how to stretch the font, thanks for the information, yes you can teach an old dog new tricks at least when it comes to font.
Add your comment
Comments are now closed on this post. If you have more to say please contact me directly.