Reputation: 127
I'm using multi images and counting font sizes using Display.getInstance().convertToPixels(sizeInMM)
, which on majority of devices works great. On old android tablet, if I set font size to 2.1mm, it actualy has that size. The problem is with newer small devices with retina display. 2.1mm font on iPhone 6 is only 1.9mm, which is not that bad, but on iPad mini with retina, it's only 1.1, which is pretty much unusable... How can I overcome that limitation?
I was thinking about adding some kind of correction to the conversion like:
if (isIOS() && isTablet()) {
return Display.getInstance().convertToPixels(sizeInMM * 2);
} else if (isIPhone6_OrHigher()) {
return Display.getInstance().convertToPixels(sizeInMM * 1.1);
} else if (...) {
...
}
But I think that's just not the way cn1 is designed. At least in doc, this is not recommended...
Upvotes: 1
Views: 29
Reputation: 52770
That's a pretty problematic scenario. Apple doesn't want us to detect iPad mini, some hacks exist and we considered using them to give a slightly different DPI for iPad mini but ultimately they are hacks so we decided to avoid that and treat it like an iPad which is what Apple "wants".
That sounds bad but it's generally a good practice, you are relying a bit too much on the accuracy of the sizes returned by convertToPixels
which is a problem as these sizes are often reported incorrectly by devices especially on Android. This usually isn't a problem if elements are too big but as you discovered it is an issue when elements are too small which is why we usually aim at 2.5mm font size and use 2mm only for very small text.
Upvotes: 0