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 StyleR2 parameter, determining the
style to apply to the text before rendering / querying information about
the text. These StyleR2 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.

The functions in this module will only
work with text whose font size is measured in Local units.

This module should thus be considered experimental/unsupported; if
it works for you, great, but if not you are probably out of luck.
See the SVGFonts package for better-supported ways to accomplish
similar things.

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

Unsafe

These are convenient unsafe variants of the above operations
using unsafePerformIO. In practice, they should be fairly
safe as the results depend only on the parameters and the
font information (which ought to stay the same during a given
execution).

Queries the amount of horizontal offset that needs to be applied
in order to position the second character properly, in the event
that it is hcat-ed baselineText. See kerningCorrectionIO;
this variant uses unsafePerformIO but should be fairly safe in
practice.

Creates text diagrams with their envelopes set such that using
vcat . map (textLineBounded style) stacks them in the way
that the font designer intended. See textLineBoundedIO; this
variant uses unsafePerformIO but should be fairly safe in
practice.

Creates a text diagram with its envelope set to enclose the
glyphs of the text, including leading (though not trailing)
whitespace. See textVisualBoundedIO; this variant uses
unsafePerformIO but should be fairly safe in practice.