What exactly is UIFont's point size?

后端 未结 5 1717
予麋鹿
予麋鹿 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:12

    The truth, as far as I have been able to ascertain, is that UIFont lies. All of UIKit takes liberties with fonts. If you want the truth you need to use CoreText, but in a lot of cases it will be slower! (So in the case of your pixel height table I think it was that it adds some sort of a + bx factor where x is point size.

    So why does it do this? Speed! UIKit rounds up stuff and fiddles with spacing so that it can cache bitmaps. Or at least that was my take away!

提交回复
热议问题