[Top][All Lists]

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

Re: Which should the display-pixel-width function return, physical pixel

From: Yuan Fu
Subject: Re: Which should the display-pixel-width function return, physical pixel width or logical pixel width?
Date: Fri, 1 Jan 2021 16:51:21 -0500

> On Jan 1, 2021, at 9:44 AM, Yuuki Harano <masm+emacs@masm11.me> wrote:
> Hi, I'm pgtk developer.
> Currently, display-pixel-width of vanilla emacs returns physical pixel
> width.  i.e. it returns 3840 even if GDK_SCALE=2 when using 3840x2160.
> Some emacs lisps (like preview in auctex) use display-pixel-width and
> display-mm-width to calculate physical dpi.
> I think it is strange. On multi-monitor environment,
> display-pixel-width and display-mm-width contains all the monitors,
> that may be different dpi.  The result dpi is between the two.
> Those emacs lisps should use per-monitor information.
> Currently, pgtk emacs returns logical pixel width, i.e. 1920, because
> Gdk returns it.  On multi-monitor environment, Gdk returns 1920 +
> something.
> I'm going to add scale-factor in per-monitor information to support
> scaling.  dpi-sensitive emacs lisps can extract logical pixel width,
> mm width, and scale-factor from it, and calculate dpi.
> "Monitor" is a recent concenpt.
> If pgtk emacs returns logical one, then compatibility may be broken.
> If pgtk emacs returns physical one, then those emacs lisps continue to
> do strange calculation.
> What should the display-pixel-width function (and
> display-monitor-attributes-list) return, physical pixel width, logical
> pixel width, or implementation-dependent?  The documentation of
> display-pixel-width seems to say nothing about that.
> -- 
> Yuuki Harano

As hidpi screens getting more common, we should separate pixel sizes reported 
from frontends into logical and physical pixels. This problem also makes images 
on Mac fuzzy. Currently ns frontend can distinct between logical and physical 
pixel size, from Yuuki’s post it seems pgtk can, too. Does other frontends have 
such ability?


reply via email to

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