unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: "James N. V. Cash" <james.nvc@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] avoid hard-coded assumptions in image scaling
Date: Sun, 02 May 2021 22:51:49 +0200	[thread overview]
Message-ID: <87fsz4g8pm.fsf@gnus.org> (raw)
In-Reply-To: <87eeeoopnt.fsf@gmail.com> (James N. V. Cash's message of "Sun, 02 May 2021 16:18:30 -0400")

"James N. V. Cash" <james.nvc@gmail.com> writes:

> In image-compute-scaling-factor in images.el, it currently hard-codes
> the assumption that the average character width is 10 pixels. Since
> `frame-char-width` gives this information though, it seems like it's less
> error-prone to use that function instead of assuming.

[...]

> +      ;; We should scale all images according to how wide they are.
> +      ;; But don't scale images down.
> +      (if (< width (frame-char-width))
>            1
> -        (/ (float width) 10))))
> +        (/ (float width) (frame-char-width)))))

The point of the heuristic here is that we want to scale images up on
HiDPI screens, so the current code gives me a scaling factor of 2.3.
(I've got a 14" 4K screen.)

(frame-char-width)
=> 23

With your patch, it'll return 1, of course, which is exactly the
opposite of what we want.

(The function could just have used (frame-char-width) divided by ten, I
guess, instead of computing it itself.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



  reply	other threads:[~2021-05-02 20:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-02 20:18 James N. V. Cash
2021-05-02 20:51 ` Lars Ingebrigtsen [this message]
2021-05-02 20:56   ` James N. V. Cash

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87fsz4g8pm.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=emacs-devel@gnu.org \
    --cc=james.nvc@gmail.com \
    --subject='Re: [PATCH] avoid hard-coded assumptions in image scaling' \
    /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

Code repositories for project(s) associated with this inbox:

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).