Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |
Safe Haskell | Safe-Infered |
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.
- normalizeCtx :: (DrawingCtxM m, InterpretUnit u) => u -> m Double
- normalizeCtxF :: (DrawingCtxM m, Functor t, InterpretUnit u) => t u -> m (t Double)
- dinterpCtx :: (DrawingCtxM m, InterpretUnit u) => Double -> m u
- dinterpCtxF :: (DrawingCtxM m, Functor t, InterpretUnit u) => t Double -> m (t u)
- uconvertCtx1 :: (DrawingCtxM m, InterpretUnit u, InterpretUnit u1) => u -> m u1
- uconvertCtxF :: (DrawingCtxM m, Functor t, InterpretUnit u, InterpretUnit u1) => t u -> m (t u1)
- pointSize :: DrawingCtxM m => m FontSize
- strokeAttr :: DrawingCtxM m => m (RGBi, StrokeAttr)
- fillAttr :: DrawingCtxM m => m RGBi
- borderedAttr :: DrawingCtxM m => m (RGBi, StrokeAttr, RGBi)
- textAttr :: DrawingCtxM m => m (RGBi, FontAttr)
- position :: (DrawingCtxM m, Fractional u) => (Int, Int) -> m (Point2 u)
- snapmove :: (DrawingCtxM m, Fractional u) => (Int, Int) -> m (Vec2 u)
- textMargin :: (DrawingCtxM m, InterpretUnit u) => m (u, u)
- getLineWidth :: DrawingCtxM m => m Double
- getFontAttr :: DrawingCtxM m => m FontAttr
- getFontSize :: DrawingCtxM m => m Int
- getFontFace :: DrawingCtxM m => m FontFace
- getTextColour :: DrawingCtxM m => m RGBi
- textlineSpace :: (DrawingCtxM m, Fractional u, InterpretUnit u) => m u
- glyphBoundingBox :: (DrawingCtxM m, InterpretUnit u) => m (BoundingBox u)
- capHeight :: (DrawingCtxM m, InterpretUnit u) => m u
- descender :: (DrawingCtxM m, InterpretUnit u) => m u
- underlinePosition :: (DrawingCtxM m, InterpretUnit u) => m u
- underlineThickness :: (DrawingCtxM m, InterpretUnit u) => m u
- verticalSpan :: (DrawingCtxM m, InterpretUnit u) => m u
- heightSpan :: (DrawingCtxM m, InterpretUnit u) => TextHeight -> m (u, u)
- escTextVector :: (DrawingCtxM m, InterpretUnit u) => EscapedText -> m (Vec2 u)
- escCharVector :: (DrawingCtxM m, InterpretUnit u) => EscapedChar -> m (Vec2 u)
- hkernVector :: (DrawingCtxM m, InterpretUnit u) => [KernChar u] -> m (Vec2 u)
- cwLookupTable :: DrawingCtxM m => m CharWidthLookup
Documentation
normalizeCtx :: (DrawingCtxM m, InterpretUnit u) => u -> m DoubleSource
normalizeCtxF :: (DrawingCtxM m, Functor t, InterpretUnit u) => t u -> m (t Double)Source
dinterpCtx :: (DrawingCtxM m, InterpretUnit u) => Double -> m uSource
dinterpCtxF :: (DrawingCtxM m, Functor t, InterpretUnit u) => t Double -> m (t u)Source
uconvertCtx1 :: (DrawingCtxM m, InterpretUnit u, InterpretUnit u1) => u -> m u1Source
uconvertCtxF :: (DrawingCtxM m, Functor t, InterpretUnit u, InterpretUnit u1) => t u -> m (t u1)Source
pointSize :: DrawingCtxM m => m FontSizeSource
strokeAttr :: DrawingCtxM m => m (RGBi, StrokeAttr)Source
fillAttr :: DrawingCtxM m => m RGBiSource
borderedAttr :: DrawingCtxM m => m (RGBi, StrokeAttr, RGBi)Source
textAttr :: DrawingCtxM m => m (RGBi, FontAttr)Source
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.
getLineWidth :: DrawingCtxM m => m DoubleSource
getFontAttr :: DrawingCtxM m => m FontAttrSource
getFontSize :: DrawingCtxM m => m IntSource
getFontFace :: DrawingCtxM m => m FontFaceSource
getTextColour :: DrawingCtxM m => m RGBiSource
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.