views:

36

answers:

1

Hello guys!

I try to use Helvetica font with size 13 pt. I have a problem, because I created an image with some text with this font and font size. Added it to my iPhone project, then I created a UILabel, added top on this image which was created in photoshop, I've used the same font and font size and it's totally different. Why is that?

+1  A: 

In iOS, the font size is in pixels instead of points which might explain the difference.

DarkDust
Yes, you have right, I've checked the documentation. How can I get rid of it?
Infinity
You can't change the unit in iOS. Guess you have to find the correct size either through trial and error or you can try to measure it: draw a text like "Tj" in Photoshop and measure the pixel distance between to topmost and bottommost pixels.
DarkDust
I tried it, but it isn't enough good. It has 1-2 pixel difference, and this makes the graphics bad. :( Any other solution?
Infinity
You are aware that the size is a float, so you can pass e.g. 6.5 ?
DarkDust
I don't know if it is a float, but it's a good idea, I try it, I never thought that it can be float.
Infinity
I've tried it, it's not perfect, but it seems to work. In photoshop I've set a font size of 12 and in interface builder I've set a 30.5 font size. The first letter is ok, the other ones has 1 pixel difference, but it is so little that the user can't see. Maybe a perfect one who can see every pixel difference. :) If anybody has a better solution please don't hesitate to write here. I also tried the 30.65, but it seems it isn't working.
Infinity