Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions arduino-core/src/processing/app/linux/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@
import processing.app.PreferencesData;
import processing.app.legacy.PConstants;

import java.awt.Font;
import java.io.File;

import javax.swing.UIManager;


/**
* Used by Base for platform-specific tweaking, for instance finding the
Expand Down Expand Up @@ -117,4 +120,19 @@ public void openFolder(File file) throws Exception {
public String getName() {
return PConstants.platformNames[PConstants.LINUX];
}

private int detectedDpi = -1;

@Override
public int getSystemDPI() {
if (detectedDpi != -1)
return detectedDpi;

// we observed that JMenu fonts in java follows the
// System DPI settings, so we compare it to the standard
// font size (12) to obtain a rough estimate of DPI.
Font menuFont = UIManager.getFont("Menu.font");
detectedDpi = menuFont.getSize() * 96 / 12;
return detectedDpi;
}
}