CopperSpice API  1.9.1
High DPI Monitors

High DPI displays are monitors with a pixel density greater than the traditional standard of 96 DPI. This pixel density is measured in Dots per Inch (DPI) and is determined by the number of display pixels divided by the physical size.

Simply having a large number of pixels does not make a monitor High DPI. A 4K monitor has a fixed number of pixels however the DPI can vary between 355 for a 13 inch laptop and 65 DPI for a 70 inch television.

Consequences of improper DPI support

High DPI monitors cause a number of rendering concerns for legacy applications which do not support scalable DPI rendering.

  • Applications using user interface designs with fixed coordinates may look extremely small.
  • Programs using fixed layouts with scaled fonts may truncate text.
  • Applications must adapt to situations where users have multiple displays with varying resolution.

The traditional approach to supporting High DPI has been to scale fonts automatically and then provide a DPI value that application code must use to scale the remainder of the user interface. This is error prone since the application developer needs to explicitly adjust the user interface based on the monitor where the application is currently running.

High DPI Overview

CopperSpice supports High DPI by scaling the main coordinate system based on the monitor.

Geometry is specified in "device independent pixels". This includes widget and item geometry, event geometry, desktop, window and screen geometry, and animation velocities. Rendered output is in device pixels, which correspond to the native display resolution. The ratio between the device independent and device pixel coordinate systems is the devicePixelRatio.

The OpenGL and raster graphics classes still use the native device coordinates.

High DPI Terminology

Term Definition
Device Independent Pixels Pixels used by application (user space), subject to scaling by the operating system or CopperSpice
Device Pixels Pixels of the display device
Device Pixel Ratio Scale factor applied by the operating system or CopperSpice
Logical DPI Resolution used for converting font sizes defined in points to font sizes in pixels, typically a standard values of 96, 128, .. 192
Physical DPI Physical resolution obtained by dividing the size of the monitor by the number of pixels
User Space The coordinate space the application uses in "Device Independent Pixels"