wumpus-drawing-0.2.0: High-level drawing objects built on Wumpus-Basic.

PortabilityGHC
Stabilityunstable
Maintainerstephen.tetley@gmail.com

Wumpus.Drawing.Text.Base

Description

Helpers for working with measured / advance text.

Synopsis

Documentation

advtext :: FromPtSize u => EscapedText -> AdvGraphic uSource

Single line text, returning its advance vector.

multilineHeight :: (Real u, Floating u, FromPtSize u) => Int -> DrawingInfo uSource

Height of multiline text is cap_height to descender for the first line, then baseline-to-baseline span for the remaining lines.

textObjectPos :: (Real u, Floating u, FromPtSize u) => Int -> u -> DrawingInfo (ObjectPos u)Source

Height of multiline text is cap_height to descender for the first line, then baseline-to-baseline span for the remaining lines.

The answer is in centerform, i.e.:

 ObjectPos  half_width  half_width  half_height  half_height 

borderedTextObjectPos :: (Real u, Floating u, FromPtSize u) => Int -> u -> DrawingInfo (ObjectPos u)Source

Variant of textObjectPos where the calculation includes margins around all four sides of the enclosing rectangle.

Margin sizes are taken from the text_margin field in the DrawingContext.

centerToBaseline :: (Fractional u, FromPtSize u) => DrawingInfo uSource

Calculate the distance from the center of a one-line textbox to the baseline. Note the height of a textbox is vspan which is cap_height + descender

centerSpinePoints :: Floating u => Int -> Radian -> LocChain uSource

All drawing is done on a spine that plots points from the first line of text. The spine is calculated from its center and has to account for the inclination.