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.
-
The path to the font, e.g. path within a bundle. This is not needed when using system fonts.
Declaration
Swift
open let path: String
-
Some font names are long and rather ugly. In that case it is possible to add an entry to this dictionary, the key being the name of the font and the value being the name that should be used instead.
Declaration
Swift
open let displayName: String
-
The name of the font.
Declaration
Swift
open var fontName: String
-
A unique identifier, that is used during (de)serialization to identify a font between platforms. You might think that we could have used the fontName, but our experience showed us that this is not reliable. Also if a font isn’t available, and you want to map it to a system font as substitute, you can use the identifier.
Declaration
Swift
open var identifier: String
-
Creates a font from the given font path, 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 usingUIFont
, or use the interface builder to load the font, and print out thefontName
.Declaration
Swift
public init(path: String, displayName: String, fontName: String, identifier: String)
Parameters
path
The path to the font, e.g. path 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
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.