pango-0.13.12.0: Binding to the Pango text rendering engine.

Maintainer | gtk2hs-users@lists.sourceforge.net
Stability | provisional
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell98

Graphics.Rendering.Pango.Font

Contents

- Orphan instances

Description

Fonts. The selection of an appropriate font to render text becomes a substantial task in the presence of Unicode where a single font does not cover the whole range of possible characters. Pango provides several concepts to find appropriate fonts and to query information about them:

- `FontDescription`: Font descriptions provide a way to query and state requirements on fonts. This data structure has several fields describing different characteristics of a font. Each of these fields can be set of left unspecified.
- `FontMap` : A font map represents the set of fonts available for a particular rendering system. In particular this map defines the relation between font size and pixel size in terms of the output medium.
- `FontFamily` : A font family represents a set of fonts that have related faces, that is, their faces share a common design, but differ in slant, weight, width and other aspects.
- `FontFace`: A face is a specific font where all characteristics are fixed except for the size.
- `Font`: A font in the underlying rendering system.
- `FontMetrics`: Information about the font that will be used to render a specific `Context` or `PangoItem`.

Synopsis

- data FontDescription
- fontDescriptionNew :: IO FontDescription
- fontDescriptionCopy :: FontDescription -> IO FontDescription
- fontDescriptionSetFamily :: GlibString string => FontDescription -> string -> IO ()
- fontDescriptionGetFamily :: GlibString string => FontDescription -> IO (Maybe string)
- fontDescriptionSetStyle :: FontDescription -> FontStyle -> IO ()
- fontDescriptionGetStyle :: FontDescription -> IO (Maybe FontStyle)
- fontDescriptionSetVariant :: FontDescription -> Variant -> IO ()
- fontDescriptionGetVariant :: FontDescription -> IO (Maybe Variant)
- fontDescriptionSetWeight :: FontDescription -> Weight -> IO ()
- fontDescriptionGetWeight :: FontDescription -> IO (Maybe Weight)
- fontDescriptionSetStretch :: FontDescription -> Stretch -> IO ()
- fontDescriptionGetStretch :: FontDescription -> IO (Maybe Stretch)
- fontDescriptionSetSize :: FontDescription -> Double -> IO ()
- fontDescriptionGetSize :: FontDescription -> IO (Maybe Double)
- data FontMask
  - = PangoFontMaskFamily
  - | PangoFontMaskStyle
  - | PangoFontMaskVariant
  - | PangoFontMaskWeight
  - | PangoFontMaskWidth
  - | PangoFontMaskStretch
  - | PangoFontMaskSize
  - | PangoFontMaskGravity
  - | PangoFontMaskVariations
  - | PangoFontMaskFeatures
  - | PangoFontMaskColor
- fontDescriptionUnsetFields :: FontDescription -> [FontMask] -> IO ()
- fontDescriptionMerge :: FontDescription -> FontDescription -> Bool -> IO ()
- fontDescriptionBetterMatch :: FontDescription -> FontDescription -> FontDescription -> Bool
- fontDescriptionFromString :: GlibString string => string -> IO FontDescription
- fontDescriptionToString :: GlibString string => FontDescription -> IO string
- data FontMap
- class GObjectClass o => FontMapClass o
- pangoFontMapListFamilies :: FontMap -> IO [FontFamily]
- data FontFamily
- class GObjectClass o => FontFamilyClass o
- pangoFontFamilyIsMonospace :: FontFamily -> Bool
- pangoFontFamilyListFaces :: FontFamily -> IO [FontFace]
- data FontFace
- class GObjectClass o => FontFaceClass o
- pangoFontFaceListSizes :: FontFace -> IO (Maybe [Double])
- pangoFontFaceDescribe :: FontFace -> IO FontDescription
- data Font
- class GObjectClass o => FontClass o

# Documentation

data FontDescription Source #

A possibly partial description of font(s).

#### Instances

Instances details

Show FontDescription Source # |
Instance details Defined in Graphics.Rendering.Pango.BasicTypes Methods showsPrec :: Int -> FontDescription -> ShowS Source # show :: FontDescription -> String Source # showList :: [FontDescription] -> ShowS Source #

fontDescriptionNew :: IO FontDescription Source #

Create a new font description.

- All field are unset.

fontDescriptionCopy :: FontDescription -> IO FontDescription Source #

Make a deep copy of a font description.

fontDescriptionSetFamily :: GlibString string => FontDescription -> string -> IO () Source #

Set the font famliy.

- A font family is a name designating the design of the font (e.g. Sans or Times) without the variant.
- In some contexts a comma separated list of font families can be used.

fontDescriptionGetFamily :: GlibString string => FontDescription -> IO (Maybe string) Source #

Get the font family.

- `Nothing` is returned if the font family is not set.

fontDescriptionSetStyle :: FontDescription -> FontStyle -> IO () Source #

Set the style field.

- Most fonts will have either a `StyleItalic` or `StyleOblique` but rarely both.

fontDescriptionGetStyle :: FontDescription -> IO (Maybe FontStyle) Source #

Get the style field.

fontDescriptionSetVariant :: FontDescription -> Variant -> IO () Source #

Set the variant field.

fontDescriptionGetVariant :: FontDescription -> IO (Maybe Variant) Source #

Get the variant field.

fontDescriptionSetWeight :: FontDescription -> Weight -> IO () Source #

Set the weight field.

fontDescriptionGetWeight :: FontDescription -> IO (Maybe Weight) Source #

Get the weight field.

fontDescriptionSetStretch :: FontDescription -> Stretch -> IO () Source #

Set the stretch field.

fontDescriptionGetStretch :: FontDescription -> IO (Maybe Stretch) Source #

Get the stretch field.

fontDescriptionSetSize :: FontDescription -> Double -> IO () Source #

Set the size field.

- The given size is in points (pts). One point is 1/72 inch.

fontDescriptionGetSize :: FontDescription -> IO (Maybe Double) Source #

Get the size field.

data FontMask Source #

Flags denoting which fields in a font description are set.

Constructors

PangoFontMaskFamily |
PangoFontMaskStyle |
PangoFontMaskVariant |
PangoFontMaskWeight |
PangoFontMaskWidth |
PangoFontMaskStretch |
PangoFontMaskSize |
PangoFontMaskGravity |
PangoFontMaskVariations |
PangoFontMaskFeatures |
PangoFontMaskColor |

#### Instances

Instances details

Bounded FontMask Source # |
Instance details Defined in Graphics.Rendering.Pango.Description Methods minBound :: FontMask Source # maxBound :: FontMask Source #
Enum FontMask Source # |

Instance details

Defined in Graphics.Rendering.Pango.Description

Methods

succ :: FontMask -> FontMask Source #

pred :: FontMask -> FontMask Source #

toEnum :: Int -> FontMask Source #

fromEnum :: FontMask -> Int Source #

enumFrom :: FontMask -> [FontMask] Source #

enumFromThen :: FontMask -> FontMask -> [FontMask] Source #

enumFromTo :: FontMask -> FontMask -> [FontMask] Source #

enumFromThenTo :: FontMask -> FontMask -> FontMask -> [FontMask] Source #

Flags FontMask Source # |
Instance details Defined in Graphics.Rendering.Pango.Description

fontDescriptionUnsetFields :: FontDescription -> [FontMask] -> IO () Source #

Reset fields in a font description.

fontDescriptionMerge :: FontDescription -> FontDescription -> Bool -> IO () Source #

Merge two font descriptions.

- Copy fields from the second description to the first. If the boolean parameter is set, existing fields in the first description will be replaced.

fontDescriptionBetterMatch :: FontDescription -> FontDescription -> FontDescription -> Bool Source #

Determine which of two descriptions matches a given description better.

- Returns `True` if the last description is a better match to the first argument than the middle one.
- Approximate matching is done on weight and style. If the other attributes do not match, the function returns `False`.

fontDescriptionFromString :: GlibString string => string -> IO FontDescription Source #

Create a font description from a string.

- The given argument must have the form `[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]` where `FAMILY_LIST` is a comma separated list of font families optionally terminated by a comma, `STYLE_OPTIONS` is a whitespace separated list of words where each word describes one of style, variant, weight or stretch. `SIZE` is a decimal number giving the size of the font in points. If any of these fields is absent, the resulting `FontDescription` will have the corresponding fields unset.

fontDescriptionToString :: GlibString string => FontDescription -> IO string Source #

Convert a font description to a string.

- Creates a string representation of a font description. See `fontDescriptionFromString` for the format of the string.

data FontMap Source #

#### Instances

Instances details

Eq FontMap Source # |
Instance details Defined in Graphics.Rendering.Pango.Types Methods (==) :: FontMap -> FontMap -> Bool Source # (/=) :: FontMap -> FontMap -> Bool Source #
Ord FontMap Source # |
Instance details Defined in Graphics.Rendering.Pango.Types Methods compare :: FontMap -> FontMap -> Ordering Source # (<) :: FontMap -> FontMap -> Bool Source # (<=) :: FontMap -> FontMap -> Bool Source # (>) :: FontMap -> FontMap -> Bool Source # (>=) :: FontMap -> FontMap -> Bool Source # max :: FontMap -> FontMap -> FontMap Source # min :: FontMap -> FontMap -> FontMap Source #
GObjectClass FontMap Source # |
Instance details Defined in Graphics.Rendering.Pango.Types Methods toGObject :: FontMap -> GObject Source # unsafeCastGObject :: GObject -> FontMap Source #
FontMapClass FontMap Source # |
Instance details Defined in Graphics.Rendering.Pango.Types

class GObjectClass o => FontMapClass o Source #

#### Instances

Instances details

FontMapClass FontMap Source # |
Instance details Defined in Graphics.Rendering.Pango.Types

pangoFontMapListFamilies :: FontMap -> IO [FontFamily] Source #

Ask for the different font families that a particular back-end supports.

- The `FontMap` can be acquired by calling `cairoFontMapGetDefault`.

data FontFamily Source #

#### Instances

Instances details

Show FontFamily Source # |
Instance details Defined in Graphics.Rendering.Pango.Font Methods showsPrec :: Int -> FontFamily -> ShowS Source # show :: FontFamily -> String Source # showList :: [FontFamily] -> ShowS Source #
Eq FontFamily Source # |
Instance details Defined in Graphics.Rendering.Pango.Types Methods (==) :: FontFamily -> FontFamily -> Bool Source # (/=) :: FontFamily -> FontFamily -> Bool Source #
Ord FontFamily Source # |

Instance details

Defined in Graphics.Rendering.Pango.Types

Methods

compare :: FontFamily -> FontFamily -> Ordering Source #

(<) :: FontFamily -> FontFamily -> Bool Source #

(<=) :: FontFamily -> FontFamily -> Bool Source #

(>) :: FontFamily -> FontFamily -> Bool Source #

(>=) :: FontFamily -> FontFamily -> Bool Source #

max :: FontFamily -> FontFamily -> FontFamily Source #

min :: FontFamily -> FontFamily -> FontFamily Source #

GObjectClass FontFamily Source # |
Instance details Defined in Graphics.Rendering.Pango.Types Methods toGObject :: FontFamily -> GObject Source # unsafeCastGObject :: GObject -> FontFamily Source #
FontFamilyClass FontFamily Source # |
Instance details Defined in Graphics.Rendering.Pango.Types

class GObjectClass o => FontFamilyClass o Source #

#### Instances

Instances details

FontFamilyClass FontFamily Source # |
Instance details Defined in Graphics.Rendering.Pango.Types

pangoFontFamilyIsMonospace :: FontFamily -> Bool Source #

Ask if the given family contains monospace fonts.

- A monospace font is a font designed for text display where the characters form a regular grid. For Western languages this would mean that the advance width of all characters are the same, but this categorization also includes Asian fonts which include double-width characters: characters that occupy two grid cells.
- The best way to find out the grid-cell size is to query the members of the according `FontMetrics` structure.

pangoFontFamilyListFaces :: FontFamily -> IO [FontFace] Source #

Ask for the faces contained in a particular family.

- Asks for all font faces in the given family. The faces in a family share a common design, but differ in slant, weight, width and other aspects. For example, the font family Sans contains several fonts such as Helvetica and Arial.

data FontFace Source #

#### Instances

Instances details

Show FontFace Source # |
Instance details Defined in Graphics.Rendering.Pango.Font Methods showsPrec :: Int -> FontFace -> ShowS Source # show :: FontFace -> String Source # showList :: [FontFace] -> ShowS Source #
Eq FontFace Source # |
Instance details Defined in Graphics.Rendering.Pango.Types Methods (==) :: FontFace -> FontFace -> Bool Source # (/=) :: FontFace -> FontFace -> Bool Source #
Ord FontFace Source # |
Instance details Defined in Graphics.Rendering.Pango.Types Methods compare :: FontFace -> FontFace -> Ordering Source # (<) :: FontFace -> FontFace -> Bool Source # (<=) :: FontFace -> FontFace -> Bool Source # (>) :: FontFace -> FontFace -> Bool Source # (>=) :: FontFace -> FontFace -> Bool Source # max :: FontFace -> FontFace -> FontFace Source # min :: FontFace -> FontFace -> FontFace Source #
GObjectClass FontFace Source # |
Instance details Defined in Graphics.Rendering.Pango.Types Methods toGObject :: FontFace -> GObject Source # unsafeCastGObject :: GObject -> FontFace Source #
FontFaceClass FontFace Source # |
Instance details Defined in Graphics.Rendering.Pango.Types

class GObjectClass o => FontFaceClass o Source #

#### Instances

Instances details

FontFaceClass FontFace Source # |
Instance details Defined in Graphics.Rendering.Pango.Types

pangoFontFaceListSizes :: FontFace -> IO (Maybe [Double]) Source #

Ask for available sizes of this font face.

- List the available sizes for a font. This is only applicable to bitmap fonts since all other fonts can be scaled arbitrarily. For scalable fonts, this function returns `Nothing`. The sizes returned are in ascending order, their unit is points (1/72 inch).

pangoFontFaceDescribe :: FontFace -> IO FontDescription Source #

Ask for a description of this face.

- Returns the family, style, variant, weight and stretch of a `FontFace`. The size field of the resulting font description will be unset.

data Font Source #

#### Instances

Instances details

Eq Font Source # |
Instance details Defined in Graphics.Rendering.Pango.Types Methods (==) :: Font -> Font -> Bool Source # (/=) :: Font -> Font -> Bool Source #
Ord Font Source # |
Instance details Defined in Graphics.Rendering.Pango.Types Methods compare :: Font -> Font -> Ordering Source # (<) :: Font -> Font -> Bool Source # (<=) :: Font -> Font -> Bool Source # (>) :: Font -> Font -> Bool Source # (>=) :: Font -> Font -> Bool Source # max :: Font -> Font -> Font Source # min :: Font -> Font -> Font Source #
GObjectClass Font Source # |
Instance details Defined in Graphics.Rendering.Pango.Types Methods toGObject :: Font -> GObject Source # unsafeCastGObject :: GObject -> Font Source #
FontClass Font Source # |
Instance details Defined in Graphics.Rendering.Pango.Types

class GObjectClass o => FontClass o Source #

#### Instances

Instances details

FontClass Font Source # |
Instance details Defined in Graphics.Rendering.Pango.Types

# Orphan instances

Show FontFace Source # |
Instance details Methods showsPrec :: Int -> FontFace -> ShowS Source # show :: FontFace -> String Source # showList :: [FontFace] -> ShowS Source #
Show FontFamily Source # |
Instance details Methods showsPrec :: Int -> FontFamily -> ShowS Source # show :: FontFamily -> String Source # showList :: [FontFamily] -> ShowS Source #