Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert points to the XCode font size

I have the Photoshop file contains iOS application's design and I need to get info about font sizes for all labels and other controls. The size in Photoshop is shown in points by default, so how can I convert this value to the XCode one? For example:

enter image description here

enter image description here

Thanks in advance.

like image 723
FrozenHeart Avatar asked Jan 26 '26 17:01

FrozenHeart


2 Answers

Based on @MichaelCrawford answer, if AdobePoint = 1/72 of inch then we could calculate transition formula to ApplePoints.

What we need to know is:

  • Photoshop file resolution (px/inch) - Res
  • Photoshop mockup size, i.e for what iPhone factor it's created like @2x, @3x - Factor
  • Photoshop text size in AdobePoints - PSFont

Then, as I understand, you can calculate iPhone Font size (that actually equals iPhone points), like this

iPhoneFontSize = (Res / 72 ) * PSFont / Factor

Example: You have mockup for iPhone 5, but all media also good for iPhone6+, then mockup size is iPhone 5 size * 3 = 960x1704, resolution is 401 (for iPhone6+). TabBar title font size on this mockup is 5 pt

Therefore, on iPhone you should setup size as 401 / 72 * 5 / 3 = 9.28

If resolution of file is 72 (for Web), you just need to divide PSFontSize to factor as you usually do to calculate control or imageView size.

like image 162
alexey.metelkin Avatar answered Jan 28 '26 08:01

alexey.metelkin


An "Adobe Point" is 1/72 of an inch, so 0.01389 inches.

The iPhone 6 screen has 376 by 667 "Apple Points" on a display whose diagonal is 4.7 inches. Now if I can remember my algebra... it's been so long.

376^2 + 667^2 = d^2

where "d" is the count of Apple Points along the diagonal. d^2 is 579,578; d is the square root of that or 761.3. Divide that by 4.7 inches, we get 161.98 Apple Points per inch.

So an Apple Point is somewhat less than half the height of an Adobe Point.

Does a factor of 0.444 work for you? Or perhaps the inverse of 2.25. Say your Photoshop image has 14-point type. In Xcode, you'd want 31 Points.

like image 45
Mike Crawford Avatar answered Jan 28 '26 08:01

Mike Crawford