Skip to content

HiDPI Support

Kay Kasemir edited this page Feb 28, 2022 · 3 revisions

Hi Resolution Displays

New displays tend to have very high pixel resolutions, often referred to as "HiDPI" or "Retina".

To the software, the high pixel resolution tends to be abstracted by low-level OS or graphics APIs. What CS-Studio/Phoebus sees as one pixel is translated into 2x2 or 3x3 physical display pixels, and the GUI will appear very similar to the end user, with a few exceptions listed below.

Icons

When loading icons/images from a "resource", the JavaFX API supports higher resolution variants of the image file. Given icon-name.png, it will actually load icon-name@2x.png or icon-name@3x.png, if available, on high resolution displays.

Using the ImageCache helper, https://github.com/ControlSystemStudio/phoebus/blob/master/core/ui/src/main/java/org/phoebus/ui/javafx/ImageCache.java, will not only support HiDPI icons but also add caching.

Mac OS X

On Mac OS X, HiDPI support seems to simply "work", except for menu icons. Icons render without problems within application windows, but in the system menu, if some icons are available as HiDPI variants, the menu icons will show up in different sizes.

Windows

On Windows, HiDPI support seems to simply "work".

Linux

There are many options on both the GNOME/GTK/X level and for JavaFX, see for example https://wiki.archlinux.org/title/HiDPI#JavaFX

Proven recipes?

  • export GDK_SCALE=2