[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A bug in tetris

From: Leo
Subject: Re: A bug in tetris
Date: Thu, 23 Aug 2007 13:38:45 +0100
User-agent: Gnus/5.110007 Emacs/23.0.0 (20070727) Fedora 7 (gnu/linux)

On 2007-08-23 13:17 +0100, Kenichi Handa wrote:
> In article <address@hidden>, Kenichi Handa <address@hidden> 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 <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

         Gnus is one component of the Emacs operating system.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]