| Maintainer | diagrams-discuss@googlegroups.com |
|---|
Diagrams.TwoD.Text
Description
Very basic text primitives along with associated attributes.
- data Text = Text T2 String
- text :: Renderable Text b => String -> Diagram b R2
- newtype Font = Font (Last String)
- getFont :: Font -> String
- font :: HasStyle a => String -> a -> a
- newtype FontSize = FontSize (Last Double)
- getFontSize :: FontSize -> Double
- fontSize :: HasStyle a => Double -> a -> a
- data FontSlant
- data FontSlantA
- getFontSlant :: FontSlantA -> FontSlant
- fontSlant :: HasStyle a => FontSlant -> a -> a
- italic :: HasStyle a => a -> a
- oblique :: HasStyle a => a -> a
- data FontWeight
- data FontWeightA
- getFontWeight :: FontWeightA -> FontWeight
- fontWeight :: HasStyle a => FontWeight -> a -> a
- bold :: HasStyle a => a -> a
Creating text diagrams
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.
Instances
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
The Font attribute specifies the name of a font family. Inner
Font attributes override outer ones.
font :: HasStyle a => String -> a -> aSource
Specify a font family to be used for all text within a diagram.
Font size
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.
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
Constructors
| FontSlantNormal | |
| FontSlantItalic | |
| FontSlantOblique |
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.
Font weight
data FontWeight Source
Constructors
| FontWeightNormal | |
| FontWeightBold |
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.