Stefan Oltmann
07/14/2021, 2:16 PMwindow.graphicsConfiguration?.defaultTransform?.scaleX
Say I want to build a ruler composable that displays a box that's exactly 10cm long.Albert Chang
07/14/2021, 2:27 PMStefan Oltmann
07/14/2021, 2:29 PMMichael Paus
07/15/2021, 8:09 AMval renderScale = AppManager.focusedWindow?.window?.graphicsConfiguration?.defaultTransform?.scaleX ?: 1.0
val resolution = Toolkit.getDefaultToolkit().screenResolution
val nativeDPI = renderScale * resolution
Stefan Oltmann
07/15/2021, 8:17 AMuli
07/15/2021, 12:22 PMStefan Oltmann
07/15/2021, 12:23 PMMichael Paus
07/15/2021, 1:02 PMval px = LocalDensity.current.run { 1.dp.toPx() }
println("pixels: $px")
But that is just an alternative to get the renderScale
, isn’t it?Stefan Oltmann
07/15/2021, 1:03 PMMichael Paus
07/15/2021, 1:06 PMuli
07/15/2021, 3:58 PMMichael Paus
07/15/2021, 5:29 PMuli
07/15/2021, 6:10 PMAlbert Chang
07/16/2021, 12:00 AMAlso, people have different preferences—some people prefer larger text. For this reason, Windows enables the user to change the DPI setting. For example, if the user sets the display to 144 DPI, a 72-point font is 144 pixels tall. The standard DPI settings are 100% (96 DPI), 125% (120 DPI), and 150% (144 DPI). The user can also apply a custom setting.