Font
class Font
An object representing a text font.
-
The name of the font.
Declaration
var name: String { get }
-
The family name of the font.
Declaration
var familyName: String { get }
-
The leading value of the font.
Declaration
var leading: Double { get }
-
The top y-coordinate, offset from the baseline, of the font’s longest ascender.
Declaration
var ascender: Double { get }
-
The bottom y-coordinate, offset from the baseline, of the font’s longest descender.
Declaration
var descender: Double { get }
-
The x-height of the font.
Declaration
var xHeight: Double { get }
-
The cap height of the font.
Declaration
var capHeight: Double { get }
-
The lineHeight height of the font.
Declaration
var lineHeight: Double { get }
-
The style of the font, e.g. bold, italic etc.
Declaration
var style: String { get }
-
The font size.
Declaration
var size: Double { get }
-
The path to the font’s file.
Declaration
var path: String? { get }
-
The file name of the font’s file.
Declaration
var fileName: String? { get }
-
The object’s description
Declaration
var description: String { get }
-
Compares two values for equality.
The
equals
function is invoked using infix notation as in the following code snippet:lhs == rhs
.Declaration
func equals(_ lhs: Font) -> Bool
Parameters
lhsA value.
rhsAnother value.
Return Value
true
if thelhs
andrhs
are equal,false
otherwise. -
Constructs a
CompositePath
which represents the outline of the characer’s glyph in this font.Declaration
func pathFor(character char: String) -> CompositePath
Parameters
charThe character for which to return the path.
Return Value
A path representing the outline of the character’s glyph.
-
Determines the width of the string when displayed with this font.
Declaration
func widthFor(string: String) -> Double
Parameters
stringA string.
Return Value
The width of the string when displayed with this font.