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.Context

Description

The Context structure stores global information used to control the itemization process.

Synopsis

# Exported types

newtype Context Source #

Memory-managed wrapper type.

Constructors

 Context (ManagedPtr Context)

#### Instances

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

class (GObject o, IsDescendantOf Context o) => IsContext o Source #

Type class for types which can be safely cast to Context, for instance with toContext.

#### Instances

Instances details
 Source # Instance detailsDefined in GI.Pango.Objects.Context

toContext :: (MonadIO m, IsContext o) => o -> m Context Source #

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

A convenience alias for Nothing :: Maybe Context.

# Methods

## changed

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> m ()

Forces a change in the context, which will cause any Layout using this context to re-layout.

This function is only useful when implementing a new backend for Pango, something applications won't do. Backends should call this function if they have attached extra data to the context and such data is changed.

Since: 1.32.4

## getBaseDir

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> m Direction Returns: the base direction for the context.

Retrieves the base direction for the context. See contextSetBaseDir.

## getBaseGravity

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> m Gravity Returns: the base gravity for the context.

Retrieves the base gravity for the context. See contextSetBaseGravity.

Since: 1.16

## getFontDescription

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> m FontDescription Returns: a pointer to the context's default font description. This value must not be modified or freed.

Retrieve the default font description for the context.

## getFontMap

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> m FontMap Returns: the font map for the Context. This value is owned by Pango and should not be unreferenced.

Gets the FontMap used to look up fonts for this context.

Since: 1.6

## getGravity

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> m Gravity Returns: the resolved gravity for the context.

Retrieves the gravity for the context. This is similar to contextGetBaseGravity, except for when the base gravity is GravityAuto for which gravityGetForMatrix is used to return the gravity from the current context matrix.

Since: 1.16

## getGravityHint

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> m GravityHint Returns: the gravity hint for the context.

Retrieves the gravity hint for the context. See contextSetGravityHint for details.

Since: 1.16

## getLanguage

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> m Language Returns: the global language tag.

Retrieves the global language tag for the context.

## getMatrix

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> m (Maybe Matrix) Returns: the matrix, or Nothing if no matrix has been set (which is the same as the identity matrix). The returned matrix is owned by Pango and must not be modified or freed.

Gets the transformation matrix that will be applied when rendering with this context. See contextSetMatrix.

Since: 1.6

## getMetrics

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> Maybe FontDescription desc: a FontDescription structure. Nothing means that the font description from the context will be used. -> Maybe Language language: language tag used to determine which script to get the metrics for. Nothing means that the language tag from the context will be used. If no language tag is set on the context, metrics for the default language (as determined by languageGetDefault) will be returned. -> m FontMetrics Returns: a FontMetrics object. The caller must call fontMetricsUnref when finished using the object.

Get overall metric information for a particular font description. 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.

The FontDescription is interpreted in the same way as by itemize, and the family name may be a comma separated list of figures. If characters from multiple of these families would be used to render the string, then the returned fonts would be a composite of the metrics for the fonts loaded for the individual families.

## getSerial

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> m Word32 Returns: The current serial number of context.

Returns the current serial number of context. The serial number is initialized to an small number larger than zero when a new context is created and is increased whenever the context is changed using any of the setter functions, or the FontMap it uses to find fonts has changed. The serial may wrap, but will never have the value 0. Since it can wrap, never compare it with "less than", always use "not equals".

This can be used to automatically detect changes to a Context, and is only useful when implementing objects that need update when their Context changes, like Layout.

Since: 1.32.4

## listFamilies

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> m [FontFamily]

List all families for a context.

## loadFont

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> FontDescription desc: a FontDescription describing the font to load -> m (Maybe Font) Returns: the newly allocated Font that was loaded, or Nothing if no font matched.

Loads the font in one of the fontmaps in the context that is the closest match for desc.

## loadFontset

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> FontDescription desc: a FontDescription describing the fonts to load -> Language language: a Language the fonts will be used for -> m (Maybe Fontset) Returns: the newly allocated Fontset loaded, or Nothing if no font matched.

Load a set of fonts in the context that can be used to render a font matching desc.

## new

Arguments

 :: (HasCallStack, MonadIO m) => m Context Returns: the newly allocated Context, which should be freed with objectUnref.

Creates a new Context initialized to default values.

This function is not particularly useful as it should always be followed by a contextSetFontMap call, and the function fontMapCreateContext does these two steps together and hence users are recommended to use that.

If you are using Pango as part of a higher-level system, that system may have it's own way of create a Context. For instance, the GTK+ toolkit has, among others, gdk_pango_context_get_for_screen(), and gtk_widget_get_pango_context(). Use those instead.

## setBaseDir

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> Direction direction: the new base direction -> m ()

Sets the base direction for the context.

The base direction is used in applying the Unicode bidirectional algorithm; if the direction is DirectionLtr or DirectionRtl, then the value will be used as the paragraph direction in the Unicode bidirectional algorithm. A value of DirectionWeakLtr or DirectionWeakRtl is used only for paragraphs that do not contain any strong characters themselves.

## setBaseGravity

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> Gravity gravity: the new base gravity -> m ()

Sets the base gravity for the context.

The base gravity is used in laying vertical text out.

Since: 1.16

## setFontDescription

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> FontDescription desc: the new pango font description -> m ()

Set the default font description for the context

## setFontMap

Arguments

 :: (HasCallStack, MonadIO m, IsContext a, IsFontMap b) => a context: a Context -> b fontMap: the FontMap to set. -> m ()

Sets the font map to be searched when fonts are looked-up in this context. This is only for internal use by Pango backends, a Context obtained via one of the recommended methods should already have a suitable font map.

## setGravityHint

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> GravityHint hint: the new gravity hint -> m ()

Sets the gravity hint for the context.

The gravity hint is used in laying vertical text out, and is only relevant if gravity of the context as returned by contextGetGravity is set GravityEast or GravityWest.

Since: 1.16

## setLanguage

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> Language language: the new language tag. -> m ()

Sets the global language tag for the context. The default language for the locale of the running process can be found using languageGetDefault.

## setMatrix

Arguments

 :: (HasCallStack, MonadIO m, IsContext a) => a context: a Context -> Maybe Matrix matrix: a Matrix, or Nothing to unset any existing matrix. (No matrix set is the same as setting the identity matrix.) -> m ()

Sets the transformation matrix that will be applied when rendering with this context. Note that reported metrics are in the user space coordinates before the application of the matrix, not device-space coordinates after the application of the matrix. So, they don't scale with the matrix, though they may change slightly for different matrices, depending on how the text is fit to the pixel grid.

Since: 1.6