all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: Kenichi Handa <handa@m17n.org>
Cc: emacs-devel@gnu.org, rms@gnu.org, storm@cua.dk
Subject: Re: A bug in tetris
Date: Thu, 23 Aug 2007 13:38:45 +0100	[thread overview]
Message-ID: <m2d4xe77e2.fsf@cam.ac.uk> (raw)
In-Reply-To: <E1IOBcr-0002cn-S9@etlken.m17n.org> (Kenichi Handa's message of "Thu, 23 Aug 2007 21:17:25 +0900")

On 2007-08-23 13:17 +0100, Kenichi Handa wrote:
> In article <E1INSWq-0003IU-BH@etlken.m17n.org>, Kenichi Handa <handa@m17n.org> 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	other threads:[~2007-08-23 12:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-18 18:45 A bug in tetris Leo
2007-08-19 15:07 ` Johan Bockgård
2007-08-19 15:22   ` Mathias Dahl
2007-08-19 15:37     ` Johan Bockgård
2007-08-19 16:00       ` Mathias Dahl
2007-08-19 18:02       ` Leo
2007-08-19 18:27         ` Sven Joachim
2007-08-19 18:52           ` Leo
2007-08-19 22:27         ` Kim F. Storm
2007-08-20  1:30           ` Kenichi Handa
2007-08-20 10:37             ` Kim F. Storm
2007-08-20 18:30             ` Richard Stallman
2007-08-21  8:32               ` Kim F. Storm
2007-08-21 12:08                 ` Kenichi Handa
2007-08-23 12:17                   ` Kenichi Handa
2007-08-23 12:38                     ` Leo [this message]
2007-08-21 23:24                 ` Richard Stallman
2007-08-20 15:16         ` Richard Stallman
2007-08-20 17:25           ` Leo
2007-08-19 22:30       ` Richard Stallman
2007-08-19 17:58   ` Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2d4xe77e2.fsf@cam.ac.uk \
    --to=sdl.web@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=handa@m17n.org \
    --cc=rms@gnu.org \
    --cc=storm@cua.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.