cassidyjames / dippi

Calculate display info like DPI and aspect ratio
https://cassidyjames.com/dippi
GNU General Public License v3.0
76 stars 26 forks source link

Compute DPI for smartphones too #130

Open Kekun opened 2 weeks ago

Kekun commented 2 weeks ago

I have a OnePlus 6, which has a 19:9 6.22" 2280×1080 ~405 DPI screen, and it runs postmarketOS with GNOME Shell. Its default DPI is 300% for a logical DPI of 135, but I find that fairly high for a device as close to our faces as a smartphone, so I set it to 275% for a 147 logical DPI, which I find to work better (fractional scaling glitches aside).

While this issue seems to be related to https://github.com/cassidyjames/dippi/issues/129, it's not, what I am trying to say is just as laptops and desktops have different DPI recommendations because of how close or far we put them to our face, so are smartphones and given Linux is starting to work almost decently on phones (even if it's all still very experimental), it's be nice to have dippi support smartphones as a device type, with a target logical DPI of 145~150 maybe, 160 is a bit too high, and 135 is a bit too tiny.

For reference, the OnePlus 6 has a DPI of 402, and postmarketOS defaults GNOME to 300% on it for a logical DPI of 134 and a logical screen size of 360×760, and it's a bit large, larger than the ideal for a laptop even as we hold smartphones even closer to our eyes. I feel a scale of 250% for ~161 logical DPI is starting to bee really hard to read, and 275% for ~146 logical DPI strikes the right balance.

Kekun commented 3 days ago

If my calculations are correct (or more exactly, if the info I base them on are correct), the iPhone 12, Pro and Pro Max have a DPI of 456 and a scale of 300%, so the matching logical DPI is 152. The iPhone 12 Mini has a DPI of 496 and a scale of 300%, so the matching logical DPI is 165. I don't know if the diagonals I found account for the rounded corners or not, which is what could make my calculations fluctuate the most.

Regardless, 152 logical DPI as a target feels about right for a "regular" phone. On my OnePlus 6 running GNOME and its 402 DPI screen, I feel like the right scale is somewhere in between 250% (160 logical DPI) and 275% (146 logical DPI).


I just checked my Xperia 10 IV and it also has a 456 DPI screen. It seems to me 456 DPI and 300% scaling (so 152 logical DPI) pretty much was the gold standard for smartphones a few years ago, and likely is what we should target too.

Also I may be wrong be I had the impression this phone's Android lets me choose the UI's scaling between:

It's hard to tell because it only shows a stepped scale (only the steps are valid values) and there are no numbers visible, but it's the impression these steps give me.


It took me time but I found out that Android defines the Density Independent Pixel unit (dp or dip) as a pixel at 160 DPI, and it's the base for their scaling model. It kinda makes sense, and that's exactly what I have if I set the scale to 250% on my OnePlus 6 running GNOME, but I feel like it' really is the upper limit, beyond that it's definitely too small and it's already too small to my liking, I think 152 DPI is a better target.