gi-pangocairo-1.0.26: PangoCairo bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.PangoCairo.Interfaces.FontMap

Description

PangoCairoFontMap is an interface exported by font maps for use with Cairo.

The actual type of the font map will depend on the particular font technology Cairo was compiled to use.

Since: 1.10

Synopsis

Exported types

newtype FontMap Source #

Memory-managed wrapper type.

Constructors

FontMap (ManagedPtr FontMap) 

class (GObject o, IsDescendantOf FontMap o) => IsFontMap o Source #

Type class for types which can be safely cast to FontMap, for instance with toFontMap.

Instances

Instances details
(GObject o, IsDescendantOf FontMap o) => IsFontMap o Source # 
Instance details

Defined in GI.PangoCairo.Interfaces.FontMap

toFontMap :: (MonadIO m, IsFontMap o) => o -> m FontMap Source #

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

Methods

getDefault

fontMapGetDefault Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m FontMap

Returns: the default PangoCairo fontmap for the current thread. This object is owned by Pango and must not be freed.

Gets a default PangoCairoFontMap to use with Cairo.

Note that the type of the returned object will depend on the particular font backend Cairo was compiled to use; you generally should only use the PangoFontMap and PangoCairoFontMap interfaces on the returned object.

The default Cairo fontmap can be changed by using fontMapSetDefault. This can be used to change the Cairo font backend that the default fontmap uses for example.

Note that since Pango 1.32.6, the default fontmap is per-thread. Each thread gets its own default fontmap. In this way, PangoCairo can be used safely from multiple threads.

Since: 1.10

getFontType

fontMapGetFontType Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontMap a) 
=> a

fontmap: a PangoCairoFontMap

-> m FontType

Returns: the cairo_font_type_t cairo font backend type

Gets the type of Cairo font backend that fontmap uses.

Since: 1.18

getResolution

fontMapGetResolution Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontMap a) 
=> a

fontmap: a PangoCairoFontMap

-> m Double

Returns: the resolution in "dots per inch"

Gets the resolution for the fontmap.

See fontMapSetResolution.

Since: 1.10

new

fontMapNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m FontMap

Returns: the newly allocated PangoFontMap, which should be freed with objectUnref.

Creates a new PangoCairoFontMap object.

A fontmap is used to cache information about available fonts, and holds certain global parameters such as the resolution. In most cases, you can use @func@PangoCairo.font_map_get_default] instead.

Note that the type of the returned object will depend on the particular font backend Cairo was compiled to use; You generally should only use the PangoFontMap and @PangoCairoFontMap` interfaces on the returned object.

You can override the type of backend returned by using an environment variable PANGOCAIRO_BACKEND. Supported types, based on your build, are fc (fontconfig), win32, and coretext. If requested type is not available, NULL is returned. Ie. this is only useful for testing, when at least two backends are compiled in.

Since: 1.10

newForFontType

fontMapNewForFontType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> FontType

fonttype: desired FontType

-> m (Maybe FontMap)

Returns: the newly allocated PangoFontMap of suitable type which should be freed with objectUnref, or Nothing if the requested cairo font backend is not supported / compiled in.

Creates a new PangoCairoFontMap object of the type suitable to be used with cairo font backend of type fonttype.

In most cases one should simply use [funcpangoCairo.FontMap.new], or in fact in most of those cases, just use [funcpangoCairo.FontMap.get_default].

Since: 1.18

setDefault

fontMapSetDefault Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontMap a) 
=> a

fontmap: The new default font map

-> m () 

Sets a default PangoCairoFontMap to use with Cairo.

This can be used to change the Cairo font backend that the default fontmap uses for example. The old default font map is unreffed and the new font map referenced.

Note that since Pango 1.32.6, the default fontmap is per-thread. This function only changes the default fontmap for the current thread. Default fontmaps of existing threads are not changed. Default fontmaps of any new threads will still be created using [funcpangoCairo.FontMap.new].

A value of Nothing for fontmap will cause the current default font map to be released and a new default font map to be created on demand, using [funcpangoCairo.FontMap.new].

Since: 1.22

setResolution

fontMapSetResolution Source #

Arguments

:: (HasCallStack, MonadIO m, IsFontMap a) 
=> a

fontmap: a PangoCairoFontMap

-> Double

dpi: the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.)

-> m () 

Sets the resolution for the fontmap.

This is a scale factor between points specified in a PangoFontDescription and Cairo units. The default value is 96, meaning that a 10 point font will be 13 units high. (10 * 96. / 72. = 13.3).

Since: 1.10