What exactly is UIFont's point size?

后端 未结 5 1721
予麋鹿
予麋鹿 2020-12-23 12:36

I am struggling to understand exactly what the point size in UIFont means. It\'s not pixels and it doesn\'t appear to be the standard definition of point which

5条回答
  •  佛祖请我去吃肉
    2020-12-23 13:25

    I am not sure how -[NSString sizeWithFont:] measures the height. Does it use line height or the difference between the peaks of the beziers? What text did you use?

    I believe -[UIFont lineHeight] would be better to measure the height.

    Edit: Also, note that none of the measurement methods returns the size in pixels. It returns the size in points. You have to multiply the result by [UIScreen mainScreen].scale.

    Note the difference between typographic points used when constructing the font and points from iOS default logical coordinate space. Unfortunately, the difference is not explained very clearly in the documentation.

提交回复
热议问题