bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#52929: 27.1; Images are sometimes not fully displayed


From: martin rudalics
Subject: bug#52929: 27.1; Images are sometimes not fully displayed
Date: Sat, 1 Jan 2022 17:01:27 +0100

>> Please try with adding a (no-special-glyphs . t) entry to the parameters
>> of the child frame.
>
> This solves the issue completely, thank you a lot for this! Could you
> please briefly explain why this is necessary to fully show the image? In
> particular, which glyph was shown here that used the 1 pixel width?

When a window has no right fringe, Emacs by default usurps the rightmost
character on each text line so it can indicate there whether that line
is truncated or continued.  The maximum width of the special glyph to be
displayed there (typically a "$" or a "\") is subtracted from the
maximum width of the display area of that window.  So with the right
fringe turned off, you as a rule always lose one column to the display
engine even when displayed lines are never truncated or continued.

But Eli can explain it better.

Note that with current master you need not calculate the size of your
image yourself.  Emacs can do it for you as with

(with-current-buffer (get-buffer-create "Happy New Year 2022!")
  (setq cursor-type nil mode-line-format nil)
  (erase-buffer)
  (insert-image-file "/home/martin/Downloads/202202.png")
  (let* ((size (buffer-text-pixel-size))
         (width (car size))
         (height (cdr size))
         (frame (make-frame `((parent-frame . ,(selected-frame))
                              (no-special-glyphs . t)
                              (minibuffer . nil)
                              (left . 100)
                              (top . 100)
                              (internal-border-width . 0)
                              (vertical-scroll-bars . nil)
                              (left-fringe . 0)
                              (right-fringe . 0)
                              (width . (text-pixels . ,width))
                              (height . (text-pixels . ,height))))))
    (read-key)
    (delete-frame frame)))

With Emacs 27 you would have to use 'window-text-pixel-size' or
'fit-frame-to-buffer' which both have the problem that you first have to
put your buffer into a window in order to resize it appropriately.

martin





reply via email to

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