ajax333221
ajax333221

Reputation: 11764

Can I set font-size accordingly to font availability?

Is it possible to set a different font-size according to font availability?

Currently my problem is that Verdana is too big, and if the user don't have Verdana installed, I will end up with a very small font-size

Is there is any way to set a font (Verdana in my case) to 13px and if the user don't have that font installed, try with another font (Arial for example) but with bigger font-size?

Notes:

Upvotes: 10

Views: 436

Answers (3)

Capagris
Capagris

Reputation: 3841

Font-size adjust only works with Firefox

The standalone 'font' css declaration only allows you to state font-size, style and weight once before declaring the different font families in succession so that's a no-go either

I'm sorry to say this cannot be done through css alone

As for the JS alternative, here's the one I recommend:

http://www.lalit.org/lab/javascript-css-font-detect/

Good luck

Upvotes: 0

ScottS
ScottS

Reputation: 72261

This might take some work to implement (I have not ever actually done it myself), but it seems that the font-size-adjust property helps "equalize" font's by standardizing the x-height. See http://www.w3.org/TR/css3-fonts/#propdef-font-size-adjust for the official description.

Upvotes: 2

ptriek
ptriek

Reputation: 9276

As was answered just a minute ago by someone else (but already deleted?), you could use Font Detector Javascript solution:

http://jsfiddle.net/FHnJw/1

Upvotes: 2

Related Questions