Font

@objc(PESDKFont)
open class Font : NSObject

A Font represents meta information about a font, that should be loaded into the SDK. If a font has a long name, the displayName can be used to substitude it within the UI. The font name is used by iOS to identify the font. This is usualy the filename of the font. But it can be different. To be sure use the font in a sandbox project, and get its ‘fontName’ attribute.

  • url

    The URL to the font, e.g. URL within a bundle. This is not needed when using system fonts.

    Declaration

    Swift

    @objc
    public let url: URL?
  • Some font names are long and rather ugly. In that case it is possible to change the displayed name of the font with this property.

    Declaration

    Swift

    @objc
    public let displayName: String
  • The name of the font as registered in the font manager.

    Declaration

    Swift

    @objc
    open var fontName: String
  • A unique identifier, that is used during (de)serialization to identify a font between platforms.

    Declaration

    Swift

    @objc
    open var identifier: String
  • Creates a font from the given font url, with the display name. The font name will be used as argument for the UIFont initializer, therefor the name does not necessarily need to equal the filename, but rather the font family. Please refer to the official Apple documentation for details. If you have trouble loading a font, please set up a test project, and try to load the font using UIFont, or use the interface builder to load the font, and print out the fontName.

    Declaration

    Swift

    @objc
    public init(url: URL, displayName: String, fontName: String, identifier: String)

    Parameters

    url

    The URL to the font, e.g. URL within a bundle.

    displayName

    The name for the font that is used within the UI.

    fontName

    The actual name of the font.

  • Creates a font with the given name and display name. This initializer should be used when adding system fonts. The font name will be used as argument for the UIFont initializer.

    Declaration

    Swift

    @objc
    public init(displayName: String, fontName: String, identifier: String)

    Parameters

    displayName

    The name for the font that is used within the UI.

    fontName

    The actual name of the font.