3

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.

FrozenHeart
  • 19,844
  • 33
  • 126
  • 242

3 Answers3

10

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.

alexey.metelkin
  • 1,309
  • 1
  • 11
  • 20
  • I have been trying to follow your logic but seem to be a bit lost. Could you advice if I am on the right path -> I have designs in PSD developed by a designer for 6 Plus - one of the labels is 55 Points, Image Size within PSD is set to 72 pixels / inch. The developer wants to use pixel size - is this the right way to go about doing so ? if i were to replicate the formula does this look right for my situation = 401/72 * 55pt / 3 = 102 Points ? would this be points or pixels ? - Thanks in advance – Rahul Dighe Aug 24 '16 at 00:03
  • @Rahul, this is apple font size point, which will automatically change text size, depending on scale factor. it's same as pixel on scale factor = 1. Developer should just set this as font size of label or text field. Another way to get this value is setup PS to measure in pixels: go to PS settings (cmd+K) -> Units & Rules -> Units block -> Type combo -> choose Pixels. And just divide this value by your factor (3 in your case) – alexey.metelkin Aug 24 '16 at 17:39
  • Thank you, the computation worked for me! @alexey.hippie – KarenAnne May 11 '18 at 08:26
1

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.

Mike Crawford
  • 2,232
  • 2
  • 18
  • 28
0

Try creating a very simple app that has wide selection of different text sizes, all of them with Xcode points - what I called "Apple Points". So you could have Helvetica 6, Helvetica 7, Helvetica 8, all the way up to a size that's clearly larger than you will need for this design.

Then print your Photoshop file on paper. Note that you can't really count on screen pixels to be any particular size. A hirez monitor with a small screen will also have smaller pixels.

Compare the paper Photoshop design hardcopy to the text on the screen. That should give you an idea of the ratio.

Mike Crawford
  • 2,232
  • 2
  • 18
  • 28