diagrams-cairo-1.4.1: Cairo backend for diagrams drawing EDSL

Copyright(c) 2015 Diagrams-cairo team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

Diagrams.Backend.Cairo.Text

Contents

Description

This module provides convenience functions for querying information from cairo. In particular, this provides utilities for information about fonts, and creating text primitives with bounds based on the font being used. To render text with automatically determined envelopes, use textLineBounded, textLineBoundedIO, textVisualBounded, or textVisualBoundedIO.

Many of these functions take a Style V2 Double parameter, determining the style to apply to the text before rendering / querying information about the text. These Style V2 Double parameters can be created a variety of ways, but the most direct will likely be by applying style-transforming functions such as font, fontSize, fontSlant, and fontWeight to mempty. This works because there are instances of HasStyle and Monoid for Style v.

Synopsis

Documentation

These create diagrams instantiated with extent-based envelopes.

textLineBoundedIO :: Style V2 Double -> Text Double -> IO (Diagram Cairo) Source #

Creates text diagrams with their envelopes set such that using vcat . map (textLineBounded style) stacks them in the way that the font designer intended. Pango refers to this as logical extents.

textVisualBoundedIO :: Style V2 Double -> Text Double -> IO (Diagram Cairo) Source #

Creates a text diagram with its envelope set to enclose the glyphs of the text, including leading (though not trailing) whitespace.

Utilities

queryCairo :: Render a -> IO a Source #

Executes a cairo action on a dummy, zero-size image surface, in order to query things like font information.

unsafeCairo :: Render a -> a Source #

Unsafely invokes queryCairo using unsafePerformIO.