Safe Haskell | None |
---|---|
Language | Haskell2010 |
Generic functions for manipulating paragraph layout.
In order to create such paragraph layout in the first place, see Data.Text.ParagraphLayout.Rich for the rich text interface, or Data.Text.ParagraphLayout.Plain for the legacy plain text interface.
Positions and distances are represented as 32-bit integers. Their unit must
be defined by the caller, who must calculate the desired dimensions of the
EM square of the input font and set them using
optionScale
.
For example, if 1em = 20px
, if the output pixels are square, and if the
output coordinates are in 1/64ths of a pixel, you should set the scale to
.Just
(1280, 1280)
X coordinates increase from left to right.
Y coordinates increase from bottom to top.
Synopsis
- data PageContinuity
- data PageOptions = PageOptions {
- pageCurrentHeight :: Int32
- pageNextHeight :: Int32
- pageOrphans :: Word
- pageWidows :: Word
- class Paginable pl
- paginate :: Paginable pl => PageOptions -> pl -> (PageContinuity, pl, Maybe pl)
Documentation
data PageContinuity #
Represents the best place to place a chunk of paginated content.
Continue | The content is split so that a given chunk can continue on the same page as its preceding context. This may be because all constraints were met, or because adding a page break would have no benefit. |
Break | The content is split so that a given chunk should begin on a new page. This may be because the current page does not have enough space to preserve orphan/widow constrains, or because it does not have space for any content at all. |
Instances
data PageOptions #
Defines options for breaking a layout into pages.
PageOptions | |
|
Typeclass for layouts that can be broken into pages.
Instances
LineHeight a => Paginable [a] | Internal implementation of paginating a simple list of generic lines. |
Defined in Data.Text.ParagraphLayout.Internal.Paginable paginate :: PageOptions -> [a] -> (PageContinuity, [a], Maybe [a]) # | |
Paginable (ParagraphLayout d) | Implementation of paginating a plain text paragraph layout. Breaks the layout on page boundaries and automatically adjusts coordinates. |
Defined in Data.Text.ParagraphLayout.Internal.Paginable paginate :: PageOptions -> ParagraphLayout d -> (PageContinuity, ParagraphLayout d, Maybe (ParagraphLayout d)) # | |
Paginable (ParagraphLayout d) | Implementation of paginating a rich text paragraph layout. Breaks the layout on page boundaries and automatically adjusts coordinates. |
Defined in Data.Text.ParagraphLayout.Internal.Paginable paginate :: PageOptions -> ParagraphLayout d -> (PageContinuity, ParagraphLayout d, Maybe (ParagraphLayout d)) # |
paginate :: Paginable pl => PageOptions -> pl -> (PageContinuity, pl, Maybe pl) #
Break a chunk of content from the given layout, to be placed together on a page.
Explanation of return values:
(
means thatContinue
, p,Nothing
)p
is the entire layout and fits best on the current page.(
means thatBreak
, p,Nothing
)p
is the entire layout and fits best on a new page. In other words,p
should be preceded by a page break.(
means thatContinue
, p,Just
rest)p
is a part of the layout that fits best on the current page, andrest
should be passed to this function again. In other words,p
should be followed by a page break.(
means thatBreak
, p,Just
rest)p
is a part of the layout that fits best on a new page, andrest
should be passed to this function again. In other words,p
should be surrounded by page breaks on both sides.