comparison lisp/font.el @ 2685:64752935473d

[xemacs-hg @ 2005-03-25 15:58:02 by aidan] Fix pixel-to-point conversion arithmetic in font.el--thank you, Ralf Angeli.
author aidan
date Fri, 25 Mar 2005 15:58:03 +0000
parents 491f8cf78a9c
children ad2f4ae9895b 3742ea8250b5
comparison
equal deleted inserted replaced
2684:800fef0b5c75 2685:64752935473d
309 309
310 Canonical sizes are in points. If SPEC is null, nil is returned. If SPEC is 310 Canonical sizes are in points. If SPEC is null, nil is returned. If SPEC is
311 a number, it is interpreted as the desired point size and returned unchanged. 311 a number, it is interpreted as the desired point size and returned unchanged.
312 Otherwise SPEC must be a string consisting of a number and an optional type. 312 Otherwise SPEC must be a string consisting of a number and an optional type.
313 The type may be the strings \"px\", \"pix\", or \"pixel\" (pixels), \"pt\" or 313 The type may be the strings \"px\", \"pix\", or \"pixel\" (pixels), \"pt\" or
314 \"point\" (points), \"pa\" or \"pica\" (picas), \"in\" or \"inch\" (inches), \"cm\" 314 \"point\" (points), \"pa\" or \"pica\" (picas), \"in\" or \"inch\" (inches),
315 (centimeters), or \"mm\" (millimeters). 315 \"cm\" (centimeters), or \"mm\" (millimeters).
316 316
317 1 in = 2.54 cm = 6 pa = 25.4 mm = 72 pt. Pixel size is device-dependent." 317 1 in = 2.54 cm = 6 pa = 25.4 mm = 72 pt. Pixel size is device-dependent."
318 (cond 318 (cond
319 ((numberp spec) 319 ((numberp spec)
320 spec) 320 spec)
349 (setq type "px" 349 (setq type "px"
350 spec spec))) 350 spec spec)))
351 (setq num (string-to-number spec)) 351 (setq num (string-to-number spec))
352 (cond 352 (cond
353 ((member type '("pixel" "px" "pix")) 353 ((member type '("pixel" "px" "pix"))
354 (setq retval (* num (/ pix-width mm-width) (/ 25.4 72.0)))) 354 (setq retval (* num (/ mm-width pix-width) (/ 72.0 25.4))))
355 ((member type '("point" "pt")) 355 ((member type '("point" "pt"))
356 (setq retval num)) 356 (setq retval num))
357 ((member type '("pica" "pa")) 357 ((member type '("pica" "pa"))
358 (setq retval (* num 12.0))) 358 (setq retval (* num 12.0)))
359 ((member type '("inch" "in")) 359 ((member type '("inch" "in"))