[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[W3-dev] wrong font-size calculations in css.el and font.el
From: |
Klaus Straubinger |
Subject: |
[W3-dev] wrong font-size calculations in css.el and font.el |
Date: |
Fri, 15 Dec 2006 10:17:48 +0100 (CET) |
The function css-expand-length does not take the default character size
in pixels into account when calculating em and ex values. This results
typically in values very much too large.
I would like to suggest using something like the following in the
condition branch that deals with em and ex values:
(round (font-spatial-to-canonical
(concat (number-to-string
(* (string-to-number (match-string 1 spec))
(if height (frame-char-height) (frame-char-width))))
"px")))
I don't know if it is advisable to use font-spatial-to-canonical. But
it could be used in other places in this function too.
By the way, this function font-spatial-to-canonical has another bug:
Pixel values are calculated with
(setq retval (* num (/ pix-width mm-width) (/ 25.4 72.0))))
instead of the correct
(setq retval (* num (/ mm-width pix-width) (/ 72.0 25.4))))
i.e., exactly the other way round with respect to dividing and
multiplying.
--
Klaus Straubinger
- [W3-dev] wrong font-size calculations in css.el and font.el,
Klaus Straubinger <=