Gtk2HsContentsIndex
Graphics.UI.Gtk.Pango.Markup
Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users@lists.sourceforge.net
Description

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

The full markup language can be found at http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html.

Synopsis
type Markup = String
data SpanAttribute
= FontDescr String
| FontFamily String
| FontSize Size
| FontStyle FontStyle
| FontWeight Weight
| FontVariant Variant
| FontStretch Stretch
| FontForeground String
| FontBackground String
| FontUnderline Underline
| FontRise Double
| FontLang Language
markSpan :: [SpanAttribute] -> String -> String
data Size
= SizePoint Double
| SizeUnreadable
| SizeTiny
| SizeSmall
| SizeMedium
| SizeLarge
| SizeHuge
| SizeGiant
| SizeSmaller
| SizeLarger
Documentation
type Markup = String

Define a synonym for text with embedded markup commands.

  • Markup strings are just simple strings. But it's easier to tell if a method expects text with or without markup.
data SpanAttribute
These are all the attributes the markSpan function can express.
Constructors
FontDescr String

Choose a font by textual description.

  • Takes a string to completely describe the font, example: FontDescr "Sans Italic 12"
FontFamily String

Specify the family of font to use.

  • Example: FontFamily "Sans"
FontSize Size

Change the size of the current font.

  • The constuctor 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.
FontStyle FontStyleChange the slant of the current font.
FontWeight Weight

Change the thickness of the current font.

  • The constructor takes one of the six predefined weights. Most likely to be supported: WeightBold.
FontVariant Variant

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.
FontStretch Stretch

Choose a different width.

FontForeground String

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".
FontBackground StringBackground color.
FontUnderline UnderlineSpecify underlining of text.
FontRise Double

Specify a vertical displacement.

  • Takes the vertical displacement in em (the width of the 'm' character in the current font).
FontLang Language

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.
show/hide Instances
markSpan :: [SpanAttribute] -> String -> String
Create the most generic span attribute.
data Size
Define attributes for FontSize.
Constructors
SizePoint Double
SizeUnreadable
SizeTiny
SizeSmall
SizeMedium
SizeLarge
SizeHuge
SizeGiant
SizeSmaller
SizeLarger
show/hide Instances
Produced by Haddock version 0.8