changeset 91013:850287d64489

(gamegrid-setup-default-font): Calculate a font height that doesn't exceed the requested height by rounding off.
author Kenichi Handa <handa@m17n.org>
date Thu, 23 Aug 2007 12:13:24 +0000
parents 87ebf7823e2d
children 2392e6a45952
files lisp/play/gamegrid.el
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/play/gamegrid.el	Wed Aug 22 12:34:48 2007 +0000
+++ b/lisp/play/gamegrid.el	Thu Aug 23 12:13:24 2007 +0000
@@ -320,7 +320,14 @@
 			  (< max-height height))
 		      (setq max-height height))))))
       (when (and max-height (< max-height 1))
-	(set-face-attribute gamegrid-face nil :height max-height)))))
+	(let ((default-font-height (face-attribute 'default :height))
+	      (resy (/ (display-pixel-height) (/ (display-mm-height) 25.4)))
+	      point-size pixel-size)
+	  (setq point-size (/ (* (float default-font-height) max-height) 10)
+		pixel-size (floor (* resy (/ point-size 72.27)))
+		point-size (* (/ pixel-size resy) 72.27))
+	  (set-face-attribute gamegrid-face nil
+			      :height (floor (* point-size 10))))))))
 
 (defun gamegrid-initialize-display ()
   (setq gamegrid-display-mode (gamegrid-display-type))