[Top][All Lists]

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

Re: A bug in tetris

From: Kenichi Handa
Subject: Re: A bug in tetris
Date: Tue, 21 Aug 2007 21:08:12 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.0 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

In article <address@hidden>, address@hidden (Kim F. Storm) writes:

> I answered (vaguely) yesterday, but I now recall the reasoning
> for not making it standard:

> In most cases, I would assume that if you put a face
> (with a smaller line height) on the text on a whole line, 
> you also put that face on the newline if you want the whole
> line to have the smaller line height.

> If you leave the default face on the newline, you (probably)
> want to have the default line spacing for the line even if the
> text on the line is in a smaller face.

> So this is the current default behaviour (as it was in 21.x)
> -- which IMO is correct for normal use cases.

> In the rare case where a line is in the default face, but only
> contains (small height) images (e.g. in a game grid or a sliced image)
> do you get into a case where the height of the newline may get into
> the way -- that is why I made a special line-height=t property for the
> newline to handle such unusual cases.

> The insert-sliced-image function uses this property.

> Game grid functions should do that too.

> Conclusion: I think we should keep the current default.

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.

Kenichi Handa

reply via email to

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