Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- Exported types
- Methods
- changed
- getBaseDir
- getBaseGravity
- getFontDescription
- getFontMap
- getGravity
- getGravityHint
- getLanguage
- getMatrix
- getMetrics
- getRoundGlyphPositions
- getSerial
- listFamilies
- loadFont
- loadFontset
- new
- setBaseDir
- setBaseGravity
- setFontDescription
- setFontMap
- setGravityHint
- setLanguage
- setMatrix
- setRoundGlyphPositions
A PangoContext
stores global information used to control the
itemization process.
The information stored by PangoContext
includes the fontmap used
to look up fonts, and default values such as the default language,
default gravity, or default font.
To obtain a PangoContext
, use fontMapCreateContext
.
Synopsis
- newtype Context = Context (ManagedPtr Context)
- class (GObject o, IsDescendantOf Context o) => IsContext o
- toContext :: (MonadIO m, IsContext o) => o -> m Context
- contextChanged :: (HasCallStack, MonadIO m, IsContext a) => a -> m ()
- contextGetBaseDir :: (HasCallStack, MonadIO m, IsContext a) => a -> m Direction
- contextGetBaseGravity :: (HasCallStack, MonadIO m, IsContext a) => a -> m Gravity
- contextGetFontDescription :: (HasCallStack, MonadIO m, IsContext a) => a -> m (Maybe FontDescription)
- contextGetFontMap :: (HasCallStack, MonadIO m, IsContext a) => a -> m (Maybe FontMap)
- contextGetGravity :: (HasCallStack, MonadIO m, IsContext a) => a -> m Gravity
- contextGetGravityHint :: (HasCallStack, MonadIO m, IsContext a) => a -> m GravityHint
- contextGetLanguage :: (HasCallStack, MonadIO m, IsContext a) => a -> m Language
- contextGetMatrix :: (HasCallStack, MonadIO m, IsContext a) => a -> m (Maybe Matrix)
- contextGetMetrics :: (HasCallStack, MonadIO m, IsContext a) => a -> Maybe FontDescription -> Maybe Language -> m FontMetrics
- contextGetRoundGlyphPositions :: (HasCallStack, MonadIO m, IsContext a) => a -> m Bool
- contextGetSerial :: (HasCallStack, MonadIO m, IsContext a) => a -> m Word32
- contextListFamilies :: (HasCallStack, MonadIO m, IsContext a) => a -> m [FontFamily]
- contextLoadFont :: (HasCallStack, MonadIO m, IsContext a) => a -> FontDescription -> m (Maybe Font)
- contextLoadFontset :: (HasCallStack, MonadIO m, IsContext a) => a -> FontDescription -> Language -> m (Maybe Fontset)
- contextNew :: (HasCallStack, MonadIO m) => m Context
- contextSetBaseDir :: (HasCallStack, MonadIO m, IsContext a) => a -> Direction -> m ()
- contextSetBaseGravity :: (HasCallStack, MonadIO m, IsContext a) => a -> Gravity -> m ()
- contextSetFontDescription :: (HasCallStack, MonadIO m, IsContext a) => a -> Maybe FontDescription -> m ()
- contextSetFontMap :: (HasCallStack, MonadIO m, IsContext a, IsFontMap b) => a -> Maybe b -> m ()
- contextSetGravityHint :: (HasCallStack, MonadIO m, IsContext a) => a -> GravityHint -> m ()
- contextSetLanguage :: (HasCallStack, MonadIO m, IsContext a) => a -> Maybe Language -> m ()
- contextSetMatrix :: (HasCallStack, MonadIO m, IsContext a) => a -> Maybe Matrix -> m ()
- contextSetRoundGlyphPositions :: (HasCallStack, MonadIO m, IsContext a) => a -> Bool -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Context Source # | |
GObject Context Source # | |
Defined in GI.Pango.Objects.Context | |
ManagedPtrNewtype Context Source # | |
Defined in GI.Pango.Objects.Context toManagedPtr :: Context -> ManagedPtr Context | |
TypedObject Context Source # | |
Defined in GI.Pango.Objects.Context | |
HasParentTypes Context Source # | |
Defined in GI.Pango.Objects.Context | |
IsGValue (Maybe Context) Source # | Convert |
Defined in GI.Pango.Objects.Context gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Context -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Context) | |
type ParentTypes Context Source # | |
Defined in GI.Pango.Objects.Context type ParentTypes Context = '[Object] |
class (GObject o, IsDescendantOf Context o) => IsContext o Source #
Instances
(GObject o, IsDescendantOf Context o) => IsContext o Source # | |
Defined in GI.Pango.Objects.Context |
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, changed, forceFloating, freezeNotify, getv, isFloating, listFamilies, loadFont, loadFontset, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getBaseDir, getBaseGravity, getData, getFontDescription, getFontMap, getGravity, getGravityHint, getLanguage, getMatrix, getMetrics, getProperty, getQdata, getRoundGlyphPositions, getSerial.
Setters
setBaseDir, setBaseGravity, setData, setDataFull, setFontDescription, setFontMap, setGravityHint, setLanguage, setMatrix, setProperty, setRoundGlyphPositions.
changed
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m () |
Forces a change in the context, which will cause any PangoLayout
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
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m Direction | Returns: the base direction for the context. |
Retrieves the base direction for the context.
See contextSetBaseDir
.
getBaseGravity
contextGetBaseGravity Source #
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m Gravity | Returns: the base gravity for the context. |
getFontDescription
contextGetFontDescription Source #
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m (Maybe 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
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m (Maybe FontMap) | Returns: the font map for the.
|
Gets the PangoFontMap
used to look up fonts for this context.
Since: 1.6
getGravity
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> 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 [funcpango
.Gravity.get_for_matrix] is used to return the
gravity from the current context matrix.
Since: 1.16
getGravityHint
contextGetGravityHint Source #
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m GravityHint | Returns: the gravity hint for the context. |
getLanguage
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m Language | Returns: the global language tag. |
Retrieves the global language tag for the context.
getMatrix
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m (Maybe Matrix) | Returns: the matrix, or |
Gets the transformation matrix that will be applied when rendering with this context.
See contextSetMatrix
.
Since: 1.6
getMetrics
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Maybe FontDescription |
|
-> Maybe Language |
|
-> m FontMetrics | Returns: a |
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 PangoFontDescription
is interpreted in the same way as by [funcitemize
],
and the family name may be a comma separated list of names. 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.
getRoundGlyphPositions
contextGetRoundGlyphPositions Source #
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m Bool |
Returns whether font rendering with this context should round glyph positions and widths.
Since: 1.44
getSerial
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m Word32 | Returns: The current serial number of |
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 PangoFontMap
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 PangoContext
,
and is only useful when implementing objects that need update when their
PangoContext
changes, like PangoLayout
.
Since: 1.32.4
listFamilies
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m [FontFamily] |
List all families for a context.
loadFont
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> FontDescription |
|
-> m (Maybe Font) | Returns: the newly allocated |
Loads the font in one of the fontmaps in the context
that is the closest match for desc
.
loadFontset
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> FontDescription |
|
-> Language |
|
-> m (Maybe Fontset) | Returns: the newly allocated
|
Load a set of fonts in the context that can be used to render
a font matching desc
.
new
:: (HasCallStack, MonadIO m) | |
=> m Context | Returns: the newly allocated |
Creates a new PangoContext
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 PangoContext
.
For instance, the GTK toolkit has, among others,
gtk_widget_get_pango_context()
. Use those instead.
setBaseDir
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> 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
contextSetBaseGravity Source #
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Gravity |
|
-> m () |
Sets the base gravity for the context.
The base gravity is used in laying vertical text out.
Since: 1.16
setFontDescription
contextSetFontDescription Source #
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Maybe FontDescription |
|
-> m () |
Set the default font description for the context
setFontMap
:: (HasCallStack, MonadIO m, IsContext a, IsFontMap b) | |
=> a |
|
-> Maybe b |
|
-> 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 PangoContext
obtained via one of the recommended methods should already have a
suitable font map.
setGravityHint
contextSetGravityHint Source #
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> GravityHint |
|
-> 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 to GravityEast
or GravityWest
.
Since: 1.16
setLanguage
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Maybe Language |
|
-> m () |
Sets the global language tag for the context.
The default language for the locale of the running process
can be found using [funcpango
.Language.get_default].
setMatrix
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Maybe 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
setRoundGlyphPositions
contextSetRoundGlyphPositions Source #
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether font rendering with this context should round glyph positions and widths to integral positions, in device units.
This is useful when the renderer can't handle subpixel positioning of glyphs.
The default value is to round glyph positions, to remain compatible with previous Pango behavior.
Since: 1.44