[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Display-relative coordinates
From: |
Drew Adams |
Subject: |
RE: Display-relative coordinates |
Date: |
Fri, 29 Jul 2016 08:38:19 -0700 (PDT) |
> There is not enough information in the above, and also some surprising
> data. First, you don't tell how you measure pixels from the screen
> corner.
MB Ruler: http://www.markus-bader.de/MB-Ruler/index.php
> You don't tell what location of the character cells you take
> as its coordinates.
I did say that I measured to the bottom of the cursor (block).
And I did say that I got the char height as 12 pixels.
> You also say that the height of a character is 12 pixels, but
> the default height of a line in "emacs -Q" is 16, not 12.
I believe I measured it. Measuring it again now: 12 pixels for
a char. And in 1/10 pt, face `default' has height 102. (And no,
char height does not include interline height.)
FWIW, in my emacs -Q:
(font . "-outline-Courier New-normal-normal-normal-mono-17-*-*-*-c-*-iso8859-1")
I mentioned char height only to let you know that I measured to
the bottom of the cursor (as I said). If you want to instead
use the bottom of the cursor on the previous line (so as to
include the interline height), and you want to use 16, then
420 - 16 = 404, instead of the 420 - 12 = 408 that I reported
using char height. Still not the same as 354. Again, perhaps
I'm missing something.
> Maybe you could go line by line starting at the first line of the
> window, show the pixel coordinates of the first (leftmost) character
> on that line, and then tell which part(s) of the results don't look
> correct to you.
Sorry, I'm done with this.
> FWIW, if I move a frame such that point is at one of the 4 corners of
> the screen, and compute its pixel coordinates using posn-at-point and
> frame-geometry, I get a very good approximation (within a couple of
> pixels) of my screen dimensions, so I don't think there's a problem in
> these functions.
"Tout va tres bien, Madame La Marquise."
If you're convinced that `posn-at-point' has no problem, fine by me.
I think Martin answered the question of what to use, to get the
screen-relative pixel coordinates of a buffer position:
`window-absolute-pixel-position'. (But it is not available before
Emacs 25.)