From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.devel Subject: Re: A bug in tetris Date: Thu, 23 Aug 2007 13:38:45 +0100 Message-ID: References: <7dbe73ed0708190822o5431b2b7m437a1d5073afe55@mail.gmail.com> <87hcmvp3bn.fsf@kfs-lx.testafd.dk> <87sl6dp9tg.fsf@kfs-lx.testafd.dk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1187872820 16036 80.91.229.12 (23 Aug 2007 12:40:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 23 Aug 2007 12:40:20 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, storm@cua.dk To: Kenichi Handa Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 23 14:40:17 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IOByy-0006zw-Pt for ged-emacs-devel@m.gmane.org; Thu, 23 Aug 2007 14:40:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IOByu-00055j-Fd for ged-emacs-devel@m.gmane.org; Thu, 23 Aug 2007 08:40:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IOByr-000556-CB for emacs-devel@gnu.org; Thu, 23 Aug 2007 08:40:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IOBym-00053W-77 for emacs-devel@gnu.org; Thu, 23 Aug 2007 08:40:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IOBym-00053T-4e for emacs-devel@gnu.org; Thu, 23 Aug 2007 08:40:04 -0400 Original-Received: from ppsw-3.csi.cam.ac.uk ([131.111.8.133]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IOByb-00057F-L0; Thu, 23 Aug 2007 08:39:54 -0400 X-Cam-SpamDetails: Not scanned X-Cam-AntiVirus: No virus found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Original-Received: from accountslaptop.gradunion.cam.ac.uk ([193.60.92.141]:47646 helo=sl392.st-edmunds.cam.ac.uk) by ppsw-3.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.153]:587) with esmtpsa (LOGIN:sl392) (TLSv1:DHE-RSA-AES256-SHA:256) id 1IOByA-0001Az-Bz (Exim 4.63) (return-path ); Thu, 23 Aug 2007 13:39:26 +0100 In-Reply-To: (Kenichi Handa's message of "Thu, 23 Aug 2007 21:17:25 +0900") User-Agent: Gnus/5.110007 Emacs/23.0.0 (20070727) Fedora 7 (gnu/linux) X-Detected-Kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:77027 Archived-At: On 2007-08-23 13:17 +0100, Kenichi Handa wrote: > In article , Kenichi Handa writes: > >> I don't have a strong objection to it. Anyway, I found that >> the current problem is in the different place. gamegrid.el >> has this function. > >> (defun gamegrid-setup-default-font () >> (setq gamegrid-face >> (copy-face 'default >> (intern (concat "gamegrid-face-" (buffer-name))))) >> (when (eq gamegrid-display-mode 'glyph) >> (let ((max-height nil)) >> (loop for c from 0 to 255 do >> (let ((glyph (aref gamegrid-display-table c))) >> (when (and (listp glyph) (eq (car glyph) 'image)) >> (let ((height (cdr (image-size glyph)))) >> (if (or (null max-height) >> (< max-height height)) >> (setq max-height height)))))) >> (when (and max-height (< max-height 1)) >> (set-face-attribute gamegrid-face nil :height max-height))))) > >> It tries to make a face height shorter than the grid-glyph >> height. I confirmed that when I change the last line to: > >> (set-face-attribute gamegrid-face nil :height (- max-height 0.1)))))) > >> the resulting face is good and doesn't produce 1-dot >> horizontal gap in the play field. I'm now investigating >> why the original code isn't good enough. > > The source of the problem is the rounding off done while > converting a point size to pixel size. In my environment, > resolution of the screen is 96dpi, grid-glyph height is > 16dots, canonical char height is 20dots, the default font > height is 12.1pt, thus the requested height of the font is > 9.6pt (== 12.1 * (16 / 20)). The corresponding pixel size > is 12.75 (== 96 * (9.6 / 72.27)). So, it's rounded off to 13, > but what we want here is a font of 12 pixel size. > > So, I've just installed the attached change. It may be > possible to add a special face attribute to tell not to > choose a font that is larger than the requested size, but > that require many C code changes. In addition, I think such > a case (need a font equal to or smaller than a requested > size) is rare. [...] Thanks. The patch works great. -- Leo (GPG Key: 9283AA3F) Gnus is one component of the Emacs operating system.