CPCFontMetricsProtocol

internal protocol CPCFontMetricsProtocol

Protocol that hides Dynamic Font implementation differences between iOS 10 and iOS 11+.

  • scaledValue(_:) Default implementation

    Get an arbitrary scaled value for current content size category.

    Default Implementation

    Declaration

    Swift

    func scaledValue(_ value: CGFloat) -> CGFloat

    Parameters

    value

    Value to scale.

    Return Value

    value, scaled according to user-selected content size category.

  • Get an arbitrary scaled value for a given contentSizeCategory.

    Declaration

    Swift

    func scaledValue(_ value: CGFloat, for contentSizeCategory: UIContentSizeCategory) -> CGFloat

    Parameters

    value

    Value to scale.

    contentSizeCategory

    Content size category to scale for.

    Return Value

    value, scaled according to given content size category.

  • scaledInsets(_:) Default implementation

    Get insets, scaled for current content size category.

    Default Implementation

    Declaration

    Swift

    func scaledInsets(_ insets: UIEdgeInsets) -> UIEdgeInsets

    Parameters

    insets

    Insets to scale.

    Return Value

    insets, scaled according to user-selected content size category.

  • scaledInsets(_:for:) Default implementation

    Get insets, scaled for a given contentSizeCategory.

    Default Implementation

    Declaration

    Swift

    func scaledInsets(_ insets: UIEdgeInsets, for contentSizeCategory: UIContentSizeCategory) -> UIEdgeInsets

    Parameters

    insets

    Insets to scale.

    contentSizeCategory

    Content size category to scale for.

    Return Value

    insets, scaled according to given content size category.

  • scaledFont(_:) Default implementation

    Get font, scaled for current content size category.

    Default Implementation

    Declaration

    Swift

    func scaledFont(_ font: UIFont) -> UIFont

    Parameters

    font

    Font to scale.

    Return Value

    font, scaled according to user-selected content size category.

  • scaledFont(_:for:) Default implementation

    Get font, scaled for a given contentSizeCategory.

    Default Implementation

    Declaration

    Swift

    func scaledFont(_ font: UIFont, for contentSizeCategory: UIContentSizeCategory) -> UIFont

    Parameters

    font

    Font to scale.

    contentSizeCategory

    Content size category to scale for.

    Return Value

    font, scaled according to given content size category.