How do I convert pt to sp?

Megatallica picture Megatallica · Nov 15, 2012 · Viewed 61.5k times · Source

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).

Answer

Kevin Coppock picture Kevin Coppock · Nov 15, 2012

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.