diagrams-lib-0.4.0.1: Embedded domain-specific language for declarative graphics

Maintainerdiagrams-discuss@googlegroups.com

Diagrams.TwoD.Text

Contents

Description

Very basic text primitives along with associated attributes.

Synopsis

Creating text diagrams

data Text Source

A text primitive consists of the string contents along with a transformation mapping from the local vector space of the text to the vector space in which it is embedded.

Constructors

Text T2 String 

text :: Renderable Text b => String -> Diagram b R2Source

Create a primitive text diagram from the given string, which takes up no space. By default, the text is centered with respect to its local origin (see alignText).

Text attributes

Font family

newtype Font Source

The Font attribute specifies the name of a font family. Inner Font attributes override outer ones.

Constructors

Font (Last String) 

getFont :: Font -> StringSource

Extract the font family name from a Font attribute.

font :: HasStyle a => String -> a -> aSource

Specify a font family to be used for all text within a diagram.

Font size

newtype FontSize Source

The FontSize attribute specifies the size of a font's em-square, measured with respect to the current local vector space. Inner FontSize attributes override outer ones.

Constructors

FontSize (Last Double) 

getFontSize :: FontSize -> DoubleSource

Extract the size from a FontSize attribute.

fontSize :: HasStyle a => Double -> a -> aSource

Set the font size, that is, the size of the font's em-square as measured within the current local vector space. The default size is 1.

Font slant

data FontSlantA Source

The FontSlantA attribute specifies the slant (normal, italic, or oblique) that should be used for all text within a diagram. Inner FontSlantA attributes override outer ones.

getFontSlant :: FontSlantA -> FontSlantSource

Extract the font slant from a FontSlantA attribute.

fontSlant :: HasStyle a => FontSlant -> a -> aSource

Specify the slant (normal, italic, or oblique) that should be used for all text within a diagram. See also italic and oblique for useful special cases.

italic :: HasStyle a => a -> aSource

Set all text in italics.

oblique :: HasStyle a => a -> aSource

Set all text using an oblique slant.

Font weight

data FontWeightA Source

The FontWeightA attribute specifies the weight (normal or bold) that should be used for all text within a diagram. Inner FontWeightA attributes override outer ones.

getFontWeight :: FontWeightA -> FontWeightSource

Extract the font weight from a FontWeightA attribute.

fontWeight :: HasStyle a => FontWeight -> a -> aSource

Specify the weight (normal or bold) that should be used for all text within a diagram. See also bold for a useful special case.

bold :: HasStyle a => a -> aSource

Set all text using a bold font weight.