SpriteFont High-DPI Coordinate Scaling Ambiguity
0 reputation · 30 Dec 2020, 22:33 UTC
SpriteFont measurement relies on pixel-aligned coordinates, which creates ambiguity when rendering UI text on high-DPI displays. The documented behavior specifies that glyph advances and string widths are reported in source pixels, but the runtime scaling applied by the operating system or graphics subsystem is not explicitly defined. This gap affects developers seeking to create accessible interfaces that remain legible across varying pixel densities without distorting the intended visual layout.
A precise goal would be to establish whether SpriteFont measurement results should be treated as device-independent units requiring multiplicative scaling, or as absolute pixel values that expect the developer to apply platform-specific conversion. The uncertainty stems from the absence of a standardized conversion point in the content pipeline or graphics device setup, and from inconsistent driver-level handling of DPI awareness across Windows, Linux, and macOS.
- Does SpriteFont.GetWidth() return values in logical pixels or physical pixels under high-DPI conditions?
- Should the content pipeline store DPI metadata alongside font assets to enable automatic scaling?
- How do present parameters and swap chain configurations on different operating systems influence the effective measurement outcome?