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.
-
Untyped pointer to the underlying
PangoFontinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
font_ptrDefault implementationTyped pointer to the underlying
PangoFontinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
PangoFontinstance.Declaration
Swift
var font_ptr: UnsafeMutablePointer<PangoFont>! { get } -
Required Initialiser for types conforming to
FontProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
describe()Extension methodReturns a description of the font, with font size set in points.
Use [method
Pango.Font.describe_with_absolute_size] if you want the font size in device units.Declaration
Swift
@inlinable func describe() -> Pango.FontDescriptionRef! -
describeWithAbsoluteSize()Extension methodReturns a description of the font, with absolute font size set in device units.
Use [method
Pango.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 methodGets the
PangoFontFaceto whichfontbelongs.Declaration
Swift
@inlinable func getFace() -> Pango.FontFaceRef! -
get(features:Extension methodlen: numFeatures: ) 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 methodGets 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
PangoContextholds a reference to the font map.Declaration
Swift
@inlinable func getFontMap() -> Pango.FontMapRef! -
getGlyphExtents(glyph:Extension methodinkRect: logicalRect: ) 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(), andPANGO_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
fontisnil, 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) -
getGlyphExtents(glyph:Extension methodinkRect: logicalRect: ) 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(), andPANGO_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
fontisnil, 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 methodGet a
hb_font_tobject 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, usehb_font_create_sub_font().Declaration
Swift
@inlinable func getHbFont() -> HarfBuzz.font_tRef! -
getLanguages()Extension methodReturns the languages that are supported by
font.If the font backend does not provide this information,
nilis 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
fontisnil, 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
fontisnil, 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 methodSerializes the
fontin 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 [func
Pango.Font.deserialize].Declaration
Swift
@inlinable func serialize() -> GLib.BytesRef! -
faceExtension methodGets the
PangoFontFaceto whichfontbelongs.Declaration
Swift
@inlinable var face: Pango.FontFaceRef! { get } -
fontMapExtension methodGets 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
PangoContextholds a reference to the font map.Declaration
Swift
@inlinable var fontMap: Pango.FontMapRef! { get } -
hbFontExtension methodGet a
hb_font_tobject 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, usehb_font_create_sub_font().Declaration
Swift
@inlinable var hbFont: HarfBuzz.font_tRef! { get } -
languagesExtension methodReturns the languages that are supported by
font.If the font backend does not provide this information,
nilis 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 } -
parentInstanceExtension methodUndocumented
Declaration
Swift
@inlinable var parentInstance: GObject { get }
View on GitHub
Install in Dash
FontProtocol Protocol Reference