emacs-devel
[Top][All Lists]
Advanced

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

Re: set-frame-size should respect line-spacing!?


From: Ingo Lohmar
Subject: Re: set-frame-size should respect line-spacing!?
Date: Sat, 12 Oct 2019 09:12:17 +0200

On Sat, Oct 12 2019 10:00 (+0300), Eli Zaretskii wrote:

>> From: Ingo Lohmar <address@hidden>
>> Date: Fri, 11 Oct 2019 22:44:34 +0200
>> 
>> Since I tested with a minimal example, however, I did not realize before
>> that there is another code path that directly uses the C function
>> `set-frame-size', with the same effect: If line-spacing is > 0 in the
>> frame, it is not accounted for, and the frame lacks a few pixels in
>> height (number of lines * "line-spacing effect").
>> 
>> This appears to be a bug: If asked for a frame N lines tall, N lines (of
>> default-font's character height plus the effect of line-spacing) should
>> fit, right?
>
> Not necessarily.  You didn't tell which command or API exhibits this
> behavior, but in some cases we mean height in units of the frame's
> canonical character height, ion which case it doesn't include any
> effects like line-spacing etc.

The C API function is `set-frame-size'.  If you're talking about the
*caller*, this is the code from posframe.el:

(defun posframe--set-frame-size (posframe height min-height width min-width)
  "Set POSFRAME's size.
It will set the size by the POSFRAME's HEIGHT, MIN-HEIGHT
WIDTH and MIN-WIDTH."
  (if (and width height)
      (unless (equal posframe--last-posframe-size
                     (cons width height))
        (set-frame-size posframe width height)
        (setq-local posframe--last-posframe-size
                    (cons width height)))
    (fit-frame-to-buffer
     posframe height min-height width min-width)))

The "else" path has been fixed by Martin in
e3f97d73653df725322d7f2392d36f858cce5a73.  But the "then" path has
exhibits the behavior.

Are you saying `set-frame-size' is supposed to ignore line-spacing?  In
that case, what is the correct way to set the frame-size in the
pixel-exact way?



reply via email to

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