What is pointSize?

Asked 1 years ago, Updated 1 years ago, 129 views

I think Size which is casually set to 40 in the UI below is pointSize...
What size is this in font?

Enter a description of the image here

The background of the question is to facilitate communication with the designer.
"When using Japanese words such as ""line spacing"" and ""font size"", we almost made a communication error with each other during fine adjustment, so I would like to know exactly what it is."

https://developer.apple.com/documentation/uikit/uifont/1619031-pointsize

The receiver's point size, or the effective vertical point size for a font with an anonymous matrix.

I don't know what effective means.

https://developer.apple.com/library/archive/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/CustomTextProcessing/CustomTextProcessing.html

contains Ascent, Descent, Linegap, but there is no pointSize.
I wrote down the source below to find out what it was, but I couldn't guess what it was from the output...

class ViewController:UIViewController {
    @IBOutlet weak var hogeLabel:UILabel!

    override func viewDidLoad(){
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from anib.

        print(hogeLabel.font.pointSize)
        print(hogeLabel.font.ascender)
        print(hogeLabel.font.descender)
        print(hogeLabel.font.lineHeight)
        print(hogeLabel.font.lineHeight/hogeLabel.font.pointSize)
    }
}
40.0
38.0859375
-9.6484375
47.734375
1.193359375

swift ios font

2022-09-30 21:36

1 Answers

Roughly speaking, the height required to draw a font is the number of points in the font.
However, even if the font size is the same, the distance from the bottom of the height indicated by the point to the baseline is not always the same, and some fonts for typography and calligraphy are drawn over the point size.

The baseline is the equivalent of a line (a ruled line in a note) to align the bottom of characters such as ABCabc, such as g or y, Descender, descender, and lowest uppercase character.
 However, this is the main rule in European fonts, and considering the balance with European fonts, Japanese and other fonts stick slightly below the baseline.

This is not Apple's specification, but the numbers that type setter companies like Adobe and Morrisawa defined when they decided to format the font file, so for more information, you need to dig into the font design company's description and the format .ttf, .otf

I'm aware of the height of the question, but please forgive me for writing a book in the X direction because if f followed by i, pull a short vertical bar under the starting point of f, and if AV followed, there will be too many gaps.


2022-09-30 21:36

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.