delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/07/30/19:34:31

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=gFlBwG1X3WTOWa5YSi25p1+wmt4boWUn149riC1vr8h
2Yc81pcADscg96qc62ShTXx5jixZ3YFLH2cPUkP5WmM5/rGEY8coj9+edECsc0zy
JWszGYTzYZJMho1U2yLRAFD2ahtc9toISgctG+2SskYeID22yhat+QPhJqvUYcCA
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=hM0l20Eya7TCGoEN1BRwfIEOVtw=; b=D4v3hKg5+nMBdZlrm
SrWwssnTtWtAN/lkfNmz+EiSFlC3ZF1N5KuminBN4AZgm/DVOlywgIqzJtCjSSBt
gdWsyS1veD7Bv4uZxrBX3Ud8yM2xKxRNM6PEKxiMGcpbP7R1p9+C/UMfF06kRA9l
n3+DDsuhwZmI5ZTUrHyRq2wQg0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Panel, H*F:U*cygwin, displays, pixels
X-HELO: Ishtar.sc.tlinx.org
Message-ID: <579D396D.3050705@tlinx.org>
Date: Sat, 30 Jul 2016 16:34:05 -0700
From: Linda Walsh <cygwin AT tlinx DOT org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: Re: (getting correct DPI from windows for) cygwinX xwin resolution
References: <87424135-6f1e-9b52-8a56-c79159d910d7 AT utoronto DOT ca> <8d89912b-14e5-3908-8d4e-ae60fb29e56c AT cs DOT umass DOT edu> <408b8e59-95f8-3e86-13f6-da0b521aa34b AT cs DOT umass DOT edu>
In-Reply-To: <408b8e59-95f8-3e86-13f6-da0b521aa34b@cs.umass.edu>
X-IsSubscribed: yes

Eliot Moss wrote:
> As I mentioned, it is clear the XWin itself
> has a notion of resolution, but most applications
> do not seem to be coded to take it into account.
> The main ones that I use don't, anyway, and so
> I needed to adjust things in my .Xdefaults, as
> I described and gave examples of in my previous
> posting ...
---
Xwin has had the notion of "dpi" in it since before windows
was created.  Windows programming took people backwards, in
that it specified sizes in pixels.

The new HTML5 standard has artificially defined a "software pixel",
that is supposed to be 1/96th of an inch -- independent of the
rendering device, but in HTML4, pixels were still pixels.

One way that can help on XWindows The fonts were The fixed width fonts (100dpi/75dpi) are created to work
under those resolutions only.  If the programs you are using use
Truetype fonts those should resize automatically if you
start the Xwin server using the "-dpi" switch and give it the value
for your screen -- it doesn't support multiple dpi-values for different
screen types though (neither does windows, AFAIK).

A shell script way to get windows DPI:
----
#!/bin/bash -u
shopt -s expand_aliases 
alias my=declare
alias int=my\ -i

ord () { 
  printf "%d\n" "'$1"
}

get_dpi () {
  my mskey='/proc/registry64/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft'
  my dpi_k='Windows NT/CurrentVersion/FontDPI/LogPixels'
  read val<"$mskey/$dpi_k"
  int dpi=$(ord "$val")
  # check for insane values
  ((dpi<50||dpi>>400)) && dpi=96
  echo "$dpi"
}

----

My check for 'insane' values may be out of date in the not so
distant future.  Adjust as necessary, if your screens are really
out of this range, and set a default to something near your screen's
listed resolution.  To get that use your screen's listed size
in inches.  Example: using a 20 inch screen, and your display's
listed resolution from:

"Control Panel\All Control Panel Items\Display\Screen Resolution",
(you said 3200x1800 a 16:9 ratio), 
calculate the following:  (example in shell+perl)
(or use a calculator).


> X=3200 Y=1800   #or whatever your screen size is in dots
> let Z="$X*$X+$Y*$Y"; echo $Z
> perl -e 'printf "%d\n", 13480000**.5'
  3671

above is diagonal dots.  to get DPI in shell
(using the 20" screensize):

> S=20
> let actual_dpi="(3671+$S-1)/$S"; echo $actual_dpi
  184

(so use 184 for Windows DPI, and X "-dpi").

NOTE: if you let windows resize your entire screen, instead of
just the text, then magnification is already applied to your X
display, so use "-dpi 100" 
(or more precisely, "-dpi $[100*184/96]").

Hope this helps and isn't too confusing...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019