FontManager

public final class FontManager

Skia’s FontManager The default font manager can be accessed via the default static property of FontManager.

  • The default font manager

    Declaration

    Swift

    public static var system: FontManager
  • Gets the number of font families available.

    Declaration

    Swift

    public var fontFamilyCount: Int32 { get }
  • Gets all the font family names loaded by this font manager.

    Declaration

    Swift

    public var fontFamilies: [String] { get }
  • Returns the font style set for the specified index.

    Declaration

    Swift

    public func getFontStyles(index: Int32) -> FontStyleSet?
  • Use the system fallback to find the typeface styles for the given family.

    Declaration

    Swift

    public func getFontStyles(familyName: String) -> FontStyleSet

    Return Value

    Always returns a FontStyleSet, it might be an empty set if there is no font family match

  • Find the closest matching typeface to the specified family name and style.

    Declaration

    Swift

    public func match(familyName: String, style: FontStyle) -> Typeface

    Parameters

    familyName

    The font family name to use when searching.

    style

    The font style to use when searching.

    Return Value

    Returns the Typeface that contains the given family name and style, or the default font if no matching font was found.

  • Find the closest matching typeface to the specified family name and style.

    Declaration

    Swift

    public func match(typeface: Typeface, style: FontStyle) -> Typeface

    Parameters

    typeface

    The typeface to use when searching.

    style

    The font style to use when searching.

    Return Value

    Returns the Typeface that matches the typeface and style, or the default font if no matching font was found.

  • Creates a new SKTypeface from the specified file path.

    Declaration

    Swift

    public func createTypeface(path: String, index: Int32 = 0) -> Typeface?

    Parameters

    path

    The path to the typeface.

    index

    The TTC index

    Return Value

    the typeface from the specified path and TTC index, or nil on error.

  • Creates a new SKTypeface from the provided SKStream

    Declaration

    Swift

    public func createTypeface(stream: SKStream, index: Int32 = 0) -> Typeface?

    Parameters

    path

    The path to the typeface.

    index

    The TTC index

    Return Value

    the typeface from the specified path and TTC index, or nil on error.

  • Undocumented

    Declaration

    Swift

    public func scan<
      S : Sequence, U
    >(_ seq: S, _ initial: U, _ combine: (U, S.Iterator.Element) -> U) -> [U]
  • Use the system fallback to find a typeface for the given character.

    Declaration

    Swift

    public func match(familyName: String, char: Character, style: FontStyle = .normal, bcp47: [String]? = nil) -> Typeface?

    Parameters

    char

    The character to find a typeface for.

    familyName

    <#familyName description#>

    style

    The family name to use when searching.

    bcp47

    The ISO 639, 15924, and 3166-1 code to use when searching, such as ja and zh

  • Creates a new SKTypeface from the provided SKStream

    Declaration

    Swift

    public func createTypeface(data: SKData, index: Int32 = 0) -> Typeface?

    Parameters

    path

    The path to the typeface.

    index

    The TTC index

    Return Value

    the typeface from the specified path and TTC index, or nil on error.