cattrap-0.1.0.0: Lays out boxes according to the CSS Box Model.
Safe HaskellNone
LanguageHaskell2010

Graphics.Layout

Description

Generic layout logic, handling a hierarchy of varying formulas. Unless callers have more specific needs they probably wish to use this abstraction. Attempts to follow the CSS specs. See boxLayout for a main entrypoint, & CSS to receive CSS input.

Synopsis

Documentation

data LayoutItem m n x Source #

A tree of different layout algorithms. More to come...

Constructors

LayoutFlow x (PaddedBox m n) [LayoutItem m n x]

A block element. With margins, borders, & padding.

LayoutGrid x (Grid m n) [GridItem] [LayoutItem m n x]

A grid or table element.

LayoutInline x Font' Paragraph PageOptions [x]

Some richtext.

LayoutInline' x Font' ParagraphLayout PageOptions [x]

Results laying out richtext, has fixed width. Generated from LayoutInline for the sake of pagination.

LayoutSpan x Font' Fragment

Children of a LayoutInline or LayoutInline`.

layoutGetChilds :: LayoutItem m n x -> [LayoutItem m n x] Source #

Retrieve the subtree under a node.

layoutGetInner :: LayoutItem m n p -> p Source #

Retrieve the caller-specified data attached to a layout node.

boxMinWidth :: (Zero y, CastDouble y) => Maybe Double -> LayoutItem y Length x -> LayoutItem y Length x Source #

Update a (sub)tree to compute & cache minimum legible sizes.

boxMaxWidth :: CastDouble y => PaddedBox a Double -> LayoutItem y Length x -> LayoutItem y Length x Source #

Update a (sub)tree to compute & cache maximum legible width.

boxNatWidth :: (Zero y, CastDouble y) => Maybe Double -> LayoutItem y Length x -> LayoutItem y Length x Source #

Update a (sub)tree to compute & cache ideal width.

boxWidth :: (Zero y, CastDouble y) => PaddedBox b Double -> LayoutItem y Length x -> LayoutItem y Double x Source #

Update a (sub)tree to compute & cache final width.

boxNatHeight :: Double -> LayoutItem Length Double x -> LayoutItem Length Double x Source #

Update a (sub)tree to compute & cache ideal legible height.

boxMinHeight :: Double -> LayoutItem Length Double x -> LayoutItem Length Double x Source #

Update a (sub)tree to compute & cache minimum legible height.

boxMaxHeight :: PaddedBox Double Double -> LayoutItem Length Double x -> LayoutItem Length Double x Source #

Update a subtree to compute & cache maximum legible height.

boxHeight :: PaddedBox Double Double -> LayoutItem Length Double x -> LayoutItem Double Double x Source #

Update a (sub)tree to compute & cache final height.

boxSplit :: PropertyParser x => Double -> Double -> LayoutItem Double Double x -> (LayoutItem Double Double x, Maybe (LayoutItem Double Double x)) Source #

Split a (sub)tree to fit within max-height. May take full page height into account.

boxPaginate :: PropertyParser x => Double -> LayoutItem Double Double x -> [LayoutItem Double Double x] Source #

Generate a list of pages from a node, splitting subtrees where necessary.

boxPosition :: PropertyParser x => (Double, Double) -> LayoutItem Double Double x -> LayoutItem Double Double ((Double, Double), x) Source #

Compute position of all nodes in the (sub)tree relative to a base coordinate.

boxLayout :: PropertyParser x => PaddedBox Double Double -> LayoutItem Length Length x -> Bool -> [LayoutItem Double Double ((Double, Double), x)] Source #

Compute sizes & position information for all nodes in the (sub)tree.

glyphsPerFont :: LayoutItem x y z -> Map (Pattern, Double) IntSet Source #

Compute a mapping from a layout tree indicating which glyphs for which fonts are required. Useful for assembling glyph atlases.