14 messages in org.css-discuss.lists.css-d[css-d] font-family font sizes
FromSent OnAttachments
David SharpApr 24, 2007 3:07 am 
Simon WhiteApr 24, 2007 3:30 am 
Philippe WittenberghApr 24, 2007 3:54 am 
David SharpApr 24, 2007 10:50 pm 
Jukka K. KorpelaApr 25, 2007 2:57 pm 
Philippe WittenberghApr 25, 2007 4:53 pm 
Jukka K. KorpelaMay 17, 2007 2:44 pm 
Philippe WittenberghMay 17, 2007 7:03 pm 
Bruno FassinoMay 18, 2007 4:25 am 
Jukka K. KorpelaMay 18, 2007 8:03 am 
Jukka K. KorpelaMay 28, 2007 11:07 am 
Lori LayMay 28, 2007 1:37 pm 
Jukka K. KorpelaMay 28, 2007 1:54 pm 
Philippe WittenberghMay 28, 2007 5:19 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[css-d] font-family font sizesActions...
From:Bruno Fassino (@)
Date:May 18, 2007 4:25:23 am
List:org.css-discuss.lists.css-d

On 5/18/07, Philippe Wittenbergh <emps at l-c-n.com> wrote:

On May 18, 2007, at 6:44 AM, Jukka K. Korpela wrote:

On Thu, 26 Apr 2007, Philippe Wittenbergh wrote:

The only problem I have atm is finding the aspect value for a given font. The font contains that information, but I haven't found an utility to tell me that value, nor any resource for it - especially for fonts I don't have.

This sounds like an odd situation. Are we all expected to find out such things by ourselves?

I don't know if the following is accurate or not, anyway:

- The aspect ratio is defined as ratio between x-height and font-size. - The x-height is the unit used in CSS lengths expressed in 'ex'. - Gecko seems able to use an accurate 'ex' unit (I guess it is extracted from the font in use, even version not supporting font-size-adjust seem to have a good 'ex')

Putting together the above, if we trust Gecko, the aspect ratio of a font can be obtained simply observing the size of an element dimensioned using 'ex' units. I've created a quick and dirty test page [1], with includes due elements sized one in 'em' and another in 'ex'. A javascript gets the size of the elements in pixels and computes their ratio. This should be the aspect value of the font in use. To minimize errors a big font size is used (and the computation is repeated with some different font size / widths, the results compared, and discrepancies signaled.)

I get reasonable results, maybe with the exception of Verdana, where I get as aspect value 0.55 (not 0.58) In the page I've also added a red line drawn at 'baseline - x-height' to visually check the accuracy of the computed x-height. And there is the possibility to choose a second font family, which is then displayed (with and without font-size-adjust) together with the main one (Again: the page makes sense only if using Gecko.)

Bruno

[1] http://brunildo.org/test/xheight.pl