I need to know active screen DPI on Linux and Mac OS. I think on linux xlib might be useful, but I can't find a way how to get currect DPI. I want this information to get real screen size in inches.
Thanks in advance!
The default dpi in Ubuntu is set-up to 96. To increase it, you will have to go to properties of the desktop. This you can do by right clicking your mouse or using the properties button of your keyboard. A window will appear and you will a “Font” tab on the upper side of this window.
On a mac, use CGDisplayScreenSize to get the screen size in millimeters.
In X on Linux, call XOpenDisplay()
to get the Display
, then use DisplayWidthMM()
and DisplayHeightMM()
together with DisplayWidth()
and DisplayHeight()
to compute the DPI.
On the Mac, there's almost certainly a more native API to use than X. Mac OS X does not run X Window by default, it has a native windowing environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With