unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ralf Angeli <angeli@caeruleus.net>
Cc: emacs-devel@gnu.org
Subject: Re: display-mm-width return value off on Windows
Date: Sun, 20 Aug 2006 10:19:34 +0200	[thread overview]
Message-ID: <87y7tj4y5l.fsf@neutrino.caeruleus.net> (raw)
In-Reply-To: <44E79204.9030505@gnu.org> (Jason Rumney's message of "Sat, 19 Aug 2006 23:34:44 +0100")

* Jason Rumney (2006-08-20) writes:

> Ralf Angeli wrote:
>> * Jason Rumney (2006-08-19) writes:
>>   
>>> I didn't react the first time because I don't think your statement above 
>>> was true, but it is pointless continuing the argument.
>>
>> Then we have a different perception of the reactions.
>>   
> I have re-read the thread, and do not see where you could have got the 
> impression that the majority of developers were in favour of your patch. 
> Eli expressed concern that the results were still not correct in the two 
> test cases you provided. I suggested that if reordering the operations 
> to preserve precision made the results correct, then it might be a good 
> fix, otherwise I agree with Eli.

I interpreted this message of yours more positively.  In addition
there was an explicitely positive message from Kim.  Whatever, I guess
you are right and I take back that statement.

> Lennart Borgman posted a link to a mail 
> from Microsoft where they advised against using LOGPIXELSZ in 
> calculations involving physical sizes on screen.
>
>> I guess, I was the only one who actually checked the results of
>> `display-mm-width' and `display-mm-height' with the final patch
>> applied.  Here they are again for reference:
>>
>>                    display-mm-*   display-mm-*
>>         Real size  without patch  with patch
>> Width   285mm      370            296
>> Height  215mm      277            222
>>   
>
> The other test case you posted at the time started with both width and 
> height being overestimated by about 20%, and ended with the height 
> overestimated by 10% and the width underestimated slightly. I would not 
> call this an improvement, as the aspect ratio gets messed up with the 
> new code.

The other test case was with the old version of the patch, before
calculation was reordered.  That means those numbers do not reflect
the current version of the patch.

>> I'd say this is a vast improvement.  Until now nobody showed any
>> evidence that the patch leads to more inaccurate results on other
>> machines compared to the current code.
>
> Is the mail from someone at Microsoft that Lennart found, and the 
> documentation about Logical vs Physical dimensions on MSDN not evidence 
> enough?

The message you are probably referring to contains this:

,----[ <news:j1CRp$MJBHA.264@cppssbbsa01.microsoft.com> ]
| The problem you have encountered is the fact that the Logical metrics from
| GetDevCaps often do not agree with the size or resolution metrics returned
| from GetDevCaps when it is called on Windows NT.
| 
| The numbers returned from GetDeviceCaps() for HORZRES, HORZSIZE,  VERTRES,
| VERTSIZE, LOGPIXELSX, and LOGPIXELSY are defined by the  driver. It is
| common for NT drivers to return values that are not mathematically
| consistent (you can't calculate logpixelsx from horzres and horzsize), but  
| that isn't a bug, it is by design. The easy workaround is to use  HORZRES,
| HORZSIZE, VERTRES, and VERTSIZE (rather than LOGPIXELSX and LOGPIXELSY) in
| all calculations related to the metafile. This  will provide consistent
| results on both Win9x and NT.  
| 
| Q145999 How to Create & Play Enhanced Metafiles in Win32
| http://support.microsoft.com/support/kb/articles/q145/9/99.asp
| 
| Contains sample code that creates metafiles that are dimensionally
| consistent.
`----

So he wrote that the *RES and *SIZE values don't fit together with the
LOGPIXELS* values.  But he also wrote that _all_ of these values are
defined by the driver.  That means no matter which type of calculation
we are using, we are at the mercy of the device driver.  In my case
the device driver returns much better results with the LOGPIXELS*
method.

At the same time you will find a lot of reports on the Internet about
*SIZE returning incorrect values.  Eli, however, showed that the *SIZE
method returns accurate values for him.  What I'd be interested in
would be if the values get less accurate withthe LOGPIXELS* method.
The only problem I am seeing with LOGPIXELS* is the potential
difference between logical and real inches.

While digging a bit in the Microsoft site I found the howto "How to
Make an Application Display Real Units of Measurement"
(<URL:http://support.microsoft.com/default.aspx?scid=kb;EN-US;q127152>)
which emphasizes the fact that it's impossible to reliably calculate
real dimensions of a screen.  The article mentions the problems with
LOGPIXELS* returning logical inches and it doesn't even mention *SIZE.
Instead, it suggests to let the user specify explicitely the physical
size of the screen.

Given that both ways of calculating the screen size are unreliable I
am still interested in data allowing to judge which method returns
more accurate results in the majority of cases.

>> No, I haven't given up on that.  I modified the patch for frame.el for
>> it to be able to cope with multiple displays and provided it in
>> <URL:http://mid.gmane.org/e9drj1$bk9$1@sea.gmane.org>.
> The patch does not seem to be there.

Hm, seems to be a Gmane bug.

> But it can be found at this link:
>
> http://lists.gnu.org/archive/html/emacs-devel/2006-07/msg00755.html

Thanks for sorting this out.

>>   Nobody replied
>> to this message.  I provided that patch (again) together with the
>> patch for w32fns.c in
>> <URL:http://mid.gmane.org/eb2b77$3ih$2@sea.gmane.org>.
>>   
> I think they should be kept separate. If the patch to frame.el is 
> applied, then there is no need to alter the defaults, as the user can 
> customize them if the defaults are wrong, which they will need to do 
> anyway, since the patch to w32fns.c is still not giving the correct results.

Agreed.

-- 
Ralf

  reply	other threads:[~2006-08-20  8:19 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-06 17:50 display-mm-width return value off on Windows Ralf Angeli
2006-07-06 21:08 ` Eli Zaretskii
2006-07-06 21:25   ` David Kastrup
2006-07-07  5:56   ` Ralf Angeli
2006-07-07 10:18     ` Eli Zaretskii
2006-07-07 10:22     ` Eli Zaretskii
2006-07-07 12:05       ` Lennart Borgman
2006-07-07 16:54       ` Ralf Angeli
2006-07-08 12:58         ` Eli Zaretskii
2006-07-08 13:23           ` Lennart Borgman
2006-07-08 14:42             ` Eli Zaretskii
2006-07-08 21:27             ` Jason Rumney
2006-07-08 22:23               ` David Kastrup
2006-07-08 23:03                 ` Jason Rumney
2006-07-09  7:36                   ` Ralf Angeli
2006-07-09  8:03                     ` David Kastrup
2006-07-09  7:41               ` Ralf Angeli
2006-07-09  8:05                 ` David Kastrup
2006-07-09 18:37                 ` Eli Zaretskii
2006-07-10 10:30                   ` Kim F. Storm
2006-07-10 10:45                     ` David Kastrup
2006-07-10 13:29                       ` Jason Rumney
2006-07-10 14:19                         ` David Kastrup
2006-07-10 21:28                           ` Jason Rumney
2006-07-10 22:05                             ` David Kastrup
2006-07-10 20:12                     ` Eli Zaretskii
2006-07-10 23:17                       ` Kim F. Storm
2006-07-10 23:22                         ` David Kastrup
2006-07-11 18:43                   ` Ralf Angeli
2006-07-12 13:07                     ` Kim F. Storm
2006-07-12 19:22                     ` Richard Stallman
2006-07-13 19:38                       ` Ralf Angeli
2006-07-13 19:59                         ` David Kastrup
2006-07-14 17:03                           ` Richard Stallman
2006-07-14 18:16                           ` Stefan Monnier
2006-07-14 18:33                             ` David Kastrup
2006-07-14 21:37                               ` Stefan Monnier
2006-07-15 22:06                                 ` Ralf Angeli
2006-07-16 17:04                                   ` Ralf Angeli
2006-07-14 17:03                         ` Richard Stallman
2006-07-09  9:31               ` Jan Djärv
2006-07-08 17:40           ` Robert J. Chassell
2006-07-06 22:09 ` Jason Rumney
2006-07-06 22:37   ` Lennart Borgman
2006-07-07  5:50   ` Ralf Angeli
2006-07-07  9:09     ` Eli Zaretskii
2006-08-05 14:50 ` Ralf Angeli
2006-08-19 15:15   ` Ralf Angeli
2006-08-19 15:37     ` David Kastrup
2006-08-19 16:31     ` Jason Rumney
2006-08-19 17:54       ` Ralf Angeli
2006-08-19 22:34         ` Jason Rumney
2006-08-20  8:19           ` Ralf Angeli [this message]
2006-08-21  9:06             ` Eli Zaretskii
2006-08-21  9:17               ` Lennart Borgman
2006-08-21 10:22                 ` Eli Zaretskii
2006-08-21 10:36                   ` David Kastrup
2006-08-21 11:45                     ` Jason Rumney
2006-08-21 11:55                       ` David Kastrup
2006-08-21 10:43                   ` Lennart Borgman
2006-08-21 14:07                     ` Eli Zaretskii
2006-08-21 15:03                       ` Lennart Borgman
2006-08-21 19:22               ` Ralf Angeli
2006-08-21 23:10                 ` Eli Zaretskii
2006-08-22  5:57                   ` Ralf Angeli
2006-08-22 19:16                     ` Ralf Angeli
2006-08-22 21:38                       ` Kim F. Storm
2006-08-23 18:31                         ` Ralf Angeli
2006-08-23 22:44                           ` Kim F. Storm
2006-08-24 16:14                             ` Ralf Angeli
2006-08-24 20:18                               ` Kim F. Storm
2006-08-25 16:38                                 ` Ralf Angeli
2006-08-25 22:28                                   ` Kim F. Storm
2006-08-21 23:25                 ` Jason Rumney
2006-08-22  5:51                   ` Ralf Angeli
2006-08-22  7:46                     ` Jason Rumney
2006-08-22 19:24                       ` Ralf Angeli
  -- strict thread matches above, loose matches on Subject: below --
2006-07-14 23:55 Robert J. Chassell

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=87y7tj4y5l.fsf@neutrino.caeruleus.net \
    --to=angeli@caeruleus.net \
    --cc=emacs-devel@gnu.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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 read-only IMAP folder(s) and NNTP newsgroup(s).