Contents

monospacedDigitSystemFont(ofSize:weight:)

Returns the standard system font with all digits of consistent width.

Declaration

class func monospacedDigitSystemFont(ofSize fontSize: CGFloat, weight: UIFont.Weight) -> UIFont

Parameters

  • fontSize:

    The size (in points) for the font. This value must be greater than 0.0.

  • weight:

    The weight of the font, specified as a font weight constant. For a list of possible values, see Weight. Avoid passing an arbitrary floating-point number for weight, because a font might not include a variant for every weight.

Return Value

A font object of the specified size and weight, with variable-width text and fixed-width digits.

Discussion

The system font uses proportional spacing. When displaying numerical data, you can use this method to retrieve a monospace font for displaying that data. With a monospaced font, each digit occupies the same amount of space, which makes it easier to read numbers that are stacked vertically.

See Also

Creating System Fonts