SVGFonts-1.4: Fonts from the SVG-Font format

Safe HaskellNone

Graphics.SVGFonts

Contents

Synopsis

Drawing text

textSVG :: String -> Double -> Path R2Source

A short version of textSVG' with standard values. The Double value is the height.

 import Graphics.SVGFonts

 textSVGExample = stroke $ textSVG "Hello World" 1

textSVG' :: TextOpts -> Path R2Source

The origin is at the center of the text and the boundaries are given by the outlines of the chars.

 import Graphics.SVGFonts

 text' t = stroke (textSVG' $ TextOpts t lin INSIDE_H KERN False 1 1 )
            # fc blue # lc blue # bg lightgrey # fillRule EvenOdd # showOrigin

 textPic0 = (text' "Hello World") # showOrigin

textSVG_ :: forall b. Renderable (Path R2) b => TextOpts -> QDiagram b R2 AnySource

The origin is at the left end of the baseline of of the text and the boundaries are given by the bounding box of the Font. This is best for combining Text of different fonts and for several lines of text. As you can see you can also underline text by setting underline to True.

 import Graphics.SVGFonts

 text'' t = (textSVG_ $ TextOpts t lin INSIDE_H KERN True 1 1 )
            # fc blue # lc blue # bg lightgrey # fillRule EvenOdd # showOrigin

 textPic1 = text'' "Hello World"

Options

data Mode Source

Constructors

INSIDE_H

The string fills the complete height, width adjusted. Used in text editors. The result can be smaller or bigger than the bounding box:

INSIDE_W

The string fills the complete width, height adjusted. May be useful for single words in a diagram, or for headlines. The result can be smaller or bigger than the bounding box:

INSIDE_WH

The string is stretched inside Width and Height boundaries. The horizontal advances are increased if the string is shorter than there is space. The horizontal advances are decreased if the string is longer than there is space. This feature is experimental and might change in the future.

Instances

data Spacing Source

Constructors

HADV

Every glyph has a unique horiz. advance

KERN

Recommended, same as HADV but sometimes overridden by kerning: As You can see there is less space between "A" and "V":

Instances

Provided fonts

bit :: (FontData, OutlineMap)Source

Bitstream, a standard monospaced font (used in gedit)

lin :: (FontData, OutlineMap)Source

Linux Libertine, for non-monospaced text: http://www.linuxlibertine.org/, contains a lot of unicode characters

lin2 :: (FontData, OutlineMap)Source

Linux Libertine, cut to contain only the most common characters, resulting in a smaller file and hence a quicker load time.