wumpus-basic-0.13.0: Common drawing utilities built on wumpus-core.

Stabilityhighly unstable
MaintainerStephen Tetley <stephen.tetley@gmail.com>




Querying the Drawing Context.



withTextAttr :: DrawingCtxM m => (RGBi -> FontAttr -> a) -> m aSource

Because textAttr is so commonly used here is a functional version that avoids tupling.

withFillAttr :: DrawingCtxM m => (RGBi -> a) -> m aSource

markHeight :: (DrawingCtxM m, FromPtSize u) => m uSource

The mark height is the height of a lowercase letter in the current font.

Arrowheads, dots etc. should generally be drawn at the mark height.

baselineSpacing :: (DrawingCtxM m, Fractional u) => m uSource

Vertical distance between baselines of consecutive text lines.

Glyph metrics

Default monospace metrics

monoLowerxHeight :: (DrawingCtxM m, FromPtSize u) => m uSource

Height of a lower case 'x' in Courier.

'x' has no ascenders or descenders.

monoTextDimensions :: (DrawingCtxM m, Num u, Ord u, FromPtSize u) => String -> m (u, u)Source

Query the dimensions of the text using the current font size but using metrics derived from Courier.

Note - the width will generally be a over-estimate for non-monospaced fonts.

monoMultiLineHeight :: (DrawingCtxM m, Fractional u, FromPtSize u) => Int -> m uSource

The heigth of n lines of text, which is n lines + n-1 line spacers

monoDefaultPadding :: (DrawingCtxM m, Fractional u, FromPtSize u) => m uSource

The default padding is half of the char width.

monoVecToCenter :: (DrawingCtxM m, Fractional u, Ord u, FromPtSize u) => String -> m (Vec2 u)Source

Vector from baseline left to center