Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data TextOpts n = TextOpts {}
- data Spacing
- horizontalAdvances :: RealFloat n => [String] -> FontData n -> Bool -> [n]
- isKern :: Spacing -> Bool
- characterStrings' :: FontData n -> String -> [String]
- data PreparedText n = PreparedText {
- fontTop :: n
- fontBottom :: n
- preglyphs :: [(String, n)]
- prepare :: RealFloat n => TextOpts n -> String -> PreparedText n
- draw_glyphs :: RealFloat n => TextOpts n -> [(String, n)] -> [Path V2 n]
- shift_glyphs :: RealFloat n => [(n, Path V2 n)] -> [Path V2 n]
- svgText :: RealFloat n => TextOpts n -> String -> PathInRect n
- svgText_raw :: RealFloat n => TextOpts n -> String -> Path V2 n
- svgText_modifyPreglyphs :: (RealFloat n, Monad m) => TextOpts n -> (PreparedText n -> m [(String, n)]) -> String -> m (PathInRect n)
- svgText_fitRect :: forall n. RealFloat n => TextOpts n -> (n, n) -> String -> PathInRect n
- svgText_fitRect_stretchySpace :: forall n. RealFloat n => TextOpts n -> (n, n) -> n -> String -> PathInRect n
- textSVG :: (Read n, RealFloat n) => String -> n -> Path V2 n
Setting text as a path using a font.
horizontalAdvances :: RealFloat n => [String] -> FontData n -> Bool -> [n] Source #
Horizontal advances of characters inside a string. A character is stored with a string (because of ligatures like "ffi").
data PreparedText n Source #
PreparedText | |
|
prepare :: RealFloat n => TextOpts n -> String -> PreparedText n Source #
Break text into preglyphs (= ligatures and singleton characters) and compute their advances.
draw_glyphs :: RealFloat n => TextOpts n -> [(String, n)] -> [Path V2 n] Source #
Create a path (glyph) for each preglyph.
shift_glyphs :: RealFloat n => [(n, Path V2 n)] -> [Path V2 n] Source #
Position glyphs according to their advances.
svgText :: RealFloat n => TextOpts n -> String -> PathInRect n Source #
Render PathInRect
from text. The enclosing rectangle, computed from the
font, is kept, to be able to e.g. correctly position lines of text one above other.
svgText_raw :: RealFloat n => TextOpts n -> String -> Path V2 n Source #
Simply render path from text.
svgText_modifyPreglyphs :: (RealFloat n, Monad m) => TextOpts n -> (PreparedText n -> m [(String, n)]) -> String -> m (PathInRect n) Source #
Like svgText
but preglyphs can be modified using the given monad before
draw_glyphs
is called. Simple examples of this function's specializations are e.g.
svgText_fitRect
and svgText_fitRect_stretchySpace
.
svgText_fitRect :: forall n. RealFloat n => TextOpts n -> (n, n) -> String -> PathInRect n Source #
Like svgText
but a rectangle is provided, into which the text will
fit. The text is scaled according to the height of the rectengle. The glyphs
are interleaved with even spaces to fit the width of the rectangle. The text
must have at least two characters for correct functionality.
svgText_fitRect_stretchySpace :: forall n. RealFloat n => TextOpts n -> (n, n) -> n -> String -> PathInRect n Source #
Like svgText_fitRect
but space characters are stretched k
times more
than others for svgText_fitRect_stretchySpace opts (w, h) k text
.