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

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

Wumpus.Basic.Graphic.Query

Description

Querying the Drawing Context.

Synopsis

Documentation

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.

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.

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