-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Binding to the Pango text rendering engine.
--   
--   This package provides a wrapper around the Pango C library that allows
--   high-quality rendering of Unicode text. It can be used either with
--   Cairo to output text in PDF, PS or other documents or with Gtk+ to
--   display text on-screen.
@package pango
@version 0.13.11.0

-- | Enumerations for describing font characteristics.
module Graphics.Rendering.Pango.Enums
type PangoUnit = Double
pangoScale :: Double

-- | Color
--   
--   
--   
- Specifies a color with three integer values for red, green and
--   blue. All values range from 0 (least intense) to 65535 (highest
--   intensity).
--   
data Color
Color :: Word16 -> Word16 -> Word16 -> Color

-- | Rectangle
--   
--   
--   
- Specifies x, y, width and height
--   
data Rectangle
Rectangle :: Int -> Int -> Int -> Int -> Rectangle

-- | Rectangles describing an area in Doubles.
--   
--   
--   
- Specifies x, y, width and height
--   
data PangoRectangle
PangoRectangle :: Double -> Double -> Double -> Double -> PangoRectangle

-- | The characteristic measurements of a font.
--   
--   
--   
- All values are measured in pixels.
--   
- In Pango versions before 1.6 only ascent, descent,
--   approximateCharWidth and approximateDigitWidth are
--   available.
--   
data FontMetrics
FontMetrics :: Double -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> FontMetrics

-- | 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.)
[ascent] :: FontMetrics -> Double

-- | 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.)
[descent] :: FontMetrics -> Double

-- | The approximate character width. 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.
[approximateCharWidth] :: FontMetrics -> Double

-- | The approximate digit width. This is merely a representative value
--   useful, for example, for determining the initial size for a window.
--   Actual digits in text can be wider and narrower than this, though this
--   value is generally somewhat more accurate than
--   approximateCharWidth.
[approximateDigitWidth] :: FontMetrics -> Double

-- | The suggested thickness to draw an underline.
[underlineThickness] :: FontMetrics -> Double

-- | The suggested position to draw the underline. The value returned is
--   the distance above the baseline of the top of the underline. Since
--   most fonts have underline positions beneath the baseline, this value
--   is typically negative.
[underlinePosition] :: FontMetrics -> Double

-- | The suggested thickness to draw for the strikethrough.
[strikethroughThickness] :: FontMetrics -> Double

-- | The suggested position to draw the strikethrough. The value returned
--   is the distance above the baseline of the top of the strikethrough.
[strikethroughPosition] :: FontMetrics -> Double

-- | Define attributes for FontSize.
data Size
SizePoint :: Double -> Size
SizeUnreadable :: Size
SizeTiny :: Size
SizeSmall :: Size
SizeMedium :: Size
SizeLarge :: Size
SizeHuge :: Size
SizeGiant :: Size
SizeSmaller :: Size
SizeLarger :: Size

-- | The style of a font.
--   
--   
--   
- StyleOblique is a slanted font like StyleItalic, but
--   in a roman style.
--   
data FontStyle
StyleNormal :: FontStyle
StyleOblique :: FontStyle
StyleItalic :: FontStyle

-- | Define attributes for Weight.
data Weight
WeightThin :: Weight
WeightUltralight :: Weight
WeightLight :: Weight
WeightSemilight :: Weight
WeightBook :: Weight
WeightNormal :: Weight
WeightMedium :: Weight
WeightSemibold :: Weight
WeightBold :: Weight
WeightUltrabold :: Weight
WeightHeavy :: Weight
WeightUltraheavy :: Weight

-- | The variant of a font.
--   
--   
--   
- The VariantSmallCaps is a version of a font where lower
--   case letters are shown as physically smaller upper case letters.
--   
data Variant
VariantNormal :: Variant
VariantSmallCaps :: Variant
VariantAllSmallCaps :: Variant
VariantPetiteCaps :: Variant
VariantAllPetiteCaps :: Variant
VariantUnicase :: Variant
VariantTitleCaps :: Variant

-- | Define how wide characters are.
data Stretch
StretchUltraCondensed :: Stretch
StretchExtraCondensed :: Stretch
StretchCondensed :: Stretch
StretchSemiCondensed :: Stretch
StretchNormal :: Stretch
StretchSemiExpanded :: Stretch
StretchExpanded :: Stretch
StretchExtraExpanded :: Stretch
StretchUltraExpanded :: Stretch

-- | Define attributes for Underline.
--   
--   
--   
- The squiggly underline for errors is only available in Gtk 2.4 and
--   higher.
--   
data Underline
UnderlineNone :: Underline
UnderlineSingle :: Underline
UnderlineDouble :: Underline
UnderlineLow :: Underline
UnderlineError :: Underline
UnderlineSingleLine :: Underline
UnderlineDoubleLine :: Underline
UnderlineErrorLine :: Underline

-- | The PangoDirection type represents a direction in the Unicode
--   bidirectional algorithm.
--   
--   
--   
- The "weak" values denote a left-to-right or right-to-left
--   direction only if there is no character with a strong direction in a
--   paragraph. An example is a sequence of special, graphical characters
--   which are neutral with respect to their rendering direction. A fresh
--   PangoContext is by default weakly left-to-right.
--   
- Not every value in this enumeration makes sense for every usage of
--   PangoDirection; for example, the return value of
--   unicharDirection and findBaseDir cannot be
--   PangoDirectionWeakLtr or PangoDirectionWeakRtl, since
--   every character is either neutral or has a strong direction; on the
--   other hand PangoDirectionNeutral doesn't make sense to pass to
--   log2visGetEmbeddingLevels.
--   
data PangoDirection
PangoDirectionLtr :: PangoDirection
PangoDirectionRtl :: PangoDirection
PangoDirectionWeakLtr :: PangoDirection
PangoDirectionWeakRtl :: PangoDirection
PangoDirectionNeutral :: PangoDirection

-- | Attributes for PangoItems.
--   
--   
--   
- A given attribute is applied from its start position
--   paStart up, but not including the end position,
--   paEnd.
--   
data PangoAttribute

-- | A hint as to what language this piece of text is written in.
AttrLanguage :: Int -> Int -> Language -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paLang] :: PangoAttribute -> Language

-- | The font family, e.g. sans serif.
AttrFamily :: Int -> Int -> DefaultGlibString -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paFamily] :: PangoAttribute -> DefaultGlibString

-- | The slant of the current font.
AttrStyle :: Int -> Int -> FontStyle -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paStyle] :: PangoAttribute -> FontStyle

-- | Weight of font, e.g. WeightBold.
AttrWeight :: Int -> Int -> Weight -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paWeight] :: PangoAttribute -> Weight

-- | VariantSmallCaps will display lower case letters as small upper
--   case letters (if the font supports this).
AttrVariant :: Int -> Int -> Variant -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paVariant] :: PangoAttribute -> Variant

-- | Stretch or condense the width of the letters.
AttrStretch :: Int -> Int -> Stretch -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paStretch] :: PangoAttribute -> Stretch

-- | Specify the size of the font in points.
AttrSize :: Int -> Int -> Double -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paSize] :: PangoAttribute -> Double

-- | Specify the size of the font in device units (pixels).
--   
--   
--   
- Available in Pango 1.8.0 and higher.
--   
AttrAbsSize :: Int -> Int -> Double -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paSize] :: PangoAttribute -> Double

-- | Specify several attributes of a font at once. Note that no deep copy
--   of the description is made when this attributes is passed to or
--   received from functions.
AttrFontDescription :: Int -> Int -> FontDescription -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paFontDescription] :: PangoAttribute -> FontDescription

-- | Specify the foreground color.
AttrForeground :: Int -> Int -> Color -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paColor] :: PangoAttribute -> Color

-- | Specify the background color.
AttrBackground :: Int -> Int -> Color -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paColor] :: PangoAttribute -> Color

-- | Specify the kind of underline, e.g. UnderlineSingle.
AttrUnderline :: Int -> Int -> Underline -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paUnderline] :: PangoAttribute -> Underline

-- | Specify the color of an underline.
--   
--   
--   
- Available in Pango 1.8.0 and higher.
--   
AttrUnderlineColor :: Int -> Int -> Color -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paColor] :: PangoAttribute -> Color

-- | Specify if this piece of text should have a line through it.
AttrStrikethrough :: Int -> Int -> Bool -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paStrikethrough] :: PangoAttribute -> Bool

-- | Specify the color of the strike through line.
--   
--   
--   
- Available in Pango 1.8.0 and higher.
--   
AttrStrikethroughColor :: Int -> Int -> Color -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paColor] :: PangoAttribute -> Color

-- | Displace the text vertically. Positive values move the text upwards.
AttrRise :: Int -> Int -> Double -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paRise] :: PangoAttribute -> Double

-- | Restrict the amount of what is drawn of the marked shapes.
--   
--   
--   
- Available in Pango 1.8.0 and higher.
--   
AttrShape :: Int -> Int -> PangoRectangle -> PangoRectangle -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paInk] :: PangoAttribute -> PangoRectangle
[paLogical] :: PangoAttribute -> PangoRectangle

-- | Scale the font up (values greater than one) or shrink the font.
AttrScale :: Int -> Int -> Double -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paScale] :: PangoAttribute -> Double

-- | Determine if a fall back font should be substituted if no matching
--   font is available.
AttrFallback :: Int -> Int -> Bool -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paFallback] :: PangoAttribute -> Bool

-- | Add extra space between graphemes of the text.
--   
--   
--   
- Available in Pango 1.6.0 and higher.
--   
AttrLetterSpacing :: Int -> Int -> Double -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paLetterSpacing] :: PangoAttribute -> Double

-- | Sets the gravity field of a font description. The gravity field
--   specifies how the glyphs should be rotated. If gravity is
--   GravityAuto, this actually unsets the gravity mask on the
--   font description.
--   
--   
--   
- This function is seldom useful to the user. Gravity should
--   normally be set on a PangoContext.
--   
- Available in Pango 1.16.0 and higher.
--   
AttrGravity :: Int -> Int -> PangoGravity -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paGravity] :: PangoAttribute -> PangoGravity

-- | Set the way horizontal scripts behave in a vertical context.
--   
--   
--   
- Available in Pango 1.16.0 and higher.
--   
AttrGravityHint :: Int -> Int -> PangoGravityHint -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paGravityHint] :: PangoAttribute -> PangoGravityHint

-- | The EllipsizeMode type describes what sort of (if any)
--   ellipsization should be applied to a line of text. In the
--   ellipsization process characters are removed from the text in order to
--   make it fit to a given width and replaced with an ellipsis.
data EllipsizeMode
EllipsizeNone :: EllipsizeMode
EllipsizeStart :: EllipsizeMode
EllipsizeMiddle :: EllipsizeMode
EllipsizeEnd :: EllipsizeMode

-- | The PangoGravity type represents the orientation of glyphs in a
--   segment of text. The value GravitySouth, for instance,
--   indicates that the text stands upright, i.e. that the base of the
--   letter is directed downwards.
--   
--   This is useful when rendering vertical text layouts. In those
--   situations, the layout is rotated using a non-identity
--   PangoMatrix, and then glyph orientation is controlled using
--   PangoGravity. Not every value in this enumeration makes sense
--   for every usage of Gravity; for example,
--   PangoGravityAuto only can be passed to
--   pangoContextSetBaseGravity and can only be returned by
--   pangoContextGetBaseGravity.
--   
--   
--   
- See also: PangoGravityHint
--   
- Gravity is resolved from the context matrix.
--   
- Since Pango 1.16
--   
data PangoGravity
PangoGravitySouth :: PangoGravity
PangoGravityEast :: PangoGravity
PangoGravityNorth :: PangoGravity
PangoGravityWest :: PangoGravity
PangoGravityAuto :: PangoGravity

-- | The PangoGravityHint defines how horizontal scripts should
--   behave in a vertical context.
--   
--   
--   
- PangoGravityHintNatural: scripts will take their natural
--   gravity based on the base gravity and the script. This is the
--   default.
--   
- PangoGravityHintStrong: always use the base gravity set,
--   regardless of the script.
--   
- PangoGravityHintLine: for scripts not in their natural
--   direction (eg. Latin in East gravity), choose per-script gravity such
--   that every script respects the line progression. This means, Latin and
--   Arabic will take opposite gravities and both flow top-to-bottom for
--   example.
--   
data PangoGravityHint
PangoGravityHintNatural :: PangoGravityHint
PangoGravityHintStrong :: PangoGravityHint
PangoGravityHintLine :: PangoGravityHint

-- | An RFC-3066 language designator to choose scripts.
data Language

-- | Specifying no particular language.
emptyLanguage :: Language

-- | Take a RFC-3066 format language tag as a string and convert it to a
--   Language type that can be efficiently passed around and
--   compared with other language tags.
--   
--   
--   
- This function first canonicalizes the string by converting it to
--   lowercase, mapping '_' to '-', and stripping all characters other than
--   letters and '-'.
--   
languageFromString :: GlibString string => string -> IO Language
instance GHC.Classes.Eq Graphics.Rendering.Pango.Enums.EllipsizeMode
instance GHC.Enum.Enum Graphics.Rendering.Pango.Enums.EllipsizeMode
instance GHC.Show.Show Graphics.Rendering.Pango.Enums.FontMetrics
instance GHC.Show.Show Graphics.Rendering.Pango.Enums.Size

-- | 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.
--   
module Graphics.Rendering.Pango.Font

-- | A possibly partial description of font(s).
data FontDescription

-- | Create a new font description.
--   
--   
--   
- All field are unset.
--   
fontDescriptionNew :: IO FontDescription

-- | Make a deep copy of a font description.
fontDescriptionCopy :: FontDescription -> IO FontDescription

-- | 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.
--   
fontDescriptionSetFamily :: GlibString string => FontDescription -> string -> IO ()

-- | Get the font family.
--   
--   
--   
- Nothing is returned if the font family is not set.
--   
fontDescriptionGetFamily :: GlibString string => FontDescription -> IO (Maybe string)

-- | Set the style field.
--   
--   
--   
- Most fonts will have either a StyleItalic or
--   StyleOblique but rarely both.
--   
fontDescriptionSetStyle :: FontDescription -> FontStyle -> IO ()

-- | Get the style field.
fontDescriptionGetStyle :: FontDescription -> IO (Maybe FontStyle)

-- | Set the variant field.
fontDescriptionSetVariant :: FontDescription -> Variant -> IO ()

-- | Get the variant field.
fontDescriptionGetVariant :: FontDescription -> IO (Maybe Variant)

-- | Set the weight field.
fontDescriptionSetWeight :: FontDescription -> Weight -> IO ()

-- | Get the weight field.
fontDescriptionGetWeight :: FontDescription -> IO (Maybe Weight)

-- | Set the stretch field.
fontDescriptionSetStretch :: FontDescription -> Stretch -> IO ()

-- | Get the stretch field.
fontDescriptionGetStretch :: FontDescription -> IO (Maybe Stretch)

-- | Set the size field.
--   
--   
--   
- The given size is in points (pts). One point is 1/72 inch.
--   
fontDescriptionSetSize :: FontDescription -> Double -> IO ()

-- | Get the size field.
fontDescriptionGetSize :: FontDescription -> IO (Maybe Double)

-- | Flags denoting which fields in a font description are set.
data FontMask
PangoFontMaskFamily :: FontMask
PangoFontMaskStyle :: FontMask
PangoFontMaskVariant :: FontMask
PangoFontMaskWeight :: FontMask
PangoFontMaskStretch :: FontMask
PangoFontMaskSize :: FontMask
PangoFontMaskGravity :: FontMask
PangoFontMaskVariations :: FontMask
PangoFontMaskFeatures :: FontMask

-- | Reset fields in a font description.
fontDescriptionUnsetFields :: FontDescription -> [FontMask] -> IO ()

-- | 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.
--   
fontDescriptionMerge :: FontDescription -> FontDescription -> Bool -> IO ()

-- | 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.
--   
fontDescriptionBetterMatch :: FontDescription -> FontDescription -> FontDescription -> Bool

-- | 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.
--   
fontDescriptionFromString :: GlibString string => string -> IO FontDescription

-- | Convert a font description to a string.
--   
--   
--   
- Creates a string representation of a font description. See
--   fontDescriptionFromString for the format of the string.
--   
fontDescriptionToString :: GlibString string => FontDescription -> IO string
data FontMap
class GObjectClass o => FontMapClass o

-- | Ask for the different font families that a particular back-end
--   supports.
--   
--   
--   
- The FontMap can be acquired by calling
--   cairoFontMapGetDefault.
--   
pangoFontMapListFamilies :: FontMap -> IO [FontFamily]
data FontFamily
class GObjectClass o => FontFamilyClass o

-- | 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.
--   
pangoFontFamilyIsMonospace :: FontFamily -> Bool

-- | 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.
--   
pangoFontFamilyListFaces :: FontFamily -> IO [FontFace]
data FontFace
class GObjectClass o => FontFaceClass o

-- | 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).
--   
pangoFontFaceListSizes :: FontFace -> IO (Maybe [Double])

-- | 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.
--   
pangoFontFaceDescribe :: FontFace -> IO FontDescription
data Font
class GObjectClass o => FontClass o
instance GHC.Show.Show Graphics.Rendering.Pango.Types.FontFamily
instance GHC.Show.Show Graphics.Rendering.Pango.Types.FontFace

-- | This module defines PangoContexts, an environment that provides
--   information on available fonts, internationalization and output
--   capabilities of the medium. Given such a context, text can be rendered
--   into strings of glyphs (see Rendering) or, at a more abstract
--   level, using layouts (see Layout).
--   
--   
--   
- A PangoContext is a prerequisite for all text rendering
--   functions. A context can be created from scratch or, more
--   conveniently, by using default settings that are already used in the
--   application. When text is rendered through Gdk, use
--   widgetCreatePangoContext, if you use the Cairo rendering
--   engine, a new context can be acquired using
--   cairoCreateContext.
--   
- The properties of a PangoContext can be changed which, in
--   turn, has an effect on how text is rendered. To reflect such a change
--   in the rendered text, call layoutContextChanged.
--   
module Graphics.Rendering.Pango.Context
data PangoContext
class GObjectClass o => PangoContextClass o

-- | Retrieve a list of all available font families.
--   
--   
--   
- A font family is the name of the font without further attributes
--   like slant, variant or size.
--   
contextListFamilies :: PangoContext -> IO [FontFamily]

-- | Query the metrics of the given font implied by the font description.
contextGetMetrics :: PangoContext -> FontDescription -> Language -> IO FontMetrics

-- | Set the default FontDescription of this context.
contextSetFontDescription :: PangoContext -> FontDescription -> IO ()

-- | Get the current FontDescription of this context.
contextGetFontDescription :: PangoContext -> IO FontDescription

-- | An RFC-3066 language designator to choose scripts.
data Language

-- | Specifying no particular language.
emptyLanguage :: Language

-- | Take a RFC-3066 format language tag as a string and convert it to a
--   Language type that can be efficiently passed around and
--   compared with other language tags.
--   
--   
--   
- This function first canonicalizes the string by converting it to
--   lowercase, mapping '_' to '-', and stripping all characters other than
--   letters and '-'.
--   
languageFromString :: GlibString string => string -> IO Language

-- | Set the default Language of this context.
contextSetLanguage :: PangoContext -> Language -> IO ()

-- | Get the current Language of this context.
contextGetLanguage :: PangoContext -> IO Language

-- | Set the default text direction of this context.
contextSetTextDir :: PangoContext -> PangoDirection -> IO ()

-- | Get the current text direction of this context.
contextGetTextDir :: PangoContext -> IO PangoDirection

-- | Set the text gravity of this context. If the given value is
--   PangoGravityAuto then the gravity is derived from the current
--   rotation matrix.
contextSetTextGravity :: PangoContext -> PangoGravity -> IO ()

-- | Get the current text gravity of this context.
contextGetTextGravity :: PangoContext -> IO PangoGravity

-- | Set the text gravity hint of this context.
contextSetTextGravityHint :: PangoContext -> PangoGravityHint -> IO ()

-- | Get the current text gravity of this context.
contextGetTextGravityHint :: PangoContext -> IO PangoGravityHint

-- | Gets the transformation matrix that will be applied when rendering
--   with this context.
--   
--   
--   
- Since Pango 1.6
--   
contextGetMatrix :: PangoContext -> IO Matrix

-- | Sets the transformation matrix that will be applied when rendering
--   with this context. Note that any metrics reported by other functions
--   are in 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 Pango 1.6
--   
contextSetMatrix :: PangoContext -> Matrix -> IO ()

-- | Functions to run the rendering pipeline.
--   
--   
--   
- This module provides elementary rendering functions. For a simpler
--   interface, consider using PangoLayouts.
--   
- The Pango rendering pipeline takes a string of Unicode characters,
--   divides them into sequences of letters that have the same
--   characteristics such as font, size, color, etc. Such a sequence is
--   called PangoItem. Each PangoItem is then converted into
--   one GlyphItem, that is an actual sequence of glyphs, where
--   several characters might be turned into legatures or clusters, e.g. an
--   "e" and an accent modifier are turned into a single glyph. These
--   GlyphItems can then be rendered onto the output device with
--   functions such as cairoShowGlyphString.
--   
module Graphics.Rendering.Pango.Rendering

-- | A sequence of characters that are rendered with the same settings.
--   
--   
--   
- A preprocessing stage done by itemize splits the input
--   text into several chunks such that each chunk can be rendered with the
--   same font, direction, slant, etc. Some attributes such as the color,
--   underline or strikethrough do not affect a break into several
--   PangoItems. See also GlyphItem.
--   
data PangoItem

-- | Turn a string into a sequence of glyphs.
--   
--   
--   
- Partitions the input string into segments with the same text
--   direction and shaping engine. The generated list of items will be in
--   logical order (the start offsets of the items are ascending).
--   
pangoItemize :: GlibString string => PangoContext -> string -> [PangoAttribute] -> IO [PangoItem]

-- | Retrieve the metrics of the font that was chosen to break the given
--   PangoItem.
pangoItemGetFontMetrics :: PangoItem -> IO FontMetrics

-- | Extract the font used for this PangoItem.
pangoItemGetFont :: PangoItem -> IO Font

-- | Extract the Language used for this PangoItem.
pangoItemGetLanguage :: PangoItem -> IO Language

-- | A sequence of glyphs for a chunk of a string.
--   
--   
--   
- A glyph item contains the graphical representation of a
--   PangoItem. Clusters (like e and an accent modifier) as
--   well as legatures (such as ffi turning into a single letter
--   that omits the dot over the i) are usually represented as a
--   single glyph.
--   
data GlyphItem

-- | Turn a PangoItem into a GlyphItem.
--   
--   
--   
- Turns a PangoItem, that is, sequence of characters with the
--   same attributes such as font, size and color, into a GlyphItem
--   which contains the graphical representation of these characters.
--   GlyphItems can be rendered directly (and several times) onto
--   screens.
--   
pangoShape :: PangoItem -> IO GlyphItem

-- | Ask for bounding rectangles of this glyph sequence.
--   
--   
--   
- Compute the ink and logical extents of a glyph string. The logical
--   size is used for positioning, the ink size is the smallest bounding
--   box that includes all character pixels. The ink size can be smaller or
--   larger than the logical size.
--   
glyphItemExtents :: GlyphItem -> IO (PangoRectangle, PangoRectangle)

-- | Ask for bounding rectangles for a sub-range of a glyph sequence.
--   
--   
--   
- The returned rectangles are relative to the given sub-range, that
--   is, the result of this function is the same as if
--   glyphItemExtents were called on the sub-string.
--   
glyphItemExtentsRange :: GlyphItem -> Int -> Int -> IO (PangoRectangle, PangoRectangle)

-- | Get the horizontal position of a character.
--   
--   
--   
- Clusters (e.g. "e" with an accent modifier) are divided up into
--   equal portions.
--   
glyphItemIndexToX :: GlyphItem -> Int -> Bool -> IO Double

-- | Get the character at the given horizontal position.
--   
--   
--   
- The position is clipped to the width of this line.
--   
- The function returns the position in the string that corresponds
--   to the given horizontal location. Furthermore, if the position lies on
--   the first half of the character, False is returned.
--   
glyphItemXToIndex :: GlyphItem -> Double -> IO (Int, Bool)

-- | Retrieve the width of every character in a string.
--   
--   
--   
- The boolean parameter determines if the returned array starts with
--   the leftmost glyph (False) or with the rightmost glyph
--   (True). If Nothing is passed in, the direction is
--   taken from the GlyphItem, i.e., the array starts with the
--   leftmost glyph for left-to-right text and with the rightmost glyph for
--   right-to-left text. When multiple characters compose a single glyph,
--   the width of this glyph is divided among the characters that compose
--   this cluster.
--   
glyphItemGetLogicalWidths :: GlyphItem -> Maybe Bool -> IO [Double]

-- | Split a GlyphItem at the given index.
--   
--   
--   
- The given GlyphItem is split at the given index. The index
--   must be at least one and not greater or equal to length, i.e. the item
--   must be split into two non-empty segments. The function throws an
--   ArrayException if the index is out of bounds.
--   
glyphItemSplit :: GlyphItem -> Int -> IO (GlyphItem, GlyphItem)

-- | This module defines some helper functions for generating texts with
--   embedded attributes. Note that there is no need to use these
--   functions. In particular, if you set markup in labels that are subject
--   to internationalization, it can be of advantage to write out the
--   markup instead of using the functions in this module.
--   
--   In order to display a string that may contain markup characters, use
--   escapeMarkup.
--   
--   When you write markup directly, you can make use of the following
--   convenience tags:
--   
--   
--   
- b Bold
--   
- big Makes font relatively larger
--   
- i Italic
--   
- s Strikethrough
--   
- sub Subscript
--   
- sup Superscript
--   
- small Makes font relatively smaller
--   
- tt Monospace font
--   
- u Underline
--   
module Graphics.Rendering.Pango.Markup

-- | These are all the attributes the markSpan function can express.
data SpanAttribute

-- | Choose a font by textual description.
--   
--   
--   
- Takes a string to completely describe the font, example:
--   FontDescr "Sans Italic 12"
--   
FontDescr :: String -> SpanAttribute

-- | Specify the family of font to use.
--   
--   
--   
- Example: FontFamily "Sans"
--   
FontFamily :: String -> SpanAttribute

-- | Change the size of the current font.
--   
--   
--   
- The constructor takes the size in points (pt) or a predefined
--   sizes. Setting the absolute size 12.5pt can be achieved by passing
--   FontSize (SizePoint 12.5) to markSpan. Next to
--   predefined absolute sizes such as SizeSmall the size can be
--   changed by asking for the next larger or smaller front with
--   SizeLarger and SizeSmaller, respectively.
--   
FontSize :: Size -> SpanAttribute

-- | Change the slant of the current font.
FontStyle :: FontStyle -> SpanAttribute

-- | Change the thickness of the current font.
--   
--   
--   
- The constructor takes one of the six predefined weights. Most
--   likely to be supported: WeightBold.
--   
FontWeight :: Weight -> SpanAttribute

-- | Choosing an alternative rendering for lower case letters.
--   
--   
--   
- The argument VariantSmallCaps will display lower case
--   letters as smaller upper case letters, if this option is
--   available.
--   
FontVariant :: Variant -> SpanAttribute

-- | Choose a different width.
--   
--   
--   
- Takes one of nine font widths, e.g. WidthExpanded.
--   
FontStretch :: Stretch -> SpanAttribute

-- | Foreground color.
--   
--   
--   
- This constructor and FontBackground take both a description
--   of the color to be used for rendering. The name is either a hex code
--   of the form "#RRGGBB" or an X11 color name like "dark olive
--   green".
--   
FontForeground :: String -> SpanAttribute

-- | Background color.
FontBackground :: String -> SpanAttribute

-- | Specify underlining of text.
FontUnderline :: Underline -> SpanAttribute

-- | Specify a vertical displacement.
--   
--   
--   
- Takes the vertical displacement in em (the width of the 'm'
--   character in the current font).
--   
FontRise :: Double -> SpanAttribute

-- | Give a hint about the language to be displayed.
--   
--   
--   
- This hint might help the system rendering a particular piece of
--   text with different fonts that are more suitable for the given
--   language.
--   
FontLang :: Language -> SpanAttribute

-- | Gravity of text, use for ratation.
FontGravity :: PangoGravity -> SpanAttribute

-- | Intensity of gravity.
FontGravityHint :: PangoGravityHint -> SpanAttribute

-- | Create the most generic span attribute.
markSpan :: [SpanAttribute] -> String -> String

-- | Parse the marked-up text (see Markup format) to create a
--   plain-text string and an attribute list.
--   
--   
--   
- The attribute list is a list of lists of attribute. Each list
--   describes the attributes for the same span.
--   
- If accelMarker is not '0' (a zero character),
--   the given character will mark the character following it as an
--   accelerator. For example, accelMarker might be an ampersand
--   or underscore. All characters marked as an accelerator will receive a
--   UnderlineLow attribute, and the first character so marked will
--   be returned as accelChar. If no accelerator character is
--   found, the accelMarker character itself is returned. Two
--   accelMarker characters following each other produce a single
--   literal accelMarker character.
--   
- If a parsing error occurs a GError is thrown.
--   
parseMarkup :: (GlibString markup, GlibString string) => markup -> Char -> IO ([[PangoAttribute]], Char, string)
instance GHC.Show.Show Graphics.Rendering.Pango.Markup.SpanAttribute

-- | Functions to run the rendering pipeline.
--   
--   
--   
- The PangoLayout object defined in this module contain a
--   rendered paragraph of text. This interface is the easiest way to
--   render text into a DrawWindow using Cairo.
--   
module Graphics.Rendering.Pango.Layout

-- | Rectangles describing an area in Doubles.
--   
--   
--   
- Specifies x, y, width and height
--   
data PangoRectangle
PangoRectangle :: Double -> Double -> Double -> Double -> PangoRectangle

-- | A rendered paragraph.
data PangoLayout

-- | Create an empty Layout.
layoutEmpty :: PangoContext -> IO PangoLayout

-- | Create a new layout.
layoutText :: GlibString string => PangoContext -> string -> IO PangoLayout

-- | Create a copy of the Layout.
layoutCopy :: PangoLayout -> IO PangoLayout

-- | Retrieves the PangoContext from this layout.
layoutGetContext :: PangoLayout -> IO PangoContext

-- | Signal a PangoContext change.
--   
--   
--   
- Forces recomputation of any state in the PangoLayout that
--   might depend on the layout's context. This function should be called
--   if you make changes to the context subsequent to creating the
--   layout.
--   
layoutContextChanged :: PangoLayout -> IO ()

-- | Set the string in the layout.
layoutSetText :: GlibString string => PangoLayout -> string -> IO ()

-- | Retrieve the string in the layout.
layoutGetText :: GlibString string => PangoLayout -> IO string

-- | Set the text of the layout, including attributes.
--   
--   The string may include Markup. To print markup characters
--   like '<', or '-', apply escapeMarkup to
--   the string first.
--   
--   The function returns the text that is actually shown.
layoutSetMarkup :: (GlibString markup, GlibString string) => PangoLayout -> markup -> IO string

-- | Escape markup characters.
--   
--   
--   
- Used to display characters that normally denote markup. Note that
--   this function is strict in that it forces all characters in the input
--   string as soon as a single output character is requested.
--   
escapeMarkup :: GlibString string => string -> string

-- | Set the string in the layout.
--   
--   
--   
- The string may include Markup. Furthermore, any
--   underscore character indicates that the next character will be marked
--   as accelerator (i.e. underlined). A literal underscore character can
--   be produced by placing it twice in the string.
--   
- The character which follows the underscore is returned so it can
--   be used to add the actual keyboard shortcut. The second element is the
--   string after parsing.
--   
layoutSetMarkupWithAccel :: (GlibString markup, GlibString string) => PangoLayout -> markup -> IO (Char, string)

-- | Set text attributes of the text in the layout.
--   
--   
--   
- This function replaces any text attributes that this layout
--   contained, even those that were set by using
--   layoutSetMarkup.
--   
layoutSetAttributes :: PangoLayout -> [PangoAttribute] -> IO ()

-- | Gets the list of attributes of the layout, if any.
--   
--   
--   
- The attribute list is a list of lists of attribute. Each list
--   describes the attributes for the same span.
--   
layoutGetAttributes :: PangoLayout -> IO [[PangoAttribute]]

-- | Set a specific font description for this layout.
--   
--   
--   
- Specifying Nothing will unset the current font
--   description, that is, the PangoLayout will use the font
--   description in the current PangoContext.
--   
layoutSetFontDescription :: PangoLayout -> Maybe FontDescription -> IO ()

-- | Ask for the specifically set font description of this layout.
--   
--   
--   
- Returns Nothing if this layout uses the font description
--   in the PangoContext it was created in.
--   
- Only available in Pango 1.8.0 or higher.
--   
layoutGetFontDescription :: PangoLayout -> IO (Maybe FontDescription)

-- | Set the width of this paragraph.
--   
--   
--   
- Sets the width to which the lines of the PangoLayout should
--   be wrapped.
--   
- Pass in Nothing to indicate that no wrapping is to be
--   performed.
--   
layoutSetWidth :: PangoLayout -> Maybe Double -> IO ()

-- | Gets the width of this paragraph.
--   
--   
--   
- Gets the width to which the lines of the PangoLayout should
--   be wrapped.
--   
- Returns is the current width, or Nothing to indicate that
--   no wrapping is performed.
--   
layoutGetWidth :: PangoLayout -> IO (Maybe Double)

-- | Enumerates how a line can be wrapped.
--   
--   
--   
- WrapWholeWords Breaks lines only between
--   words.
--   
--   
--   
--   
- This variant does not guarantee that the requested width is not
--   exceeded. A word that is longer than the paragraph width is not
--   split.
--   
--   
--   
--   
- WrapAnywhere Break lines anywhere.
--   
- WrapPartialWords Wrap within a word if it is the
--   only one on this line.
--   
--   
--   
--   
- This option acts like WrapWholeWords but will split a word
--   if it is the only one on this line and it exceeds the specified
--   width.
--   
data LayoutWrapMode
WrapWholeWords :: LayoutWrapMode
WrapAnywhere :: LayoutWrapMode
WrapPartialWords :: LayoutWrapMode
WrapNowhere :: LayoutWrapMode

-- | Set how this paragraph is wrapped.
--   
--   
--   
- Sets the wrap style; the wrap style only has an effect if a width
--   is set on the layout with layoutSetWidth. To turn off wrapping,
--   call layoutSetWidth with Nothing.
--   
layoutSetWrap :: PangoLayout -> LayoutWrapMode -> IO ()

-- | Get the wrap mode for the layout.
layoutGetWrap :: PangoLayout -> IO LayoutWrapMode

-- | The EllipsizeMode type describes what sort of (if any)
--   ellipsization should be applied to a line of text. In the
--   ellipsization process characters are removed from the text in order to
--   make it fit to a given width and replaced with an ellipsis.
data EllipsizeMode
EllipsizeNone :: EllipsizeMode
EllipsizeStart :: EllipsizeMode
EllipsizeMiddle :: EllipsizeMode
EllipsizeEnd :: EllipsizeMode

-- | Set how long lines should be abbreviated.
layoutSetEllipsize :: PangoLayout -> EllipsizeMode -> IO ()

-- | Get the ellipsize mode for this layout.
layoutGetEllipsize :: PangoLayout -> IO EllipsizeMode

-- | Set the indentation of this paragraph.
--   
--   
--   
- Sets the amount by which the first line should be indented. A
--   negative value will produce a hanging indent, that is, all subsequent
--   lines will be indented while the first line has full width.
--   
layoutSetIndent :: PangoLayout -> Double -> IO ()

-- | Gets the indentation of this paragraph.
--   
--   
--   
- Gets the amount by which the first line or the rest of the
--   paragraph is indented.
--   
layoutGetIndent :: PangoLayout -> IO Double

-- | Set the spacing between lines of this paragraph.
layoutSetSpacing :: PangoLayout -> Double -> IO ()

-- | Gets the spacing between the lines.
layoutGetSpacing :: PangoLayout -> IO Double

-- | Set if text should be stretched to fit width.
--   
--   
--   
- Sets whether or not each complete line should be stretched to fill
--   the entire width of the layout. This stretching is typically done by
--   adding whitespace, but for some scripts (such as Arabic), the
--   justification is done by extending the characters.
--   
- Note that as of Pango 1.4, this functionality is not yet
--   implemented.
--   
layoutSetJustify :: PangoLayout -> Bool -> IO ()

-- | Retrieve the justification flag.
--   
--   
--   
- See layoutSetJustify.
--   
layoutGetJustify :: PangoLayout -> IO Bool

-- | Set if the base text direction should be overridden.
--   
--   
--   
- Sets whether to calculate the bidirectional base direction for the
--   layout according to the contents of the layout; when this flag is on
--   (the default), then paragraphs in layout that begin with strong
--   right-to-left characters (Arabic and Hebrew principally), will have
--   right-to-left layout, paragraphs with letters from other scripts will
--   have left-to-right layout. Paragraphs with only neutral characters get
--   their direction from the surrounding paragraphs.
--   
- When False, the choice between left-to-right and
--   right-to-left layout is done by according to the base direction of the
--   layout's PangoContext. (See contextSetTextDir).
--   
- When the auto-computed direction or a paragraph differs from the
--   base direction of the context, then the interpretation of
--   AlignLeft and AlignRight are swapped.
--   
layoutSetAutoDir :: PangoLayout -> Bool -> IO ()

-- | Retrieve the auto direction flag.
--   
--   
--   
- See layoutSetAutoDir.
--   
layoutGetAutoDir :: PangoLayout -> IO Bool

-- | Enumerate to which side incomplete lines are flushed.
data LayoutAlignment
AlignLeft :: LayoutAlignment
AlignCenter :: LayoutAlignment
AlignRight :: LayoutAlignment

-- | Set how this paragraph is aligned.
--   
--   
--   
- Sets the alignment for the layout (how partial lines are
--   positioned within the horizontal space available.)
--   
layoutSetAlignment :: PangoLayout -> LayoutAlignment -> IO ()

-- | Get the alignment for the layout.
layoutGetAlignment :: PangoLayout -> IO LayoutAlignment

-- | Specify where the Tab stop appears relative to the text.
--   
--   
--   
- Only Tab stops that align text to the left are supported right
--   now.
--   
data TabAlign

-- | A Tab position.
type TabPosition = (Double, TabAlign)

-- | Set a list of Tab positions.
layoutSetTabs :: PangoLayout -> [TabPosition] -> IO ()

-- | Reset the original set of Tab positions.
--   
--   
--   
- Restore the default which is a Tab stop every eight
--   characters.
--   
layoutResetTabs :: PangoLayout -> IO ()

-- | Retrieve the list of current Tab positions.
--   
--   
--   
- If no Tab position where set, Nothing is returned. In
--   this case, Tab positions are implicit at every eight characters.
--   
layoutGetTabs :: PangoLayout -> IO (Maybe [TabPosition])

-- | Honor newlines or not.
--   
--   
--   
- If honor is True, do not treat newlines and
--   similar characters as paragraph separators; instead, keep all text in
--   a single paragraph, and display a glyph for paragraph separator
--   characters. Used when you want to allow editing of newlines on a
--   single text line.
--   
layoutSetSingleParagraphMode :: PangoLayout -> Bool -> IO ()

-- | Retrieve if newlines are honored.
--   
--   
--   
- See layoutSetSingleParagraphMode.
--   
layoutGetSingleParagraphMode :: PangoLayout -> IO Bool

-- | Converts a device unit to a character index.
--   
--   
--   
- Converts from x and y position within a layout
--   to the index of the closest character. If the y position is
--   not inside the layout, the closest position is chosen (the position
--   will be clamped inside the layout). If the x position is not
--   within the layout, then the start or the end of the line is chosen. If
--   either the x or y positions were not inside the
--   layout, then the function returns False; on an exact hit, it
--   returns True.
--   
- The function returns the flag for the exact hit and the index into
--   the string. The third value is zero if the character corresponds to
--   one grapheme. If the grapheme is the result of a cluster, this value
--   may be greater than one, indicating where in the grapheme the position
--   lies. Zero represents the trailing edge on the grapheme.
--   
layoutXYToIndex :: PangoLayout -> Double -> Double -> IO (Bool, Int, Int)

-- | Return the rectangle of the glyph at the given index.
--   
--   
--   
- Converts from an index within a PangoLayout to the onscreen
--   position corresponding to the grapheme at that index, which is
--   represented as rectangle. Note that, given a PangoRectangle x y
--   width height, x is always the leading edge of the
--   grapheme and x + width the trailing edge of the grapheme. If
--   the directionality of the grapheme is right-to-left, then
--   width will be negative.
--   
layoutIndexToPos :: PangoLayout -> Int -> IO PangoRectangle

-- | Return a cursor position.
--   
--   
--   
- Given an index within a layout, determines the positions that of
--   the strong and weak cursors if the insertion point is at that index.
--   The position of each cursor is stored as a zero-width rectangle. The
--   strong cursor location is the location where characters of the
--   directionality equal to the base direction of the layout are inserted.
--   The weak cursor location is the location where characters of the
--   directionality opposite to the base direction of the layout are
--   inserted. The first element of the tuple is the strong position, the
--   second the weak.
--   
layoutGetCursorPos :: PangoLayout -> Int -> IO (PangoRectangle, PangoRectangle)

-- | A new cursor position.
--   
--   See layoutMoveCursorVisually.
data CursorPos

-- | The cursor should move to the previous paragraph.
CursorPosPrevPara :: CursorPos

-- | The sum of the indices is the new cursor position.
CursorPos :: Int -> Int -> CursorPos

-- | The cursor should advance to the next paragraph.
CursorPosNextPara :: CursorPos

-- | Move a cursor visually.
--   
--   
--   
- Compute a new cursor position from a previous cursor position. A
--   value of True for the direction will move it to the right,
--   independent of the underlying direction. Hence the cursor position
--   might jump if left-to-right text is mixed with right-to-left
--   text.
--   
- The first flag should be True if this cursor is the
--   strong cursor. The strong cursor is the cursor of the base direction
--   of the current layout (see layoutSetAutoDir). The weak cursor
--   is that of the opposite direction.
--   
- The previous cursor position is given by idx. If this
--   text at this position is a cluster, the cursor will only move to the
--   end or beginning of the cluster as opposed to past the next character.
--   The return value is either CursorPosNextPara if the cursor
--   moved beyond this paragraph, it is CursorPosPrevPara if the
--   cursor moved in front of this paragraph and it is CursorPos
--   idx trail to denote the new cursor position
--   idx. Note that idx will always denote an insertion
--   point, that is, idx will never point into the middle of a
--   cluster. The trail value can contain a positive value if the
--   current cursor position is at the end of the current line. In this
--   case, idx points past the last character of this line while
--   trail contains the number of characters that are responsible
--   for the line break such as newlines. The actual cursor position is
--   always idx+trail where the visual cursor should be
--   shown.
--   
layoutMoveCursorVisually :: PangoLayout -> Bool -> Int -> Bool -> IO CursorPos

-- | Computes the logical and ink extents of the PangoLayout.
--   
--   Logical extents are usually what you want for positioning things. Note
--   that both extents may have non-zero x and y. You may want to use those
--   to offset where you render the layout. Not doing that is a very
--   typical bug that shows up as right-to-left layouts not being correctly
--   positioned in a layout with a set width.
--   
--   Layout coordinates begin at the top left corner of the layout.
layoutGetExtents :: PangoLayout -> IO (PangoRectangle, PangoRectangle)

-- | Compute the physical size of the layout.
--   
--   
--   
- Computes the ink and the logical size of the Layout in
--   device units, that is, pixels for a screen. Identical to
--   layoutGetExtents and converting the Doubles in the
--   PangoRectangle to integers.
--   
layoutGetPixelExtents :: PangoLayout -> IO (Rectangle, Rectangle)

-- | Ask for the number of lines in this layout.
layoutGetLineCount :: PangoLayout -> IO Int

-- | Extract a single lines of the layout.
--   
--   
--   
- The given index starts from 0. The function throws an
--   ArrayException if the index is out of bounds.
--   
- The lines of each layout are regenerated if any attribute changes.
--   Thus the returned list does not reflect the current state of lines
--   after a change has been made.
--   
layoutGetLine :: PangoLayout -> Int -> IO LayoutLine

-- | Extract the lines of the layout.
--   
--   
--   
- The lines of each layout are regenerated if any attribute changes.
--   Thus the returned list does not reflect the current state of lines
--   after a change has been made.
--   
layoutGetLines :: PangoLayout -> IO [LayoutLine]

-- | An iterator to examine a layout.
data LayoutIter

-- | Create an iterator to examine a layout.
layoutGetIter :: PangoLayout -> IO LayoutIter

-- | Move to the next GlyphItem.
--   
--   
--   
- Returns False if this was the last item in the
--   layout.
--   
layoutIterNextItem :: LayoutIter -> IO Bool

-- | Move to the next char.
--   
--   
--   
- Returns False if this was the last char in the
--   layout.
--   
layoutIterNextChar :: LayoutIter -> IO Bool

-- | Move to the next cluster.
--   
--   
--   
- Returns False if this was the last cluster in the
--   layout.
--   
layoutIterNextCluster :: LayoutIter -> IO Bool

-- | Move to the next line.
--   
--   
--   
- Returns False if this was the last line in the
--   layout.
--   
layoutIterNextLine :: LayoutIter -> IO Bool

-- | Check if the iterator is on the last line.
--   
--   
--   
- Returns True if the iterator is on the last line of this
--   paragraph.
--   
layoutIterAtLastLine :: LayoutIter -> IO Bool

-- | Get the character index.
--   
--   
--   
- Note that iterating forward by char moves in visual order, not
--   logical order, so indexes may not be sequential. Also, the index may
--   be equal to the length of the text in the layout.
--   
layoutIterGetIndex :: LayoutIter -> IO Int

-- | Query the vertical position within the layout.
--   
--   
--   
- Gets the y position of the current line's baseline (origin at top
--   left of the entire layout).
--   
layoutIterGetBaseline :: LayoutIter -> IO Double

-- | Retrieve the current GlyphItem under the iterator.
--   
--   
--   
- Each LayoutLine contains a list of GlyphItems. This
--   function returns the GlyphItem under the current iterator. If
--   the iterator is positioned past the last character of the paragraph,
--   the function returns Nothing.
--   
layoutIterGetItem :: LayoutIter -> IO (Maybe GlyphItem)

-- | Extract the line under the iterator.
layoutIterGetLine :: LayoutIter -> IO (Maybe LayoutLine)

-- | Retrieve a rectangle surrounding a character.
--   
--   
--   
- Get the extents of the current character (origin is the top left
--   of the entire layout). Only logical extents can sensibly be obtained
--   for characters; ink extents make sense only down to the level of
--   clusters.
--   
layoutIterGetCharExtents :: LayoutIter -> IO PangoRectangle

-- | Compute the physical size of the cluster.
--   
--   
--   
- Computes the ink and the logical size of the cluster pointed to by
--   LayoutIter.
--   
layoutIterGetClusterExtents :: LayoutIter -> IO (PangoRectangle, PangoRectangle)

-- | Compute the physical size of the run.
--   
--   
--   
- Computes the ink and the logical size of the run pointed to by
--   LayoutIter.
--   
layoutIterGetRunExtents :: LayoutIter -> IO (PangoRectangle, PangoRectangle)

-- | Retrieve vertical extent of this line.
--   
--   
--   
- Divides the vertical space in the PangoLayout being
--   iterated over between the lines in the layout, and returns the space
--   belonging to the current line. A line's range includes the line's
--   logical extents, plus half of the spacing above and below the line, if
--   layoutSetSpacing has been called to set layout spacing. The y
--   positions are in layout coordinates (origin at top left of the entire
--   layout).
--   
- The first element in the returned tuple is the start, the second
--   is the end of this line.
--   
layoutIterGetLineYRange :: LayoutIter -> IO (Double, Double)

-- | Compute the physical size of the line.
--   
--   
--   
- Computes the ink and the logical size of the line pointed to by
--   LayoutIter. See layoutGetExtents.
--   
- Extents are in layout coordinates (origin is the top-left corner
--   of the entire PangoLayout). Thus the extents returned by this
--   function will be the same width/height but not at the same x/y as the
--   extents returned from layoutLineGetExtents.
--   
layoutIterGetLineExtents :: LayoutIter -> IO (PangoRectangle, PangoRectangle)

-- | A single line in a PangoLayout.
data LayoutLine

-- | Compute the physical size of the line.
--   
--   
--   
- Computes the ink and the logical size of the LayoutLine.
--   See layoutGetExtents.
--   
layoutLineGetExtents :: LayoutLine -> IO (PangoRectangle, PangoRectangle)

-- | Compute the physical size of the line.
--   
--   
--   
- Computes the ink and the logical size of the LayoutLine.
--   See layoutGetExtents. The returned values are in device units,
--   that is, pixels for the screen and points for printers.
--   
layoutLineGetPixelExtents :: LayoutLine -> IO (Rectangle, Rectangle)

-- | Request the horizontal position of a character.
layoutLineIndexToX :: LayoutLine -> Int -> Bool -> IO Double

-- | Request the character index of a given horizontal position.
--   
--   
--   
- Converts from an x offset to the index of the corresponding
--   character within the text of the layout. If the x parameter
--   is outside the line, a triple (False, index, trailing) is
--   returned where index and trailing will point to the
--   very first or very last position in the line. This notion of first and
--   last position is based on the direction of the paragraph; for example,
--   if the direction is right-to-left, then an x position to the
--   right of the line results in 0 being returned for index and
--   trailing. An x position to the left of the line
--   results in index pointing to the (logical) last grapheme in
--   the line and trailing pointing to the number of characters in that
--   grapheme. The reverse is true for a left-to-right line. If the boolean
--   flag in the result is True then x was within the
--   layout line and trailing indicates where in a cluster the
--   x position lay. It is 0 for the trailing edge of the
--   cluster.
--   
layoutLineXToIndex :: LayoutLine -> Double -> IO (Bool, Int, Int)

-- | Retrieve bounding boxes for a given piece of text contained in this
--   LayoutLine.
--   
--   
--   
- The result is a list to accommodate for mixed left-to-right and
--   right-to-left text. Even if the text is not mixed, several ranges
--   might be returned that are adjacent. The ranges are always sorted from
--   left to right. The values are with respect to the left edge of the
--   entire layout, not with respect to the line (which might be indented
--   or not left aligned).
--   
layoutLineGetXRanges :: LayoutLine -> Int -> Int -> IO [(Double, Double)]
instance GHC.Enum.Enum Graphics.Rendering.Pango.Layout.LayoutWrapMode
instance GHC.Enum.Enum Graphics.Rendering.Pango.Layout.LayoutAlignment
instance GHC.Enum.Enum Graphics.Rendering.Pango.Layout.TabAlign

-- | Pango specific functions for redering with Cairo.
--   
--   Cairo is a graphics library that supports vector graphics and image
--   compositing that can be used with Pango. The functions in this module
--   provide ways of rendering text in Cairo using Pango.
module Graphics.Rendering.Pango.Cairo

-- | Retrieve the default FontMap that contains a list of available
--   fonts.
--   
--   
--   
- One purpose of creating an explicit FontMap is to set a
--   different scaling factor between font sizes (in points, pt) and Cairo
--   units (in pixels). The default is 96dpi (dots per inch) which
--   corresponds to an average screen as output medium. A 10pt font will
--   therefore scale to 10pt * (1/72 pt/inch) * (96 pixel/inch) = 13.3
--   pixel.
--   
cairoFontMapGetDefault :: IO FontMap

-- | Set the scaling factor between font size and Cairo units.
--   
--   
--   
- Value is in dots per inch (dpi). See
--   cairoFontMapGetDefault.
--   
cairoFontMapSetResolution :: FontMap -> Double -> IO ()

-- | Ask for the scaling factor between font size and Cairo units.
--   
--   
--   
- Value is in dots per inch (dpi). See
--   cairoFontMapGetDefault.
--   
cairoFontMapGetResolution :: FontMap -> IO Double

-- | Create a PangoContext.
--   
--   
--   
- If no FontMap is specified, it uses the default
--   FontMap that has a scaling factor of 96 dpi. See
--   cairoFontMapGetDefault.
--   
cairoCreateContext :: Maybe FontMap -> IO PangoContext

-- | Set the scaling factor of the PangoContext.
--   
--   
--   
- Supplying zero or a negative value will result in the resolution
--   value of the underlying FontMap to be used. See also
--   cairoFontMapGetDefault.
--   
cairoContextSetResolution :: PangoContext -> Double -> IO ()

-- | Ask for the scaling factor of the PangoContext.
--   
--   
--   
- A negative value will be returned if no resolution has been set.
--   See cairoContextSetResolution.
--   
cairoContextGetResolution :: PangoContext -> IO Double

-- | Set Cairo font options.
--   
--   
--   
- Apply the given font options to the context. Values set through
--   this functions override those that are set by
--   updateContext.
--   
cairoContextSetFontOptions :: PangoContext -> FontOptions -> IO ()

-- | Retrieve Cairo font options.
cairoContextGetFontOptions :: PangoContext -> IO FontOptions

-- | Sets the specified Color as the source color of the
--   Render context.
setSourceColor :: Color -> Render ()

-- | Update a PangoContext with respect to changes in a
--   Render environment.
--   
--   
--   
- The PangoContext must have been created with
--   cairoCreateContext. Any PangoLayouts that have been
--   previously created with this context have to be update using
--   layoutContextChanged.
--   
updateContext :: PangoContext -> Render ()

-- | Create a PangoLayout within a Render context.
--   
--   
--   
- This is a convenience function that creates a new
--   PangoContext within this Render context and creates a
--   new PangoLayout. If the transformation or target surface of the
--   Render context change, updateLayout has to be called on
--   this layout.
--   
createLayout :: GlibString string => string -> Render PangoLayout

-- | Propagate changed to the Render context to a
--   PangoLayout.
--   
--   
--   
- This is a convenience function that calls updateContext on
--   the (private) PangoContext of the given layout to propagate
--   changes from the Render context to the PangoContext and
--   then calls layoutContextChanged on the layout. This function is
--   necessary for createLayout since a private PangoContext
--   is created that is not visible to the user.
--   
updateLayout :: PangoLayout -> Render ()

-- | Draw a glyph string.
--   
--   
--   
- The origin of the glyphs (the left edge of the baseline) will be
--   drawn at the current point of the cairo context.
--   
showGlyphString :: GlyphItem -> Render ()

-- | Draw a LayoutLine.
--   
--   
--   
- The origin of the glyphs (the left edge of the baseline) will be
--   drawn at the current point of the cairo context.
--   
showLayoutLine :: LayoutLine -> Render ()

-- | Draw a PangoLayout.
--   
--   
--   
- The top-left corner of the PangoLayout will be drawn at the
--   current point of the cairo context.
--   
showLayout :: PangoLayout -> Render ()

-- | Add the extent of a glyph string to the current path.
--   
--   
--   
- The origin of the glyphs (the left edge of the line) will be at
--   the current point of the cairo context.
--   
glyphStringPath :: GlyphItem -> Render ()

-- | Add the extent of a layout line to the current path.
--   
--   
--   
- The origin of the glyphs (the left edge of the line) will be at
--   the current point of the cairo context.
--   
layoutLinePath :: LayoutLine -> Render ()

-- | Add the layout to the current path.
--   
--   
--   
- Adds the top-left corner of the text to the current path.
--   Afterwards, the path position is at the bottom-right corner of the
--   PangoLayout.
--   
layoutPath :: PangoLayout -> Render ()

-- | Pango is a library for laying out and rendering of text, with an
--   emphasis on internationalization. Pango can be used anywhere that text
--   layout is needed, though most of the work on Pango so far has been
--   done in the context of the GTK+ widget toolkit. Pango forms the core
--   of text and font handling for GTK+-2.x.
--   
--   Pango is designed to be modular; the core Pango layout engine can be
--   used with different font backends. There are three basic backends:
--   
--   
--   
- Client side fonts using the FreeType and fontconfig
--   libraries.
--   
- Native fonts on Microsoft Windows using Uniscribe for complex-text
--   handling.
--   
- Native fonts on MacOS X using ATSUI for complex-text
--   handling.
--   
--   
--   The integration of Pango with Cairo <https: high quality text
--   handling and graphics rendering.
--   
--   Dynamically loaded modules then handle text layout for particular
--   combinations of script and font backend. Pango ships with a wide
--   selection of modules, including modules for Hebrew, Arabic, Hangul,
--   Thai, and a number of Indic scripts. Virtually all of the world's
--   major scripts are supported.
--   
--   As well as the low level layout rendering routines, Pango includes
--   PangoLayout, a high level driver for laying out entire blocks
--   of text, and routines to assist in editing internationalized text.
--   
--   Pango depends on 2.x series of the GLib library.
--   
--   This module only re-exports the parts of the Pango library that are
--   relevant for text rendering (as opposed to integration with other
--   libraries).
module Graphics.Rendering.Pango

-- | A rendered paragraph.
data PangoLayout

-- | Enumerates how a line can be wrapped.
--   
--   
--   
- WrapWholeWords Breaks lines only between
--   words.
--   
--   
--   
--   
- This variant does not guarantee that the requested width is not
--   exceeded. A word that is longer than the paragraph width is not
--   split.
--   
--   
--   
--   
- WrapAnywhere Break lines anywhere.
--   
- WrapPartialWords Wrap within a word if it is the
--   only one on this line.
--   
--   
--   
--   
- This option acts like WrapWholeWords but will split a word
--   if it is the only one on this line and it exceeds the specified
--   width.
--   
data LayoutWrapMode
WrapWholeWords :: LayoutWrapMode
WrapAnywhere :: LayoutWrapMode
WrapPartialWords :: LayoutWrapMode
WrapNowhere :: LayoutWrapMode

-- | Enumerate to which side incomplete lines are flushed.
data LayoutAlignment
AlignLeft :: LayoutAlignment
AlignCenter :: LayoutAlignment
AlignRight :: LayoutAlignment

-- | Specify where the Tab stop appears relative to the text.
--   
--   
--   
- Only Tab stops that align text to the left are supported right
--   now.
--   
data TabAlign

-- | A Tab position.
type TabPosition = (Double, TabAlign)

-- | A new cursor position.
--   
--   See layoutMoveCursorVisually.
data CursorPos

-- | The cursor should move to the previous paragraph.
CursorPosPrevPara :: CursorPos

-- | The sum of the indices is the new cursor position.
CursorPos :: Int -> Int -> CursorPos

-- | The cursor should advance to the next paragraph.
CursorPosNextPara :: CursorPos

-- | An iterator to examine a layout.
data LayoutIter

-- | A single line in a PangoLayout.
data LayoutLine

-- | Create an empty Layout.
layoutEmpty :: PangoContext -> IO PangoLayout

-- | Create a new layout.
layoutText :: GlibString string => PangoContext -> string -> IO PangoLayout

-- | Create a copy of the Layout.
layoutCopy :: PangoLayout -> IO PangoLayout

-- | Retrieves the PangoContext from this layout.
layoutGetContext :: PangoLayout -> IO PangoContext

-- | Signal a PangoContext change.
--   
--   
--   
- Forces recomputation of any state in the PangoLayout that
--   might depend on the layout's context. This function should be called
--   if you make changes to the context subsequent to creating the
--   layout.
--   
layoutContextChanged :: PangoLayout -> IO ()

-- | Set the string in the layout.
layoutSetText :: GlibString string => PangoLayout -> string -> IO ()

-- | Retrieve the string in the layout.
layoutGetText :: GlibString string => PangoLayout -> IO string

-- | Set the text of the layout, including attributes.
--   
--   The string may include Markup. To print markup characters
--   like '<', or '-', apply escapeMarkup to
--   the string first.
--   
--   The function returns the text that is actually shown.
layoutSetMarkup :: (GlibString markup, GlibString string) => PangoLayout -> markup -> IO string

-- | Escape markup characters.
--   
--   
--   
- Used to display characters that normally denote markup. Note that
--   this function is strict in that it forces all characters in the input
--   string as soon as a single output character is requested.
--   
escapeMarkup :: GlibString string => string -> string

-- | Set the string in the layout.
--   
--   
--   
- The string may include Markup. Furthermore, any
--   underscore character indicates that the next character will be marked
--   as accelerator (i.e. underlined). A literal underscore character can
--   be produced by placing it twice in the string.
--   
- The character which follows the underscore is returned so it can
--   be used to add the actual keyboard shortcut. The second element is the
--   string after parsing.
--   
layoutSetMarkupWithAccel :: (GlibString markup, GlibString string) => PangoLayout -> markup -> IO (Char, string)

-- | Set text attributes of the text in the layout.
--   
--   
--   
- This function replaces any text attributes that this layout
--   contained, even those that were set by using
--   layoutSetMarkup.
--   
layoutSetAttributes :: PangoLayout -> [PangoAttribute] -> IO ()

-- | Gets the list of attributes of the layout, if any.
--   
--   
--   
- The attribute list is a list of lists of attribute. Each list
--   describes the attributes for the same span.
--   
layoutGetAttributes :: PangoLayout -> IO [[PangoAttribute]]

-- | Set a specific font description for this layout.
--   
--   
--   
- Specifying Nothing will unset the current font
--   description, that is, the PangoLayout will use the font
--   description in the current PangoContext.
--   
layoutSetFontDescription :: PangoLayout -> Maybe FontDescription -> IO ()

-- | Ask for the specifically set font description of this layout.
--   
--   
--   
- Returns Nothing if this layout uses the font description
--   in the PangoContext it was created in.
--   
- Only available in Pango 1.8.0 or higher.
--   
layoutGetFontDescription :: PangoLayout -> IO (Maybe FontDescription)

-- | Set the width of this paragraph.
--   
--   
--   
- Sets the width to which the lines of the PangoLayout should
--   be wrapped.
--   
- Pass in Nothing to indicate that no wrapping is to be
--   performed.
--   
layoutSetWidth :: PangoLayout -> Maybe Double -> IO ()

-- | Gets the width of this paragraph.
--   
--   
--   
- Gets the width to which the lines of the PangoLayout should
--   be wrapped.
--   
- Returns is the current width, or Nothing to indicate that
--   no wrapping is performed.
--   
layoutGetWidth :: PangoLayout -> IO (Maybe Double)

-- | Set how this paragraph is wrapped.
--   
--   
--   
- Sets the wrap style; the wrap style only has an effect if a width
--   is set on the layout with layoutSetWidth. To turn off wrapping,
--   call layoutSetWidth with Nothing.
--   
layoutSetWrap :: PangoLayout -> LayoutWrapMode -> IO ()

-- | Get the wrap mode for the layout.
layoutGetWrap :: PangoLayout -> IO LayoutWrapMode

-- | Set how long lines should be abbreviated.
layoutSetEllipsize :: PangoLayout -> EllipsizeMode -> IO ()

-- | Get the ellipsize mode for this layout.
layoutGetEllipsize :: PangoLayout -> IO EllipsizeMode

-- | Set the indentation of this paragraph.
--   
--   
--   
- Sets the amount by which the first line should be indented. A
--   negative value will produce a hanging indent, that is, all subsequent
--   lines will be indented while the first line has full width.
--   
layoutSetIndent :: PangoLayout -> Double -> IO ()

-- | Gets the indentation of this paragraph.
--   
--   
--   
- Gets the amount by which the first line or the rest of the
--   paragraph is indented.
--   
layoutGetIndent :: PangoLayout -> IO Double

-- | Set the spacing between lines of this paragraph.
layoutSetSpacing :: PangoLayout -> Double -> IO ()

-- | Gets the spacing between the lines.
layoutGetSpacing :: PangoLayout -> IO Double

-- | Set if text should be stretched to fit width.
--   
--   
--   
- Sets whether or not each complete line should be stretched to fill
--   the entire width of the layout. This stretching is typically done by
--   adding whitespace, but for some scripts (such as Arabic), the
--   justification is done by extending the characters.
--   
- Note that as of Pango 1.4, this functionality is not yet
--   implemented.
--   
layoutSetJustify :: PangoLayout -> Bool -> IO ()

-- | Retrieve the justification flag.
--   
--   
--   
- See layoutSetJustify.
--   
layoutGetJustify :: PangoLayout -> IO Bool

-- | Set if the base text direction should be overridden.
--   
--   
--   
- Sets whether to calculate the bidirectional base direction for the
--   layout according to the contents of the layout; when this flag is on
--   (the default), then paragraphs in layout that begin with strong
--   right-to-left characters (Arabic and Hebrew principally), will have
--   right-to-left layout, paragraphs with letters from other scripts will
--   have left-to-right layout. Paragraphs with only neutral characters get
--   their direction from the surrounding paragraphs.
--   
- When False, the choice between left-to-right and
--   right-to-left layout is done by according to the base direction of the
--   layout's PangoContext. (See contextSetTextDir).
--   
- When the auto-computed direction or a paragraph differs from the
--   base direction of the context, then the interpretation of
--   AlignLeft and AlignRight are swapped.
--   
layoutSetAutoDir :: PangoLayout -> Bool -> IO ()

-- | Retrieve the auto direction flag.
--   
--   
--   
- See layoutSetAutoDir.
--   
layoutGetAutoDir :: PangoLayout -> IO Bool

-- | Set how this paragraph is aligned.
--   
--   
--   
- Sets the alignment for the layout (how partial lines are
--   positioned within the horizontal space available.)
--   
layoutSetAlignment :: PangoLayout -> LayoutAlignment -> IO ()

-- | Get the alignment for the layout.
layoutGetAlignment :: PangoLayout -> IO LayoutAlignment

-- | Set a list of Tab positions.
layoutSetTabs :: PangoLayout -> [TabPosition] -> IO ()

-- | Reset the original set of Tab positions.
--   
--   
--   
- Restore the default which is a Tab stop every eight
--   characters.
--   
layoutResetTabs :: PangoLayout -> IO ()

-- | Retrieve the list of current Tab positions.
--   
--   
--   
- If no Tab position where set, Nothing is returned. In
--   this case, Tab positions are implicit at every eight characters.
--   
layoutGetTabs :: PangoLayout -> IO (Maybe [TabPosition])

-- | Honor newlines or not.
--   
--   
--   
- If honor is True, do not treat newlines and
--   similar characters as paragraph separators; instead, keep all text in
--   a single paragraph, and display a glyph for paragraph separator
--   characters. Used when you want to allow editing of newlines on a
--   single text line.
--   
layoutSetSingleParagraphMode :: PangoLayout -> Bool -> IO ()

-- | Retrieve if newlines are honored.
--   
--   
--   
- See layoutSetSingleParagraphMode.
--   
layoutGetSingleParagraphMode :: PangoLayout -> IO Bool

-- | Converts a device unit to a character index.
--   
--   
--   
- Converts from x and y position within a layout
--   to the index of the closest character. If the y position is
--   not inside the layout, the closest position is chosen (the position
--   will be clamped inside the layout). If the x position is not
--   within the layout, then the start or the end of the line is chosen. If
--   either the x or y positions were not inside the
--   layout, then the function returns False; on an exact hit, it
--   returns True.
--   
- The function returns the flag for the exact hit and the index into
--   the string. The third value is zero if the character corresponds to
--   one grapheme. If the grapheme is the result of a cluster, this value
--   may be greater than one, indicating where in the grapheme the position
--   lies. Zero represents the trailing edge on the grapheme.
--   
layoutXYToIndex :: PangoLayout -> Double -> Double -> IO (Bool, Int, Int)

-- | Return the rectangle of the glyph at the given index.
--   
--   
--   
- Converts from an index within a PangoLayout to the onscreen
--   position corresponding to the grapheme at that index, which is
--   represented as rectangle. Note that, given a PangoRectangle x y
--   width height, x is always the leading edge of the
--   grapheme and x + width the trailing edge of the grapheme. If
--   the directionality of the grapheme is right-to-left, then
--   width will be negative.
--   
layoutIndexToPos :: PangoLayout -> Int -> IO PangoRectangle

-- | Return a cursor position.
--   
--   
--   
- Given an index within a layout, determines the positions that of
--   the strong and weak cursors if the insertion point is at that index.
--   The position of each cursor is stored as a zero-width rectangle. The
--   strong cursor location is the location where characters of the
--   directionality equal to the base direction of the layout are inserted.
--   The weak cursor location is the location where characters of the
--   directionality opposite to the base direction of the layout are
--   inserted. The first element of the tuple is the strong position, the
--   second the weak.
--   
layoutGetCursorPos :: PangoLayout -> Int -> IO (PangoRectangle, PangoRectangle)

-- | Move a cursor visually.
--   
--   
--   
- Compute a new cursor position from a previous cursor position. A
--   value of True for the direction will move it to the right,
--   independent of the underlying direction. Hence the cursor position
--   might jump if left-to-right text is mixed with right-to-left
--   text.
--   
- The first flag should be True if this cursor is the
--   strong cursor. The strong cursor is the cursor of the base direction
--   of the current layout (see layoutSetAutoDir). The weak cursor
--   is that of the opposite direction.
--   
- The previous cursor position is given by idx. If this
--   text at this position is a cluster, the cursor will only move to the
--   end or beginning of the cluster as opposed to past the next character.
--   The return value is either CursorPosNextPara if the cursor
--   moved beyond this paragraph, it is CursorPosPrevPara if the
--   cursor moved in front of this paragraph and it is CursorPos
--   idx trail to denote the new cursor position
--   idx. Note that idx will always denote an insertion
--   point, that is, idx will never point into the middle of a
--   cluster. The trail value can contain a positive value if the
--   current cursor position is at the end of the current line. In this
--   case, idx points past the last character of this line while
--   trail contains the number of characters that are responsible
--   for the line break such as newlines. The actual cursor position is
--   always idx+trail where the visual cursor should be
--   shown.
--   
layoutMoveCursorVisually :: PangoLayout -> Bool -> Int -> Bool -> IO CursorPos

-- | Computes the logical and ink extents of the PangoLayout.
--   
--   Logical extents are usually what you want for positioning things. Note
--   that both extents may have non-zero x and y. You may want to use those
--   to offset where you render the layout. Not doing that is a very
--   typical bug that shows up as right-to-left layouts not being correctly
--   positioned in a layout with a set width.
--   
--   Layout coordinates begin at the top left corner of the layout.
layoutGetExtents :: PangoLayout -> IO (PangoRectangle, PangoRectangle)

-- | Compute the physical size of the layout.
--   
--   
--   
- Computes the ink and the logical size of the Layout in
--   device units, that is, pixels for a screen. Identical to
--   layoutGetExtents and converting the Doubles in the
--   PangoRectangle to integers.
--   
layoutGetPixelExtents :: PangoLayout -> IO (Rectangle, Rectangle)

-- | Ask for the number of lines in this layout.
layoutGetLineCount :: PangoLayout -> IO Int

-- | Extract a single lines of the layout.
--   
--   
--   
- The given index starts from 0. The function throws an
--   ArrayException if the index is out of bounds.
--   
- The lines of each layout are regenerated if any attribute changes.
--   Thus the returned list does not reflect the current state of lines
--   after a change has been made.
--   
layoutGetLine :: PangoLayout -> Int -> IO LayoutLine

-- | Extract the lines of the layout.
--   
--   
--   
- The lines of each layout are regenerated if any attribute changes.
--   Thus the returned list does not reflect the current state of lines
--   after a change has been made.
--   
layoutGetLines :: PangoLayout -> IO [LayoutLine]

-- | Create an iterator to examine a layout.
layoutGetIter :: PangoLayout -> IO LayoutIter

-- | Move to the next GlyphItem.
--   
--   
--   
- Returns False if this was the last item in the
--   layout.
--   
layoutIterNextItem :: LayoutIter -> IO Bool

-- | Move to the next char.
--   
--   
--   
- Returns False if this was the last char in the
--   layout.
--   
layoutIterNextChar :: LayoutIter -> IO Bool

-- | Move to the next cluster.
--   
--   
--   
- Returns False if this was the last cluster in the
--   layout.
--   
layoutIterNextCluster :: LayoutIter -> IO Bool

-- | Move to the next line.
--   
--   
--   
- Returns False if this was the last line in the
--   layout.
--   
layoutIterNextLine :: LayoutIter -> IO Bool

-- | Check if the iterator is on the last line.
--   
--   
--   
- Returns True if the iterator is on the last line of this
--   paragraph.
--   
layoutIterAtLastLine :: LayoutIter -> IO Bool

-- | Get the character index.
--   
--   
--   
- Note that iterating forward by char moves in visual order, not
--   logical order, so indexes may not be sequential. Also, the index may
--   be equal to the length of the text in the layout.
--   
layoutIterGetIndex :: LayoutIter -> IO Int

-- | Query the vertical position within the layout.
--   
--   
--   
- Gets the y position of the current line's baseline (origin at top
--   left of the entire layout).
--   
layoutIterGetBaseline :: LayoutIter -> IO Double

-- | Retrieve the current GlyphItem under the iterator.
--   
--   
--   
- Each LayoutLine contains a list of GlyphItems. This
--   function returns the GlyphItem under the current iterator. If
--   the iterator is positioned past the last character of the paragraph,
--   the function returns Nothing.
--   
layoutIterGetItem :: LayoutIter -> IO (Maybe GlyphItem)

-- | Extract the line under the iterator.
layoutIterGetLine :: LayoutIter -> IO (Maybe LayoutLine)

-- | Retrieve a rectangle surrounding a character.
--   
--   
--   
- Get the extents of the current character (origin is the top left
--   of the entire layout). Only logical extents can sensibly be obtained
--   for characters; ink extents make sense only down to the level of
--   clusters.
--   
layoutIterGetCharExtents :: LayoutIter -> IO PangoRectangle

-- | Compute the physical size of the cluster.
--   
--   
--   
- Computes the ink and the logical size of the cluster pointed to by
--   LayoutIter.
--   
layoutIterGetClusterExtents :: LayoutIter -> IO (PangoRectangle, PangoRectangle)

-- | Compute the physical size of the run.
--   
--   
--   
- Computes the ink and the logical size of the run pointed to by
--   LayoutIter.
--   
layoutIterGetRunExtents :: LayoutIter -> IO (PangoRectangle, PangoRectangle)

-- | Retrieve vertical extent of this line.
--   
--   
--   
- Divides the vertical space in the PangoLayout being
--   iterated over between the lines in the layout, and returns the space
--   belonging to the current line. A line's range includes the line's
--   logical extents, plus half of the spacing above and below the line, if
--   layoutSetSpacing has been called to set layout spacing. The y
--   positions are in layout coordinates (origin at top left of the entire
--   layout).
--   
- The first element in the returned tuple is the start, the second
--   is the end of this line.
--   
layoutIterGetLineYRange :: LayoutIter -> IO (Double, Double)

-- | Compute the physical size of the line.
--   
--   
--   
- Computes the ink and the logical size of the line pointed to by
--   LayoutIter. See layoutGetExtents.
--   
- Extents are in layout coordinates (origin is the top-left corner
--   of the entire PangoLayout). Thus the extents returned by this
--   function will be the same width/height but not at the same x/y as the
--   extents returned from layoutLineGetExtents.
--   
layoutIterGetLineExtents :: LayoutIter -> IO (PangoRectangle, PangoRectangle)

-- | Compute the physical size of the line.
--   
--   
--   
- Computes the ink and the logical size of the LayoutLine.
--   See layoutGetExtents.
--   
layoutLineGetExtents :: LayoutLine -> IO (PangoRectangle, PangoRectangle)

-- | Compute the physical size of the line.
--   
--   
--   
- Computes the ink and the logical size of the LayoutLine.
--   See layoutGetExtents. The returned values are in device units,
--   that is, pixels for the screen and points for printers.
--   
layoutLineGetPixelExtents :: LayoutLine -> IO (Rectangle, Rectangle)

-- | Request the horizontal position of a character.
layoutLineIndexToX :: LayoutLine -> Int -> Bool -> IO Double

-- | Request the character index of a given horizontal position.
--   
--   
--   
- Converts from an x offset to the index of the corresponding
--   character within the text of the layout. If the x parameter
--   is outside the line, a triple (False, index, trailing) is
--   returned where index and trailing will point to the
--   very first or very last position in the line. This notion of first and
--   last position is based on the direction of the paragraph; for example,
--   if the direction is right-to-left, then an x position to the
--   right of the line results in 0 being returned for index and
--   trailing. An x position to the left of the line
--   results in index pointing to the (logical) last grapheme in
--   the line and trailing pointing to the number of characters in that
--   grapheme. The reverse is true for a left-to-right line. If the boolean
--   flag in the result is True then x was within the
--   layout line and trailing indicates where in a cluster the
--   x position lay. It is 0 for the trailing edge of the
--   cluster.
--   
layoutLineXToIndex :: LayoutLine -> Double -> IO (Bool, Int, Int)

-- | Retrieve bounding boxes for a given piece of text contained in this
--   LayoutLine.
--   
--   
--   
- The result is a list to accommodate for mixed left-to-right and
--   right-to-left text. Even if the text is not mixed, several ranges
--   might be returned that are adjacent. The ranges are always sorted from
--   left to right. The values are with respect to the left edge of the
--   entire layout, not with respect to the line (which might be indented
--   or not left aligned).
--   
layoutLineGetXRanges :: LayoutLine -> Int -> Int -> IO [(Double, Double)]

-- | Define attributes for FontSize.
data Size
SizePoint :: Double -> Size
SizeUnreadable :: Size
SizeTiny :: Size
SizeSmall :: Size
SizeMedium :: Size
SizeLarge :: Size
SizeHuge :: Size
SizeGiant :: Size
SizeSmaller :: Size
SizeLarger :: Size

-- | Rectangles describing an area in Doubles.
--   
--   
--   
- Specifies x, y, width and height
--   
data PangoRectangle
PangoRectangle :: Double -> Double -> Double -> Double -> PangoRectangle

-- | The EllipsizeMode type describes what sort of (if any)
--   ellipsization should be applied to a line of text. In the
--   ellipsization process characters are removed from the text in order to
--   make it fit to a given width and replaced with an ellipsis.
data EllipsizeMode
EllipsizeNone :: EllipsizeMode
EllipsizeStart :: EllipsizeMode
EllipsizeMiddle :: EllipsizeMode
EllipsizeEnd :: EllipsizeMode

-- | The characteristic measurements of a font.
--   
--   
--   
- All values are measured in pixels.
--   
- In Pango versions before 1.6 only ascent, descent,
--   approximateCharWidth and approximateDigitWidth are
--   available.
--   
data FontMetrics
FontMetrics :: Double -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> FontMetrics

-- | 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.)
[ascent] :: FontMetrics -> Double

-- | 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.)
[descent] :: FontMetrics -> Double

-- | The approximate character width. 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.
[approximateCharWidth] :: FontMetrics -> Double

-- | The approximate digit width. This is merely a representative value
--   useful, for example, for determining the initial size for a window.
--   Actual digits in text can be wider and narrower than this, though this
--   value is generally somewhat more accurate than
--   approximateCharWidth.
[approximateDigitWidth] :: FontMetrics -> Double

-- | The suggested thickness to draw an underline.
[underlineThickness] :: FontMetrics -> Double

-- | The suggested position to draw the underline. The value returned is
--   the distance above the baseline of the top of the underline. Since
--   most fonts have underline positions beneath the baseline, this value
--   is typically negative.
[underlinePosition] :: FontMetrics -> Double

-- | The suggested thickness to draw for the strikethrough.
[strikethroughThickness] :: FontMetrics -> Double

-- | The suggested position to draw the strikethrough. The value returned
--   is the distance above the baseline of the top of the strikethrough.
[strikethroughPosition] :: FontMetrics -> Double
type PangoUnit = Double

-- | Color
--   
--   
--   
- Specifies a color with three integer values for red, green and
--   blue. All values range from 0 (least intense) to 65535 (highest
--   intensity).
--   
data Color
Color :: Word16 -> Word16 -> Word16 -> Color

-- | Rectangle
--   
--   
--   
- Specifies x, y, width and height
--   
data Rectangle
Rectangle :: Int -> Int -> Int -> Int -> Rectangle

-- | The style of a font.
--   
--   
--   
- StyleOblique is a slanted font like StyleItalic, but
--   in a roman style.
--   
data FontStyle
StyleNormal :: FontStyle
StyleOblique :: FontStyle
StyleItalic :: FontStyle

-- | Define attributes for Weight.
data Weight
WeightThin :: Weight
WeightUltralight :: Weight
WeightLight :: Weight
WeightSemilight :: Weight
WeightBook :: Weight
WeightNormal :: Weight
WeightMedium :: Weight
WeightSemibold :: Weight
WeightBold :: Weight
WeightUltrabold :: Weight
WeightHeavy :: Weight
WeightUltraheavy :: Weight

-- | The variant of a font.
--   
--   
--   
- The VariantSmallCaps is a version of a font where lower
--   case letters are shown as physically smaller upper case letters.
--   
data Variant
VariantNormal :: Variant
VariantSmallCaps :: Variant
VariantAllSmallCaps :: Variant
VariantPetiteCaps :: Variant
VariantAllPetiteCaps :: Variant
VariantUnicase :: Variant
VariantTitleCaps :: Variant

-- | Define how wide characters are.
data Stretch
StretchUltraCondensed :: Stretch
StretchExtraCondensed :: Stretch
StretchCondensed :: Stretch
StretchSemiCondensed :: Stretch
StretchNormal :: Stretch
StretchSemiExpanded :: Stretch
StretchExpanded :: Stretch
StretchExtraExpanded :: Stretch
StretchUltraExpanded :: Stretch

-- | Define attributes for Underline.
--   
--   
--   
- The squiggly underline for errors is only available in Gtk 2.4 and
--   higher.
--   
data Underline
UnderlineNone :: Underline
UnderlineSingle :: Underline
UnderlineDouble :: Underline
UnderlineLow :: Underline
UnderlineError :: Underline
UnderlineSingleLine :: Underline
UnderlineDoubleLine :: Underline
UnderlineErrorLine :: Underline

-- | The PangoDirection type represents a direction in the Unicode
--   bidirectional algorithm.
--   
--   
--   
- The "weak" values denote a left-to-right or right-to-left
--   direction only if there is no character with a strong direction in a
--   paragraph. An example is a sequence of special, graphical characters
--   which are neutral with respect to their rendering direction. A fresh
--   PangoContext is by default weakly left-to-right.
--   
- Not every value in this enumeration makes sense for every usage of
--   PangoDirection; for example, the return value of
--   unicharDirection and findBaseDir cannot be
--   PangoDirectionWeakLtr or PangoDirectionWeakRtl, since
--   every character is either neutral or has a strong direction; on the
--   other hand PangoDirectionNeutral doesn't make sense to pass to
--   log2visGetEmbeddingLevels.
--   
data PangoDirection
PangoDirectionLtr :: PangoDirection
PangoDirectionRtl :: PangoDirection
PangoDirectionWeakLtr :: PangoDirection
PangoDirectionWeakRtl :: PangoDirection
PangoDirectionNeutral :: PangoDirection

-- | Attributes for PangoItems.
--   
--   
--   
- A given attribute is applied from its start position
--   paStart up, but not including the end position,
--   paEnd.
--   
data PangoAttribute

-- | A hint as to what language this piece of text is written in.
AttrLanguage :: Int -> Int -> Language -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paLang] :: PangoAttribute -> Language

-- | The font family, e.g. sans serif.
AttrFamily :: Int -> Int -> DefaultGlibString -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paFamily] :: PangoAttribute -> DefaultGlibString

-- | The slant of the current font.
AttrStyle :: Int -> Int -> FontStyle -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paStyle] :: PangoAttribute -> FontStyle

-- | Weight of font, e.g. WeightBold.
AttrWeight :: Int -> Int -> Weight -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paWeight] :: PangoAttribute -> Weight

-- | VariantSmallCaps will display lower case letters as small upper
--   case letters (if the font supports this).
AttrVariant :: Int -> Int -> Variant -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paVariant] :: PangoAttribute -> Variant

-- | Stretch or condense the width of the letters.
AttrStretch :: Int -> Int -> Stretch -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paStretch] :: PangoAttribute -> Stretch

-- | Specify the size of the font in points.
AttrSize :: Int -> Int -> Double -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paSize] :: PangoAttribute -> Double

-- | Specify the size of the font in device units (pixels).
--   
--   
--   
- Available in Pango 1.8.0 and higher.
--   
AttrAbsSize :: Int -> Int -> Double -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paSize] :: PangoAttribute -> Double

-- | Specify several attributes of a font at once. Note that no deep copy
--   of the description is made when this attributes is passed to or
--   received from functions.
AttrFontDescription :: Int -> Int -> FontDescription -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paFontDescription] :: PangoAttribute -> FontDescription

-- | Specify the foreground color.
AttrForeground :: Int -> Int -> Color -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paColor] :: PangoAttribute -> Color

-- | Specify the background color.
AttrBackground :: Int -> Int -> Color -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paColor] :: PangoAttribute -> Color

-- | Specify the kind of underline, e.g. UnderlineSingle.
AttrUnderline :: Int -> Int -> Underline -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paUnderline] :: PangoAttribute -> Underline

-- | Specify the color of an underline.
--   
--   
--   
- Available in Pango 1.8.0 and higher.
--   
AttrUnderlineColor :: Int -> Int -> Color -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paColor] :: PangoAttribute -> Color

-- | Specify if this piece of text should have a line through it.
AttrStrikethrough :: Int -> Int -> Bool -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paStrikethrough] :: PangoAttribute -> Bool

-- | Specify the color of the strike through line.
--   
--   
--   
- Available in Pango 1.8.0 and higher.
--   
AttrStrikethroughColor :: Int -> Int -> Color -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paColor] :: PangoAttribute -> Color

-- | Displace the text vertically. Positive values move the text upwards.
AttrRise :: Int -> Int -> Double -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paRise] :: PangoAttribute -> Double

-- | Restrict the amount of what is drawn of the marked shapes.
--   
--   
--   
- Available in Pango 1.8.0 and higher.
--   
AttrShape :: Int -> Int -> PangoRectangle -> PangoRectangle -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paInk] :: PangoAttribute -> PangoRectangle
[paLogical] :: PangoAttribute -> PangoRectangle

-- | Scale the font up (values greater than one) or shrink the font.
AttrScale :: Int -> Int -> Double -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paScale] :: PangoAttribute -> Double

-- | Determine if a fall back font should be substituted if no matching
--   font is available.
AttrFallback :: Int -> Int -> Bool -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paFallback] :: PangoAttribute -> Bool

-- | Add extra space between graphemes of the text.
--   
--   
--   
- Available in Pango 1.6.0 and higher.
--   
AttrLetterSpacing :: Int -> Int -> Double -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paLetterSpacing] :: PangoAttribute -> Double

-- | Sets the gravity field of a font description. The gravity field
--   specifies how the glyphs should be rotated. If gravity is
--   GravityAuto, this actually unsets the gravity mask on the
--   font description.
--   
--   
--   
- This function is seldom useful to the user. Gravity should
--   normally be set on a PangoContext.
--   
- Available in Pango 1.16.0 and higher.
--   
AttrGravity :: Int -> Int -> PangoGravity -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paGravity] :: PangoAttribute -> PangoGravity

-- | Set the way horizontal scripts behave in a vertical context.
--   
--   
--   
- Available in Pango 1.16.0 and higher.
--   
AttrGravityHint :: Int -> Int -> PangoGravityHint -> PangoAttribute
[paStart] :: PangoAttribute -> Int
[paEnd] :: PangoAttribute -> Int
[paGravityHint] :: PangoAttribute -> PangoGravityHint

-- | The PangoGravity type represents the orientation of glyphs in a
--   segment of text. The value GravitySouth, for instance,
--   indicates that the text stands upright, i.e. that the base of the
--   letter is directed downwards.
--   
--   This is useful when rendering vertical text layouts. In those
--   situations, the layout is rotated using a non-identity
--   PangoMatrix, and then glyph orientation is controlled using
--   PangoGravity. Not every value in this enumeration makes sense
--   for every usage of Gravity; for example,
--   PangoGravityAuto only can be passed to
--   pangoContextSetBaseGravity and can only be returned by
--   pangoContextGetBaseGravity.
--   
--   
--   
- See also: PangoGravityHint
--   
- Gravity is resolved from the context matrix.
--   
- Since Pango 1.16
--   
data PangoGravity
PangoGravitySouth :: PangoGravity
PangoGravityEast :: PangoGravity
PangoGravityNorth :: PangoGravity
PangoGravityWest :: PangoGravity
PangoGravityAuto :: PangoGravity

-- | The PangoGravityHint defines how horizontal scripts should
--   behave in a vertical context.
--   
--   
--   
- PangoGravityHintNatural: scripts will take their natural
--   gravity based on the base gravity and the script. This is the
--   default.
--   
- PangoGravityHintStrong: always use the base gravity set,
--   regardless of the script.
--   
- PangoGravityHintLine: for scripts not in their natural
--   direction (eg. Latin in East gravity), choose per-script gravity such
--   that every script respects the line progression. This means, Latin and
--   Arabic will take opposite gravities and both flow top-to-bottom for
--   example.
--   
data PangoGravityHint
PangoGravityHintNatural :: PangoGravityHint
PangoGravityHintStrong :: PangoGravityHint
PangoGravityHintLine :: PangoGravityHint
pangoScale :: Double
