Skip to content
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

Text selection is not correct on hdpi #15229

Closed
calixteman opened this issue Jul 27, 2022 · 0 comments · Fixed by #15232
Closed

Text selection is not correct on hdpi #15229

calixteman opened this issue Jul 27, 2022 · 0 comments · Fixed by #15232
Assignees

Comments

@calixteman
Copy link
Contributor

Attach (recommended) or Link to PDF file here:

Configuration:

  • Web browser and its version: Firefox nightly
  • Operating system and its version: Windows 11

Steps to reproduce the problem:

  1. Open tracemonkey.pdf
  2. Zoom at 80%

I get:
image

My screen resolution is 3840x2160 and the global scale is 150%.

If I change the scale setting in System > Display to 100%, the selection is correct:
image

The text is measured here:

const { width } = this._layoutTextCtx.measureText(textDiv.textContent);

and it returns the same value whatever the screen I use is.

So I think we must take into account the window.devicePixelRatio value when computing the text width.

@calixteman calixteman self-assigned this Jul 27, 2022
calixteman added a commit to calixteman/pdf.js that referenced this issue Jul 27, 2022
@calixteman calixteman linked a pull request Jul 27, 2022 that will close this issue
calixteman added a commit to calixteman/pdf.js that referenced this issue Jul 28, 2022
Snuffleupagus added a commit that referenced this issue Jul 29, 2022
Fix text selection with hdpi screens (#15229)
rousek pushed a commit to signosoft/pdf.js that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant