wumpus-basic-0.24.0: Basic objects and system code built on Wumpus-Core.

PortabilityGHC
Stabilityhighly unstable
MaintainerStephen Tetley <stephen.tetley@gmail.com>
Safe HaskellSafe-Infered

Wumpus.Basic.Kernel.Base.QueryDC

Contents

Description

Querying the Drawing Context.

** WARNING ** - parts of this module especially the mono-space glyph metrics need a re-think and will change or be dropped.

Synopsis

Documentation

position :: (DrawingCtxM m, Fractional u) => (Int, Int) -> m (Point2 u)Source

Get the Point corresponding the grid coordinates scaled by the snap-grid scaling factors.

snapmove :: (DrawingCtxM m, Fractional u) => (Int, Int) -> m (Vec2 u)Source

Scale a vector coordinate by the snap-grid scaling factors.

Absolute units.

textMargin :: (DrawingCtxM m, InterpretUnit u) => m (u, u)Source

Get the (x,y) margin around text.

Note - not all text operations in Wumpus are drawn with text margin.

textlineSpace :: (DrawingCtxM m, Fractional u, InterpretUnit u) => m uSource

Vertical distance between descender of a line and the cap-height of the line below.

Glyph metrics

glyphBoundingBox :: (DrawingCtxM m, InterpretUnit u) => m (BoundingBox u)Source

Get the font bounding box - this is the maximum boundary of the glyphs in the font. The span of the height is expected to be bigger than the cap_height plus descender depth.

capHeight :: (DrawingCtxM m, InterpretUnit u) => m uSource

Height of a capital letter.

descender :: (DrawingCtxM m, InterpretUnit u) => m uSource

Note - descender is expected to be negative.

underlinePosition :: (DrawingCtxM m, InterpretUnit u) => m uSource

Note - underline_position is expected to be negative.

underlineThickness :: (DrawingCtxM m, InterpretUnit u) => m uSource

Line width of underline line.

verticalSpan :: (DrawingCtxM m, InterpretUnit u) => m uSource

This is the distance from cap_height to descender.

heightSpan :: (DrawingCtxM m, InterpretUnit u) => TextHeight -> m (u, u)Source

Variant of verticalSpan that accounts for the specified TextHeight.

This returns a pair of (yminor, ymajor).

Text metrics

escTextVector :: (DrawingCtxM m, InterpretUnit u) => EscapedText -> m (Vec2 u)Source

Find the advance vector for the supplied EscapedText.

Note - the text assumed to be a single line.

escCharVector :: (DrawingCtxM m, InterpretUnit u) => EscapedChar -> m (Vec2 u)Source

Find the advance vector for the supplied EscapedChar.

hkernVector :: (DrawingCtxM m, InterpretUnit u) => [KernChar u] -> m (Vec2 u)Source

hkernVector : [kerning_char] -> AdvanceVec

hkernvector takes whatever length is paired with the EscapedChar for the init of the the list, for the last element it takes the charVector.

cwLookupTable :: DrawingCtxM m => m CharWidthLookupSource

Note the CharWidthLookup is not parameteric on units.

CharWidth is always Double representing PostScript points. Client code must convert this value accordingly.