- JRE-managed HiDPI mode (default on macOS since JDK7, on Windows since 2018.2/JBR8, on Linux since 2019.2/JBR11). JBR stands for JetBrains Runtime, Java runtime based on OpenJDK and maintained by JetBrains.
Enabled via the VM option: -Dsun.java2d.uiScale.enabled=true
(Help | Edit Custom VM Options).
In this mode the UI scaling is defined by the product of the two scale factors: the user scale (managed by the IDE) and the system scale (managed by the JBR).
- IDE-managed HiDPI mode (legacy mode).
Enabled via the VM option: -Dsun.java2d.uiScale.enabled=false
(Help | Edit Custom VM Options).
In this mode the UI scaling is defined only by the user scale factor (managed by the IDE).
Two types of scale factors
- The user scale factor is derived from the IDE main font size:
Settings > Appearance and Behavior > Appearance > Use custom font
The font size is presented in relative points in the JRE-managed HiDPI mode (the real font size in pixels can be bigger). In this mode the default font size defines the user scale as 1.0.
In the IDE-managed HiDPI mode the font size is presented in absolute points (matching the real font size in pixels). In this mode the default font size depends on the desktop scaling and it defines the user scale that can differ from 1.0. (Note that the font size in the editor is not affected by the main font size and is configured separately).
It's possible to force the user scale factor by providing the VM option below. In this case the font size is untied from the user scale what may cause UI imperfections (and so this option is not recommended other than for debugging purposes).
-Dide.ui.scale=<floating point value>
- The system scale factor is configured on the OS level. However, it's possible to force the system scale factor by providing the VM option (mostly used for debugging purposes):
-Dsun.java2d.uiScale=<floating point value>
It's possible to inspect the current IDE scaling settings via Help | Find Action: "Show HiDPI Info" (available in -Didea.is.internal=true mode, and by default since 2019.2.1).
The instructions below relate to the system scale factor settings.
Single-monitor DPI is supported. DPI is defined by Xft.dpi X resource value.
$ xrdb -q | grep -i dpi
$ xrandr --dpi <dpi>
It can also be set via your Linux Desktop settings, or via gnome-tweak-tools.
The system scale factor in the JRE-managed HiDPI mode is determined by the following settings, in order:
- If the system scale factor is forced via -Dsun.java2d.uiScale property - it's just used.
- The following GSettings are considered (use dconf-editor to edit):
Per-monitor DPI key (Wayland, not well supported yet):
Global DPI key:
(These keys, used since OpenJDK 9, are currently disabled in JBR 11:
- If GDK_SCALE environment variable is set, the above scale factor is multiplied by it.
See: https://developer.gnome.org/gtk3/stable/gtk-x11.html .
This can be unexpected and there're the following options to cope with it:
- Compensate it via setting GDK_DPI_SCALE env variable (since 2019.2.1).
- Unset GDK_SCALE before starting the IDE.
- Force the system scale factor (see 1).
- Switch to the legacy IDE-managed HiDPI mode (see the "HiDPI modes" section).
- If none of the above settings is defined, then the system scale is derived from the Xft.dpi value (e.g. 192 dpi will define 2.0 scale factor).
GDK_SCALE is applied to Xft.dpi as well (since 2019.2.1, see 3).
Note, currently fractional scale factor is not supported on Linux in the JRE-managed HiDPI mode. So if Xft.dpi defines a fraction scale, then the IDE is automatically switched to the legacy IDE-managed HiDPI mode (and the GDK_SCALE is not applied).
- If none of the above settings is defined, then the system scale factor is set to 1.0.
On Linux desktop environments other than Gnome, IDE still behaves like GDK application obeying the HiDPI settings above.
Guide: https://wiki.archlinux.org/index.php/HiDPI .
Per-monitor DPI is supported since JBR 8. Configured as scale factor in Display Settings system dialog.
Guide: DPI Scaling in the Windows 10 Anniversary Update .
Per-monitor DPI is supported since JDK 7. Currently, the system scale factor is either 2.0 on Retina and 1.0 on a standard display.