gi-pango-1.0.22: Pango bindings
Copyright Will Thompson Iñaki García Etxebarria and Jonas Platte LGPL-2.1 Iñaki García Etxebarria None Haskell2010

GI.Pango.Objects.Font

Description

The Font structure is used to represent a font in a rendering-system-independent matter. To create an implementation of a Font, the rendering-system specific code should allocate a larger structure that contains a nested Font, fill in the <structfield>klass</structfield> member of the nested Font with a pointer to a appropriate FontClass, then call pango_font_init() on the structure.

The Font structure contains one member which the implementation fills in.

Synopsis

# Exported types

newtype Font Source #

Memory-managed wrapper type.

Constructors

 Font (ManagedPtr Font)

#### Instances

Instances details
 Source # Instance detailsDefined in GI.Pango.Objects.Font Methods(==) :: Font -> Font -> Bool #(/=) :: Font -> Font -> Bool # Source # Instance detailsDefined in GI.Pango.Objects.Font Methods Source # Convert Font to and from GValue with toGValue and fromGValue. Instance detailsDefined in GI.Pango.Objects.Font Methods Source # Instance detailsDefined in GI.Pango.Objects.Font type ParentTypes Font Source # Instance detailsDefined in GI.Pango.Objects.Font type ParentTypes Font = '[Object]

class (GObject o, IsDescendantOf Font o) => IsFont o Source #

Type class for types which can be safely cast to Font, for instance with toFont.

#### Instances

Instances details
 (GObject o, IsDescendantOf Font o) => IsFont o Source # Instance detailsDefined in GI.Pango.Objects.Font

toFont :: (MonadIO m, IsFont o) => o -> m Font Source #

Cast to Font, for types for which this is known to be safe. For general casts, use castTo.

A convenience alias for Nothing :: Maybe Font.

# Methods

## describe

Arguments

 :: (HasCallStack, MonadIO m, IsFont a) => a font: a Font -> m FontDescription Returns: a newly-allocated FontDescription object.

Returns a description of the font, with font size set in points. Use fontDescribeWithAbsoluteSize if you want the font size in device units.

## describeWithAbsoluteSize

Arguments

 :: (HasCallStack, MonadIO m, IsFont a) => a font: a Font -> m FontDescription Returns: a newly-allocated FontDescription object.

Returns a description of the font, with absolute font size set (in device units). Use fontDescribe if you want the font size in points.

Since: 1.14

## descriptionsFree

Arguments

 :: (HasCallStack, MonadIO m) => Maybe [FontDescription] descs: a pointer to an array of FontDescription, may be Nothing -> m ()

Frees an array of font descriptions.

## findShaper

Arguments

 :: (HasCallStack, MonadIO m, IsFont a) => a font: a Font -> Language language: the language tag -> Word32 ch: a Unicode character. -> m EngineShape Returns: the best matching shaper.

Finds the best matching shaper for a font for a particular language tag and character point.

## getFontMap

Arguments

 :: (HasCallStack, MonadIO m, IsFont a) => a font: a Font, or Nothing -> m (Maybe FontMap) Returns: the FontMap for the font, or Nothing if font is Nothing.

Gets the font map for which the font was created.

Note that the font maintains a <firstterm>weak</firstterm> 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 Nothing. 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 Context holds a reference to the font map.

Since: 1.10

## getGlyphExtents

Arguments

 :: (HasCallStack, MonadIO m, IsFont a) => a font: a Font -> Word32 glyph: the glyph index -> m (Rectangle, Rectangle)

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 Nothing, this function gracefully sets some sane values in the output variables and returns.

## getMetrics

Arguments

 :: (HasCallStack, MonadIO m, IsFont a) => a font: a Font -> Maybe Language language: language tag used to determine which script to get the metrics for, or Nothing to indicate to get the metrics for the entire font. -> m FontMetrics Returns: a FontMetrics object. The caller must call fontMetricsUnref when finished using the object.

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 Nothing, this function gracefully sets some sane values in the output variables and returns.