Skip to content

Commit

Permalink
higher DPI value for HiDPI displays. issue #2630
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Nov 24, 2024
1 parent 65698fc commit 09141ff
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@
package com.jdimension.jlawyer.client.editors.documents.viewer;

import com.jdimension.jlawyer.client.settings.ClientSettings;
import com.jdimension.jlawyer.client.utils.SystemUtils;
import com.jdimension.jlawyer.client.utils.ThreadUtils;
import com.jdimension.jlawyer.client.utils.einvoice.EInvoiceUtils;
import java.awt.Color;
Expand Down Expand Up @@ -1314,6 +1315,22 @@ public static int calculateDpi(int totalPages) {
int baseDpi = 200;
int minDpi = 120;

// macOS has a default scale factor of 2 - assume HiDPI for all Macs
if(SystemUtils.isMacOs()) {
return 300;
}

String uiScale = System.getProperty("sun.java2d.uiScale");
try {
if (uiScale != null && Double.parseDouble(uiScale) > 1.0) {
return 300;
} else {
// proceed with dynamic calculation below
}
} catch (Throwable t) {
log.warn("unable to get UI scale factor", t);
}

if (totalPages <= 20) {
return 200;
}
Expand Down

0 comments on commit 09141ff

Please sign in to comment.