I am a visual designer, working on an android design and I"m trying to spec my PSD file for our engineers. I cannot seem to find any documentation regarding the conversion of point size to SP for the type in any Android documentation. (Just that SP should be used for type).
There are 72 pts per inch, and 160 sp per inch (with standard font size in the device settings). this means there are 160sp per 72pts. 160sp/72pts simplifies to 20/9. So when converting pts to sp or dp use pts*20/9.
Both are fixed-sized units however with a pixel equal to one dot on your screen and a point equal to 1/72 of an inch. How many PX is a PT? One point is the equivalent of 1.333(3) pixels. On the other hand, one pixel is the equivalent of 0.75 points.
1 point (pt) is assumed to be 1/72nd of an inch. Therefore 16px = 12pt.
pt Points - 1/72 of an inch based on the physical size of the screen. dp Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen.
The problem is that it depends on the density. Really, they're not good measurements to try to compare.
Points: There are 12 points in a pica, 6 picas per inch, so 72 (more accurately 72.27) points per inch.
Device-Independent Pixels (DP): These will be equal to the pixel size for MDPI displays, 1.5x the pixel size for HDPI displays, and 2x the pixel size for XHDPI displays. (e.g. 12dp = 12px MDPI, 18px HDPI, 24px XHDPI).
Scaled Pixels: These will be equivalent to the DP value, but scaled according to the user preference to be smaller or larger.
If you're designing at 72 dpi (Photoshop default DPI setting), an 8pt font would be equivalent to 8px, which would be 8px at MDPI, 12px at HDPI, and 16px at XHDPI, or more simply 8dp for all densities. I don't know how much scaling gets applied to different SP settings, so you'd have to hunt that out, but basically I would just give them the mockup and let them size it appropriately from there -- surely they can get it pretty close visually from that.
In contrast to dp (and sp with minus the user text sizing factor), pt has pretty much the exact same physical measurement. Dp is more or less a rough approximation, since it uses the same factor for a wide dpi range.
You cannot convert pt to sp, like said by Flavio. You can, however convert pt to dp roughly (+/- 30% in extreme cases, but at least expect +/-10%).
Using the dpi buckets (ldp=120,mdpi=160,hdpi=240,xhdpi=320) the most generic conversion factor would be x0.45 (= 72/120*0.75 = 72/160*1 = 72/240*1,5 = 72/320*2) if using the exact dpi bucket values.
For more precise factors:
So 12 pt would be on...
You could use the same values for sp, but keep in mind, that these could be in/decreased by the users settings.
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