diff --git a/DesignKit/Source/Fonts.swift b/DesignKit/Source/Fonts.swift index cbacbe991..1cce963ed 100644 --- a/DesignKit/Source/Fonts.swift +++ b/DesignKit/Source/Fonts.swift @@ -16,31 +16,68 @@ import UIKit -/// Describe Fonts +/// Describe fonts used in the application. +/// Font names are based on Element typograhy https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1362%3A0 which is based on Apple font text styles (UIFont.TextStyle): https://developer.apple.com/documentation/uikit/uifonttextstyle +/// Create a custom TextStyle enum (like DesignKit.Fonts.TextStyle) is also a possiblity @objc public protocol Fonts { - /// Returns an instance of the font associated with the text style and scaled appropriately for the content size category defined in the trait collection. - func font(forTextStyle textStyle: UIFont.TextStyle, compatibleWith traitCollection: UITraitCollection?) -> UIFont - - // MARK: - TextStyle shortcuts - + /// The font for large titles. var largeTitle: UIFont { get } - var title1: UIFont { get } - var title2: UIFont { get } - var title3: UIFont { get } - var headline: UIFont { get } - var subheadline: UIFont { get } - var body: UIFont { get } - var callout: UIFont { get } - var caption1: UIFont { get } - var caption2: UIFont { get } -} - -// MARK: - Default implementation -extension Fonts { - /// Returns an instance of the font associated with the text style and scaled appropriately for the user's selected content size category. - func font(forTextStyle textStyle: UIFont.TextStyle) -> UIFont { - return self.font(forTextStyle: textStyle, compatibleWith: nil) - } + /// `largeTitle` with a Bold weight. + var largeTitleB: UIFont { get } + + /// The font for first-level hierarchical headings. + var title1: UIFont { get } + + /// `title1` with a Bold weight. + var title1B: UIFont { get } + + /// The font for second-level hierarchical headings. + var title2: UIFont { get } + + /// `title2` with a Bold weight. + var title2B: UIFont { get } + + /// The font for third-level hierarchical headings. + var title3: UIFont { get } + + /// `title3` with a Semi Bold weight. + var title3SB: UIFont { get } + + /// The font for headings. + var headline: UIFont { get } + + /// The font for subheadings. + var subheadline: UIFont { get } + + /// The font for body text. + var body: UIFont { get } + + /// `body` with a Semi Bold weight. + var bodySB: UIFont { get } + + /// The font for callouts. + var callout: UIFont { get } + + /// `callout` with a Semi Bold weight. + var calloutSB: UIFont { get } + + /// The font for footnotes. + var footnote: UIFont { get } + + /// `footnote` with a Semi Bold weight. + var footnoteSB: UIFont { get } + + /// The font for standard captions. + var caption1: UIFont { get } + + /// `caption1` with a Semi Bold weight. + var caption1SB: UIFont { get } + + /// The font for alternate captions. + var caption2: UIFont { get } + + /// `caption2` with a Semi Bold weight. + var caption2SB: UIFont { get } }