gi-pango-1.0.23: Pango bindings

Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Pango.Structs.FontMetrics

Contents

- Exported types
- Methods
  - Overloaded methods
  - getApproximateCharWidth
  - getApproximateDigitWidth
  - getAscent
  - getDescent
  - getHeight
  - getStrikethroughPosition
  - getStrikethroughThickness
  - getUnderlinePosition
  - getUnderlineThickness
  - ref
  - unref

Description

A `FontMetrics` structure holds the overall metric information for a font (possibly restricted to a script). The fields of this structure are private to implementations of a font backend. See the documentation of the corresponding getters for documentation of their meaning.

Synopsis

- newtype FontMetrics = FontMetrics (ManagedPtr FontMetrics)
- newZeroFontMetrics :: MonadIO m => m FontMetrics
- fontMetricsGetApproximateCharWidth :: (HasCallStack, MonadIO m) => FontMetrics -> m Int32
- fontMetricsGetApproximateDigitWidth :: (HasCallStack, MonadIO m) => FontMetrics -> m Int32
- fontMetricsGetAscent :: (HasCallStack, MonadIO m) => FontMetrics -> m Int32
- fontMetricsGetDescent :: (HasCallStack, MonadIO m) => FontMetrics -> m Int32
- fontMetricsGetHeight :: (HasCallStack, MonadIO m) => FontMetrics -> m Int32
- fontMetricsGetStrikethroughPosition :: (HasCallStack, MonadIO m) => FontMetrics -> m Int32
- fontMetricsGetStrikethroughThickness :: (HasCallStack, MonadIO m) => FontMetrics -> m Int32
- fontMetricsGetUnderlinePosition :: (HasCallStack, MonadIO m) => FontMetrics -> m Int32
- fontMetricsGetUnderlineThickness :: (HasCallStack, MonadIO m) => FontMetrics -> m Int32
- fontMetricsRef :: (HasCallStack, MonadIO m) => FontMetrics -> m (Maybe FontMetrics)
- fontMetricsUnref :: (HasCallStack, MonadIO m) => FontMetrics -> m ()

# Exported types

newtype FontMetrics Source #

Memory-managed wrapper type.

Constructors

FontMetrics (ManagedPtr FontMetrics) |

#### Instances

Instances details

Eq FontMetrics Source # |
Instance details Defined in GI.Pango.Structs.FontMetrics Methods (==) :: FontMetrics -> FontMetrics -> Bool # (/=) :: FontMetrics -> FontMetrics -> Bool #
GBoxed FontMetrics Source # |
Instance details Defined in GI.Pango.Structs.FontMetrics
TypedObject FontMetrics Source # |
Instance details Defined in GI.Pango.Structs.FontMetrics Methods glibType :: IO GType Source #
ManagedPtrNewtype FontMetrics Source # |
Instance details Defined in GI.Pango.Structs.FontMetrics Methods toManagedPtr :: FontMetrics -> ManagedPtr FontMetrics Source #
IsGValue FontMetrics Source # | Convert `FontMetrics` to and from `GValue` with `toGValue` and `fromGValue`.
Instance details Defined in GI.Pango.Structs.FontMetrics Methods toGValue :: FontMetrics -> IO GValue Source # fromGValue :: GValue -> IO FontMetrics Source #
HasParentTypes FontMetrics Source # |
Instance details Defined in GI.Pango.Structs.FontMetrics
tag ~ 'AttrSet => Constructible FontMetrics tag Source # |
Instance details Defined in GI.Pango.Structs.FontMetrics Methods new :: MonadIO m => (ManagedPtr FontMetrics -> FontMetrics) -> [AttrOp FontMetrics tag] -> m FontMetrics Source #
type ParentTypes FontMetrics Source # |
Instance details Defined in GI.Pango.Structs.FontMetrics type ParentTypes FontMetrics = '[] :: [Type]

newZeroFontMetrics :: MonadIO m => m FontMetrics Source #

Construct a `FontMetrics` struct initialized to zero.

# Methods

## Overloaded methods

## getApproximateCharWidth

fontMetricsGetApproximateCharWidth Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontMetrics | `metrics`: a `FontMetrics` structure
-> m Int32 | Returns: the character width, in Pango units.

Gets the approximate character width for a font metrics structure. This is merely a representative value useful, for example, for determining the initial size for a window. Actual characters in text will be wider and narrower than this.

## getApproximateDigitWidth

fontMetricsGetApproximateDigitWidth Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontMetrics | `metrics`: a `FontMetrics` structure
-> m Int32 | Returns: the digit width, in Pango units.

Gets the approximate digit width for a font metrics structure. This is merely a representative value useful, for example, for determining the initial size for a window. Actual digits in text can be wider or narrower than this, though this value is generally somewhat more accurate than the result of `fontMetricsGetApproximateCharWidth` for digits.

## getAscent

fontMetricsGetAscent Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontMetrics | `metrics`: a `FontMetrics` structure
-> m Int32 | Returns: the ascent, in Pango units.

Gets the ascent from a font metrics structure. The ascent is the distance from the baseline to the logical top of a line of text. (The logical top may be above or below the top of the actual drawn ink. It is necessary to lay out the text to figure where the ink will be.)

## getDescent

fontMetricsGetDescent Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontMetrics | `metrics`: a `FontMetrics` structure
-> m Int32 | Returns: the descent, in Pango units.

Gets the descent from a font metrics structure. The descent is the distance from the baseline to the logical bottom of a line of text. (The logical bottom may be above or below the bottom of the actual drawn ink. It is necessary to lay out the text to figure where the ink will be.)

## getHeight

fontMetricsGetHeight Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontMetrics | `metrics`: a `FontMetrics` structure
-> m Int32 | Returns: the height, in Pango units

Gets the line height from a font metrics structure. The line height is the distance between successive baselines in wrapped text.

If the line height is not available, 0 is returned.

Since: 1.44

## getStrikethroughPosition

fontMetricsGetStrikethroughPosition Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontMetrics | `metrics`: a `FontMetrics` structure
-> m Int32 | Returns: the suggested strikethrough position, in Pango units.

Gets the suggested position to draw the strikethrough. The value returned is the distance <emphasis>above</emphasis> the baseline of the top of the strikethrough.

Since: 1.6

## getStrikethroughThickness

fontMetricsGetStrikethroughThickness Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontMetrics | `metrics`: a `FontMetrics` structure
-> m Int32 | Returns: the suggested strikethrough thickness, in Pango units.

Gets the suggested thickness to draw for the strikethrough.

Since: 1.6

## getUnderlinePosition

fontMetricsGetUnderlinePosition Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontMetrics | `metrics`: a `FontMetrics` structure
-> m Int32 | Returns: the suggested underline position, in Pango units.

Gets the suggested position to draw the underline. The value returned is the distance <emphasis>above</emphasis> the baseline of the top of the underline. Since most fonts have underline positions beneath the baseline, this value is typically negative.

Since: 1.6

## getUnderlineThickness

fontMetricsGetUnderlineThickness Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontMetrics | `metrics`: a `FontMetrics` structure
-> m Int32 | Returns: the suggested underline thickness, in Pango units.

Gets the suggested thickness to draw for the underline.

Since: 1.6

## ref

fontMetricsRef Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontMetrics | `metrics`: a `FontMetrics` structure, may be `Nothing`
-> m (Maybe FontMetrics) | Returns: `metrics`

Increase the reference count of a font metrics structure by one.

## unref

fontMetricsUnref Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> FontMetrics | `metrics`: a `FontMetrics` structure, may be `Nothing`
-> m () |

Decrease the reference count of a font metrics structure by one. If the result is zero, frees the structure and any associated memory.