get display's PPI

Hi all,

Just wondering if there’s a way to get the display’s pixels-per-inch (PPI). Getting the width and height in inches would be a fine alternative.

My end goal is to scale font size so that text remains at the same height, in inches, across all devices. So if there’s any way to do this without getting the display’s dimensions in inches I’d be willing to take that route too.

Thanks. [import]uid: 204879 topic_id: 34433 reply_id: 334433[/import]

Lord knows I was wrong in the drawing app thread :wink: but I do remember an old conversation about this topic specifically. The bottom line is that I’m not sure all (or any?) devices support reporting PPI, which means you would need to make a function in config.lua to generate that yourself.

(Anecdotal google searches tell me this is not available natively on iOS; android I heard has partial support?)

Actually generating the PPI could be quite tricky due to (a) corner cases like detecting iPad Mini vs. iPad 2, and (b) the sheer number of odd-resolution Android devices.

The Ultimate Config tutorial posted recently is easily the best solution I’ve seen for handling devices long-term, and probably is your best bet for extending to handle PPI if needed, but sadly you’ll probably have to handle the device list yourself. A shame, I do agree device manufacturers should be reporting this due to the usability issues in supporting different pixel densities and screen types.
[import]uid: 41884 topic_id: 34433 reply_id: 136896[/import]

Lord knows I was wrong in the drawing app thread :wink: but I do remember an old conversation about this topic specifically. The bottom line is that I’m not sure all (or any?) devices support reporting PPI, which means you would need to make a function in config.lua to generate that yourself.

(Anecdotal google searches tell me this is not available natively on iOS; android I heard has partial support?)

Actually generating the PPI could be quite tricky due to (a) corner cases like detecting iPad Mini vs. iPad 2, and (b) the sheer number of odd-resolution Android devices.

The Ultimate Config tutorial posted recently is easily the best solution I’ve seen for handling devices long-term, and probably is your best bet for extending to handle PPI if needed, but sadly you’ll probably have to handle the device list yourself. A shame, I do agree device manufacturers should be reporting this due to the usability issues in supporting different pixel densities and screen types.
[import]uid: 41884 topic_id: 34433 reply_id: 136896[/import]

Andrew, I don’t think there’s a way to do this. It is especially a problem with Android. Some ways of reporting this info have been discussed previously but AFAIK, nothing has been implemented yet. See http://developer.coronalabs.com/forum/2012/01/01/differentiating-between-small-or-large-screen-similar-screen-resolution. [import]uid: 29384 topic_id: 34433 reply_id: 137505[/import]

Andrew, I don’t think there’s a way to do this. It is especially a problem with Android. Some ways of reporting this info have been discussed previously but AFAIK, nothing has been implemented yet. See http://developer.coronalabs.com/forum/2012/01/01/differentiating-between-small-or-large-screen-similar-screen-resolution. [import]uid: 29384 topic_id: 34433 reply_id: 137505[/import]