File tree 1 file changed +18
-0
lines changed
arduino-core/src/processing/app/linux
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 25
25
import processing .app .PreferencesData ;
26
26
import processing .app .legacy .PConstants ;
27
27
28
+ import java .awt .Font ;
28
29
import java .io .File ;
29
30
31
+ import javax .swing .UIManager ;
32
+
30
33
31
34
/**
32
35
* Used by Base for platform-specific tweaking, for instance finding the
@@ -117,4 +120,19 @@ public void openFolder(File file) throws Exception {
117
120
public String getName () {
118
121
return PConstants .platformNames [PConstants .LINUX ];
119
122
}
123
+
124
+ private int detectedDpi = -1 ;
125
+
126
+ @ Override
127
+ public int getSystemDPI () {
128
+ if (detectedDpi != -1 )
129
+ return detectedDpi ;
130
+
131
+ // we observed that JMenu fonts in java follows the
132
+ // System DPI settings, so we compare it to the standard
133
+ // font size (12) to obtain a rough estimate of DPI.
134
+ Font menuFont = UIManager .getFont ("Menu.font" );
135
+ detectedDpi = menuFont .getSize () * 96 / 12 ;
136
+ return detectedDpi ;
137
+ }
120
138
}
You can’t perform that action at this time.
0 commit comments