Skip to content

Unify print result for all OS#992

Open
akoch-yatta wants to merge 1 commit into
eclipse-gef:masterfrom
vi-eclipse:remove-printer-getdpi
Open

Unify print result for all OS#992
akoch-yatta wants to merge 1 commit into
eclipse-gef:masterfrom
vi-eclipse:remove-printer-getdpi

Conversation

@akoch-yatta
Copy link
Copy Markdown
Contributor

@akoch-yatta akoch-yatta commented Jan 28, 2026

This PR unifies the print result for windows and macos. Until now calculation of the scale factor of the Graphics involved using the display DPI which lead to a bigger scale factor with macos and therefor a noticably difference in the result. For the calculation the fixed factor of 96 is arbitrary and chosen to change existing behavior only on one OS.
The calculation for the scaled font height is simplified and adapted similarly.

We used the same diagram for this results. You will notice, Windows looks the same before and after - the figures in the Mac print result were way bigger.
MacOS - master.pdf
Windows - master.pdf

MacOS - new.pdf
Windows - new.pdf

This commit unifies the print result for windows and macos. Until now
calculation of the scale factor of the Graphics involved using the display
DPI which lead to a bigger scale factor with macos and therefor a noticably
difference in the result. For the calculation the fixed factor of 96 is
arbitrary and chosen to change existing behavior only on one OS.
The calculation for the scaled font height is simplified and adapted
similarly.
@ptziegler
Copy link
Copy Markdown
Contributor

To be honest, I have no clue how to test this without an actual Mac. So I have to rely on your expertise here. Perhaps @Phillipus can see something that might cause issues here?

I'm a little bit concerned about the PrintFigureOperation, which might cause the size of the figures to differ again between Windows and MacOS. But I have no way to verify this.

@merks
Copy link
Copy Markdown
Contributor

merks commented Feb 10, 2026

@ptziegler

FYI, I recently asked if it is possible to access a mac machine via VNC:

https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/7009

This is a resource that could potentially be shared...

@Phillipus
Copy link
Copy Markdown
Contributor

Perhaps @Phillipus can see something that might cause issues here?

Yes. I tested on Mac printing to PDF (not a physical printer) and the font sizes are different and clipped.

Before:

good

After:

bad

@ptziegler
Copy link
Copy Markdown
Contributor

Given that this PR is causing issues on MacOS and given that I don't have a way to test this (even if there is an option to request remote access to a MacOS VM from the EF)...

What problem is this PR trying to fix? If this is for for the sake of making everything look "clean", then I wonder if it's really worth changing something that isn't broken. Just like seen in #944 (and likely also in several other issues), having 96 DPI hard-coded always seems to be causing problems when run on a system that's using 72 DPI.

@HeikoKlare
Copy link
Copy Markdown
Contributor

Andreas created this PR because when working on the issues with Device.getDPI() and ways to replace calls to that method, we found that print results on the different operating systems are different given the same input (because of the different "base" DPI). That's what you see in the printed PDFs in the original post. That's rather unexpected: as a user you expect the same print result with the same sizes for the same input, no matter which OS you run it on.
This PR intended to fix that.

Still, the PR was not driven by any concrete need of us (we currently only deploy our product for Windows anyway) but just intended to improve behavioral consistency for the community. Given that there are still issues with the proposed fix and that no consumers complained about the existing behavior so far, it's completely fine to not further invest into it and accept the behavior as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GEF: Unify Printing results with PrinterGraphics

5 participants