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: exposing x_get_scale_factor into elisp level Date: Sun, 4 Apr 2021 11:38:43 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30887"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Evgeny Zajcev Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Apr 04 12:40:03 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 1lT0Aj-0007sW-Gn for ged-emacs-devel@m.gmane-mx.org; Sun, 04 Apr 2021 12:40:01 +0200 Original-Received: from localhost ([::1]:46090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lT0Ai-0007Nf-Fl for ged-emacs-devel@m.gmane-mx.org; Sun, 04 Apr 2021 06:40:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lT09d-0006w1-Gz for emacs-devel@gnu.org; Sun, 04 Apr 2021 06:38:53 -0400 Original-Received: from outbound.soverin.net ([116.202.65.218]:45019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lT09a-0003mG-44 for emacs-devel@gnu.org; Sun, 04 Apr 2021 06:38:53 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id B39C4600CB for ; Sun, 4 Apr 2021 10:38:46 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1617532726; bh=Qbq579zqqWjdA/Qq2yySIeJMEP5fr5F47F1EmVx0HIo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=byXrd2eLKIn15SH7pYm3vWxTVcfgf33tRnWEcxjM1IRY4iQlnticWwFGqeDuYGkDM Qf29+JJkkBmaxNTIIiSalrgVTKZZiylusCS3sxcBWJYP0zI2+qK5ZfRG/vDfG6VzhR HcoMqSMY1ibNwyy3uwLmL6s78lPPZhmQ2C81Zw59T+5DEKI+rrTLVdablK5pKlSUwG 3N+IZVxPFi9lRP5dq26ZdQeYzoBC6V5+Q96yGwnI9RaAW8BuDB8Y9VM58l7aiyF3OX HpHvKzCd/x2GK8CKQYI8CRSj0lfB6vD18SeT8Sbp5kG94w270f/z5r1LNWNC5blSDY LJ+25MjI6P+Xg== Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 8402A202B828A8; Sun, 4 Apr 2021 11:38:43 +0100 (BST) Mail-Followup-To: Alan Third , Evgeny Zajcev , emacs-devel Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=116.202.65.218; envelope-from=alan@idiocy.org; helo=outbound.soverin.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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:267386 Archived-At: On Thu, Mar 25, 2021 at 12:20:09AM +0300, Evgeny Zajcev wrote: > ср, 24 мар. 2021 г. в 23:27, Alan Third : > > > On Mon, Mar 22, 2021 at 02:07:41AM +0300, Evgeny Zajcev wrote: > > > HiDPI is very common nowadays. Internally Emacs has decent support for > > > HiDPI displays. However elisp code, that generates non-svg images don't > > > have any idea that logical pixel may differ from physical one, resulting > > in > > > generating images in low resolution on HiDPI displays. > > > > > > Emacs internally has a notion about HiDPI displays, such as > > > `x_get_scale_factor`, maybe expose this function to elisp level, so > > > packages may utilize it to generate images in highres? > > > > On NS platforms (macOS and GNUstep) and, I believe, native GTK the > > scale factor is how much the TOOLKIT scales things up for display. > > > > The problem we hit on MacOS is that line height is reported in logical > pixels, and we generate PNG images using that line height value. This > results in poor PNG quality since the physical pixel is x4 times larger. > Now we use heavy heuristics to workaround this, it will be great to have > some general approach as Emacs do internally (`x_get_scale_factor') > > Unfortunately, we can't use SVG instead of PNG at the moment I've pushed a version of this to master, so you can use 'frame-scale-factor'. -- Alan Third