FontProtocol

public protocol FontProtocol : ObjectProtocol

A PangoFont is used to represent a font in a rendering-system-independent manner.

The FontProtocol protocol exposes the methods and properties of an underlying PangoFont instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see Font. Alternatively, use FontRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying PangoFont instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • font_ptr Default implementation

    Typed pointer to the underlying PangoFont instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the PangoFont instance.

    Declaration

    Swift

    var font_ptr: UnsafeMutablePointer<PangoFont>! { get }
  • Required Initialiser for types conforming to FontProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Font Class: FontProtocol extension (methods and fields)

  • describe() Extension method

    Returns a description of the font, with font size set in points.

    Use [methodPango.Font.describe_with_absolute_size] if you want the font size in device units.

    Declaration

    Swift

    @inlinable
    func describe() -> Pango.FontDescriptionRef!
  • describeWithAbsoluteSize() Extension method

    Returns a description of the font, with absolute font size set in device units.

    Use [methodPango.Font.describe] if you want the font size in points.

    Declaration

    Swift

    @inlinable
    func describeWithAbsoluteSize() -> Pango.FontDescriptionRef!
  • getCoverage(language:) Extension method

    Computes the coverage map for a given font and language tag.

    Declaration

    Swift

    @inlinable
    func getCoverage<LanguageT>(language: LanguageT) -> Pango.CoverageRef! where LanguageT : LanguageProtocol
  • getFace() Extension method

    Gets the PangoFontFace to which font belongs.

    Declaration

    Swift

    @inlinable
    func getFace() -> Pango.FontFaceRef!
  • Obtain the OpenType features that are provided by the font.

    These are passed to the rendering system, together with features that have been explicitly set via attributes.

    Note that this does not include OpenType features which the rendering system enables by default.

    Declaration

    Swift

    @inlinable
    func get(features: UnsafeMutablePointer<hb_feature_t>!, len: Int, numFeatures: UnsafeMutablePointer<guint>!)
  • getFontMap() Extension method

    Gets the font map for which the font was created.

    Note that the font maintains a weak reference to the font map, so if all references to font map are dropped, the font map will be finalized even if there are fonts created with the font map that are still alive. In that case this function will return nil.

    It is the responsibility of the user to ensure that the font map is kept alive. In most uses this is not an issue as a PangoContext holds a reference to the font map.

    Declaration

    Swift

    @inlinable
    func getFontMap() -> Pango.FontMapRef!
  • Gets the logical and ink extents of a glyph within a font.

    The coordinate system for each rectangle has its origin at the base line and horizontal origin of the character with increasing coordinates extending to the right and down. The macros PANGO_ASCENT(), PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING() can be used to convert from the extents rectangle to more traditional font metrics. The units of the rectangles are in 1/PANGO_SCALE of a device unit.

    If font is nil, this function gracefully sets some sane values in the output variables and returns.

    Declaration

    Swift

    @inlinable
    func getGlyphExtents(glyph: PangoGlyph, inkRect: RectangleRef? = nil, logicalRect: RectangleRef? = nil)
  • Gets the logical and ink extents of a glyph within a font.

    The coordinate system for each rectangle has its origin at the base line and horizontal origin of the character with increasing coordinates extending to the right and down. The macros PANGO_ASCENT(), PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING() can be used to convert from the extents rectangle to more traditional font metrics. The units of the rectangles are in 1/PANGO_SCALE of a device unit.

    If font is nil, this function gracefully sets some sane values in the output variables and returns.

    Declaration

    Swift

    @inlinable
    func getGlyphExtents<RectangleT>(glyph: PangoGlyph, inkRect: RectangleT?, logicalRect: RectangleT?) where RectangleT : RectangleProtocol
  • getHbFont() Extension method

    Get a hb_font_t object backing this font.

    Note that the objects returned by this function are cached and immutable. If you need to make changes to the hb_font_t, use hb_font_create_sub_font().

    Declaration

    Swift

    @inlinable
    func getHbFont() -> HarfBuzz.font_tRef!
  • getLanguages() Extension method

    Returns the languages that are supported by font.

    If the font backend does not provide this information, nil is returned. For the fontconfig backend, this corresponds to the FC_LANG member of the FcPattern.

    The returned array is only valid as long as the font and its fontmap are valid.

    Declaration

    Swift

    @inlinable
    func getLanguages() -> UnsafeMutablePointer<UnsafeMutablePointer<PangoLanguage>?>!
  • getMetrics(language:) Extension method

    Gets overall metric information for a font.

    Since the metrics may be substantially different for different scripts, a language tag can be provided to indicate that the metrics should be retrieved that correspond to the script(s) used by that language.

    If font is nil, this function gracefully sets some sane values in the output variables and returns.

    Declaration

    Swift

    @inlinable
    func getMetrics(language: LanguageRef? = nil) -> Pango.FontMetricsRef!
  • getMetrics(language:) Extension method

    Gets overall metric information for a font.

    Since the metrics may be substantially different for different scripts, a language tag can be provided to indicate that the metrics should be retrieved that correspond to the script(s) used by that language.

    If font is nil, this function gracefully sets some sane values in the output variables and returns.

    Declaration

    Swift

    @inlinable
    func getMetrics<LanguageT>(language: LanguageT?) -> Pango.FontMetricsRef! where LanguageT : LanguageProtocol
  • hasChar(wc:) Extension method

    Returns whether the font provides a glyph for this character.

    Declaration

    Swift

    @inlinable
    func hasChar(wc: gunichar) -> Bool
  • serialize() Extension method

    Serializes the font in a way that can be uniquely identified.

    There are no guarantees about the format of the output across different versions of Pango.

    The intended use of this function is testing, benchmarking and debugging. The format is not meant as a permanent storage format.

    To recreate a font from its serialized form, use [funcPango.Font.deserialize].

    Declaration

    Swift

    @inlinable
    func serialize() -> GLib.BytesRef!
  • face Extension method

    Gets the PangoFontFace to which font belongs.

    Declaration

    Swift

    @inlinable
    var face: Pango.FontFaceRef! { get }
  • fontMap Extension method

    Gets the font map for which the font was created.

    Note that the font maintains a weak reference to the font map, so if all references to font map are dropped, the font map will be finalized even if there are fonts created with the font map that are still alive. In that case this function will return nil.

    It is the responsibility of the user to ensure that the font map is kept alive. In most uses this is not an issue as a PangoContext holds a reference to the font map.

    Declaration

    Swift

    @inlinable
    var fontMap: Pango.FontMapRef! { get }
  • hbFont Extension method

    Get a hb_font_t object backing this font.

    Note that the objects returned by this function are cached and immutable. If you need to make changes to the hb_font_t, use hb_font_create_sub_font().

    Declaration

    Swift

    @inlinable
    var hbFont: HarfBuzz.font_tRef! { get }
  • languages Extension method

    Returns the languages that are supported by font.

    If the font backend does not provide this information, nil is returned. For the fontconfig backend, this corresponds to the FC_LANG member of the FcPattern.

    The returned array is only valid as long as the font and its fontmap are valid.

    Declaration

    Swift

    @inlinable
    var languages: UnsafeMutablePointer<UnsafeMutablePointer<PangoLanguage>?>! { get }
  • parentInstance Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parentInstance: GObject { get }