From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: "Fix" sag scaling for hidpi Date: Tue, 9 Feb 2021 20:01:31 +0000 Message-ID: References: <07D5E64D-DAD0-45B3-B272-627A73D7CBAE@gmail.com> <7308DB2C-27A5-4227-A1F9-9949EE558052@gmail.com> <87sg6alweo.fsf@gnus.org> <87pn1erewq.fsf@gmail.com> <87wnvlecrw.fsf@gnus.org> <83sg69o3av.fsf@gnu.org> <87mtwhctte.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1618"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , casouri@gmail.com, rpluim@gmail.com, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Feb 09 21:28:13 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9ZcK-0000In-26 for ged-emacs-devel@m.gmane-mx.org; Tue, 09 Feb 2021 21:28:12 +0100 Original-Received: from localhost ([::1]:52026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9ZcJ-0008NW-3I for ged-emacs-devel@m.gmane-mx.org; Tue, 09 Feb 2021 15:28:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9ZEb-00009m-AX for emacs-devel@gnu.org; Tue, 09 Feb 2021 15:03:41 -0500 Original-Received: from ip6-2001-08b0-03f8-8129-010b-017f-26e8-2283.holly.idiocy.org ([2001:8b0:3f8:8129:10b:17f:26e8:2283]:50350 helo=breton.holly.idiocy.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9ZEZ-0006Qk-Gu; Tue, 09 Feb 2021 15:03:41 -0500 Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 4EAC4202A4515F; Tue, 9 Feb 2021 20:01:31 +0000 (GMT) Mail-Followup-To: Alan Third , Lars Ingebrigtsen , Eli Zaretskii , rpluim@gmail.com, emacs-devel@gnu.org, casouri@gmail.com, monnier@iro.umontreal.ca Content-Disposition: inline In-Reply-To: <87mtwhctte.fsf@gnus.org> Received-SPF: none client-ip=2001:8b0:3f8:8129:10b:17f:26e8:2283; envelope-from=alan@breton.holly.idiocy.org; helo=breton.holly.idiocy.org X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, KHOP_HELO_FCRDNS=0.399, PDS_RDNS_DYNAMIC_FP=0.01, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:264241 Archived-At: On Sat, Feb 06, 2021 at 12:35:41PM +0100, Lars Ingebrigtsen wrote: > Eli Zaretskii writes: > > "Logical" pixels was something that was introduced when people started > making high-resolution screens. In a 2x HiDPI scenario, the OS will > report that the 1280 × 1024 is really a 640 x 512 screen, but if you > give it an image that's 640x512 to display, it'll scale it up, using > four physical pixels per logical pixel, and this will be blurry. > > So you give it a 1280x1024 image if it's a logical 640x512 2x screen if > you don't want blurriness. :-/ One of the main problems I've had with trying to find a solution is to work out what we want to actually happen. If I open an image on an emacs frame it makes sense that the image should be displayed 1:1 with the physical pixels no matter what the scale factor is. If that frame is then moved to another display with a different scale factor do we then resize the image according to the change in scale factor (so it's still 1:1 with the physical pixels), or keep it the same (logical) size? I think we probably want to keep it the same (logical) size, so I think we need to, as described elsewhere, expose the scale factor to lisp so that create-image can calculate :scale rather than trying to calculate it on-the-fly in C code. We'll probably have to do more fiddling with SVGs though, since they can define sizes in real-world units, like cm or inches, so the dpi has to match the physical pixels, and if we move to a different screen and regenerate the SVG the DPI will be different but the scale likely won't be recalculated and the image will change size. Perhaps we need to let lisp set the DPI for an SVG (and other scalable image types) as well as the scale. And this is further complicated by the fact macOS uses a "fake" DPI that has no relation to physical pixel size at all! And, of course, none of this will help when the lisp code doesn't use create-image. I hope this makes sense, I find this hard to describe. -- Alan Third