New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for HiDPI display on vanilla emacs #13
Conversation
This works but may need a small change:
At least at my end, frame-scale-factor returns 2.0, which leads to problems with epdfinfo, since it expects a natural number:
|
@dangom Thanks for letting me know! For some reason I didn't encounter this on my system yet. Let me fix that |
This PR cannot be merged soon enough! Thank you @iostapyshyn for fixing the problem. |
This change is now merged in :) Thank you @iostapyshyn for the PR! |
@vedang I have just updated all Emacs packages on my workstation but see no difference. Is that because this PR, while merged, has not yet been released to MELPA? |
@salutis : I can see that the version is available on MELPA now. I don't know the exact times at which MELPA updates packages, but I don't think it's more than 30 mins from commit :) You should have the change. Have you set |
@vedang And you are right! I closed the book I was reading, called the |
@vedang Interesting. After the update |
@salutis I cannot repro this, both |
@salutis : I am not on a Mac , I am on Linux. This might be the reason I am unable to repro the problem as well. Waiting on someone else from the Mac world to repro this and report it. |
@salutis : I have now confirmed that it's working correctly on Mac as well. (it == default Update: My Emacs on Mac OSX does not have |
I can reproduce this on Emacs 28 but not on emacs-mac. In particular these lines in pdf-view.el look suspicious: Lines 920 to 922 in f771c93
Also I hope @nnicandro can shed some light on why scaling wasn't applied to |
@iostapyshyn Bingo, I am on Emacs 28 as well. |
The problem is here: Line 1597 in f771c93
pdf-info-renderpage .
I'm not sure why the For the moment, I am pushing a temporary fix - removing the multiplication of @iostapyshyn @salutis : Please test this and let me know what you see. |
`pdf-view-image-size` passes in the width of the current page to `pdf-info-renderpage` during an isearch. Use this as-is, instead of multiplying it with the `pdf-util-frame-scale-factor`. This is a potential fix for the bug raised by PR #13. I'm not sure if this was a bug earlier as well, but was masked since the code-path did not execute for `png` images. I will treat this as a temporary change until I can better understand the original reasons behind putting it in. Since I don't have access to a Mac running `emacs-mac` , I have tested it by hard-coding `pdf-util-frame-scale-factor` to 2 on my local setup, and everything seems to be working correctly.
@vedang That change breaks the scaling. Basically there are two references of Also there are a few places in code where scaling factor of 2 is hardcoded: Line 394 in 8b2deba
Line 931 in 8b2deba
I suppose that is something that we need to check once we figure out what is going on. |
@iostapyshyn : Vanilla Emacs won't get the Since you've tested that the scaling is breaking with Opening a new issue #19 (so that I have an open issue to remind me about this) |
@vedang I don't think the change broke something for regular (as in not Emacs 28 on Mac) users, did it? |
@iostapyshyn : Since I don't have a Mac, I don't have anything breaking in front of my eyes :) . My understanding is that it isn't I will wait for you to get back before adding the guard back in. For the moment, I am only reverting the commit I have added above. |
This reverts commit 8b2deba, which was introduced in an attempt to fix #13. I am now tracking this issue under #19. @iostapyshyn has confirmed that this change breaks scaling and is not the correct fix.
@vedang Since the version before my changes didn't use Restoring So basically there are two possibilities:
|
I should add, users on Emacs 27 or lower and users on devices that return 1 for |
👍 I am leaving the change in right now, with the hope that we can pinpoint the bug in the search and fix it before people notice and start complaining. I cannot debug this because I don't have the necessary setup. I will help with the investigation as I can. Since search is completely broken at this point in time, I will have to revert this change if we cannot find a fix in a reasonable amount of time. I will also open a separate issue to track the breakage with |
FYI: I am back to "normal" Emacs 27.2 and search works. PDFs are fuzzy, though. 😞 |
@iostapyshyn Oh, I see. I replied in #22. Amazing work. |
This is related to the long-standing issue of displaying pdf contents in proper resolution on retina Macs using vanilla (not a fork) emacs:
politza/pdf-tools#51
doomemacs/doomemacs#4989
This commit of Emacs introduces a function
frame-scale-factor
which returns the scale factor of the backing store on NS framework in particular. So far pdf-tools has been usingbacking-scale-factor
attribute of(frame-monitor-attributes)
, which is not a standard emacs attribute, but a feature provided by emacs-mac port.Also, for some reason the scaling wasn't applied if
png
was used as the image type. I've tested around andpng
with scaling works flawlessly. Rather contrary,png
is the only image type which successfully scales for me, and usingimagemagick
does not work (even on regular image buffers).image-io
is also something not present in GNU Emacs and provided solely byemacs-mac