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

Functions to manage font description.

  • Font descriptions provide a way to query and state requirements of fonts. This data structure has several fields describing different characteristics of a font. Each of these fields can be set of left unspecified.
Synopsis
data FontDescription
fontDescriptionNew :: IO FontDescription
fontDescriptionCopy :: FontDescription -> IO FontDescription
fontDescriptionSetFamily :: FontDescription -> String -> IO ()
fontDescriptionGetFamily :: FontDescription -> IO (Maybe String)
fontDescriptionSetStyle :: FontDescription -> FontStyle -> IO ()
fontDescriptionGetStyle :: FontDescription -> IO (Maybe FontStyle)
fontDescriptionSetVariant :: FontDescription -> Variant -> IO ()
fontDescriptionGetVariant :: FontDescription -> IO (Maybe Variant)
fontDescriptionSetWeight :: FontDescription -> Weight -> IO ()
fontDescriptionGetWeight :: FontDescription -> IO (Maybe Weight)
fontDescriptionSetStretch :: FontDescription -> Stretch -> IO ()
fontDescriptionGetStretch :: FontDescription -> IO (Maybe Stretch)
fontDescriptionSetSize :: FontDescription -> Rational -> IO ()
fontDescriptionGetSize :: FontDescription -> IO (Maybe Rational)
fontDescriptionUnsetFields :: FontDescription -> [FontMask] -> IO ()
fontDescriptionMerge :: FontDescription -> FontDescription -> Bool -> IO ()
fontDescriptionBetterMatch :: FontDescription -> FontDescription -> FontDescription -> Bool
fontDescriptionFromString :: String -> IO FontDescription
fontDescriptionToString :: FontDescription -> IO String
Documentation
data FontDescription
A possibly partial description of font(s).
fontDescriptionNew :: IO FontDescription

Create a new font description.

  • All field are unset.
fontDescriptionCopy :: FontDescription -> IO FontDescription
Make a deep copy of a font description.
fontDescriptionSetFamily :: FontDescription -> String -> IO ()

Set the font famliy.

  • A font family is a name designating the design of the font (e.g. Sans or Times) without the variant.
  • In some contexts a comma separated list of font families can be used.
fontDescriptionGetFamily :: FontDescription -> IO (Maybe String)

Get the font family.

  • Nothing is returned if the font family is not set.
fontDescriptionSetStyle :: FontDescription -> FontStyle -> IO ()

Set the style field.

  • Most fonts will have either a StyleItalic or StyleQblique but rarely both.
fontDescriptionGetStyle :: FontDescription -> IO (Maybe FontStyle)
Get the style field.
fontDescriptionSetVariant :: FontDescription -> Variant -> IO ()
Set the variant field.
fontDescriptionGetVariant :: FontDescription -> IO (Maybe Variant)
Get the variant field.
fontDescriptionSetWeight :: FontDescription -> Weight -> IO ()
Set the weight field.
fontDescriptionGetWeight :: FontDescription -> IO (Maybe Weight)
Get the weight field.
fontDescriptionSetStretch :: FontDescription -> Stretch -> IO ()
Set the stretch field.
fontDescriptionGetStretch :: FontDescription -> IO (Maybe Stretch)
Get the stretch field.
fontDescriptionSetSize :: FontDescription -> Rational -> IO ()

Set the size field.

  • The given size is in points (pts). One point is 1/72 inch.
fontDescriptionGetSize :: FontDescription -> IO (Maybe Rational)
Get the size field.
fontDescriptionUnsetFields :: FontDescription -> [FontMask] -> IO ()
Reset fields in a font description.
fontDescriptionMerge :: FontDescription -> FontDescription -> Bool -> 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.
fontDescriptionBetterMatch :: FontDescription -> FontDescription -> FontDescription -> Bool

Determine which of two descriptions matches a given description better.

  • Returns True if the last description is a better match to the first arguement than the middle one.
  • Approximate matching is done on weight and style. If the other attributes do not match, the function returns False.
fontDescriptionFromString :: String -> IO FontDescription

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 corresponing fields unset.
fontDescriptionToString :: FontDescription -> IO String

Convert a font description to a string.

Produced by Haddock version 0.7