File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
arduino-core/src/processing/app/linux Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 2525import processing .app .PreferencesData ;
2626import processing .app .legacy .PConstants ;
2727
28+ import java .awt .Font ;
2829import java .io .File ;
2930
31+ import javax .swing .UIManager ;
32+
3033
3134/**
3235 * Used by Base for platform-specific tweaking, for instance finding the
@@ -117,4 +120,19 @@ public void openFolder(File file) throws Exception {
117120 public String getName () {
118121 return PConstants .platformNames [PConstants .LINUX ];
119122 }
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+ }
120138}
You can’t perform that action at this time.
0 commit comments