Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
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
- newtype Font = Font (ManagedPtr Font)
- class GObject o => IsFont o
- toFont :: (MonadIO m, IsFont o) => o -> m Font
- noFont :: Maybe Font
- fontDescribe :: (HasCallStack, MonadIO m, IsFont a) => a -> m FontDescription
- fontDescribeWithAbsoluteSize :: (HasCallStack, MonadIO m, IsFont a) => a -> m FontDescription
- fontDescriptionsFree :: (HasCallStack, MonadIO m) => Maybe [FontDescription] -> m ()
- fontFindShaper :: (HasCallStack, MonadIO m, IsFont a) => a -> Language -> Word32 -> m EngineShape
- fontGetFontMap :: (HasCallStack, MonadIO m, IsFont a) => a -> m (Maybe FontMap)
- fontGetGlyphExtents :: (HasCallStack, MonadIO m, IsFont a) => a -> Word32 -> m (Rectangle, Rectangle)
- fontGetMetrics :: (HasCallStack, MonadIO m, IsFont a) => a -> Maybe Language -> m FontMetrics
Exported types
Memory-managed wrapper type.
Instances
GObject Font Source # | |
Defined in GI.Pango.Objects.Font gobjectType :: Font -> IO GType # | |
IsObject Font Source # | |
Defined in GI.Pango.Objects.Font | |
IsFont Font Source # | |
Defined in GI.Pango.Objects.Font |
class GObject o => IsFont o Source #
Instances
(GObject a, (UnknownAncestorError Font a :: Constraint)) => IsFont a Source # | |
Defined in GI.Pango.Objects.Font | |
IsFont Font Source # | |
Defined in GI.Pango.Objects.Font |
Methods
describe
:: (HasCallStack, MonadIO m, IsFont a) | |
=> a |
|
-> m FontDescription | Returns: a newly-allocated |
Returns a description of the font, with font size set in points.
Use fontDescribeWithAbsoluteSize
if you want the font
size in device units.
describeWithAbsoluteSize
fontDescribeWithAbsoluteSize Source #
:: (HasCallStack, MonadIO m, IsFont a) | |
=> a |
|
-> m FontDescription | Returns: a newly-allocated |
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
:: (HasCallStack, MonadIO m) | |
=> Maybe [FontDescription] |
|
-> m () |
Frees an array of font descriptions.
findShaper
:: (HasCallStack, MonadIO m, IsFont a) | |
=> a |
|
-> Language |
|
-> Word32 |
|
-> m EngineShape | Returns: the best matching shaper. |
Finds the best matching shaper for a font for a particular language tag and character point.
getFontMap
:: (HasCallStack, MonadIO m, IsFont a) | |
=> a | |
-> m (Maybe FontMap) | Returns: the |
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
:: (HasCallStack, MonadIO m, IsFont a) | |
=> a |
|
-> Word32 |
|
-> 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
:: (HasCallStack, MonadIO m, IsFont a) | |
=> a |
|
-> Maybe Language |
|
-> m FontMetrics | Returns: a |
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.