On 5/18/07, Philippe Wittenbergh <[EMAIL PROTECTED]> 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 ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7 information -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/