|
| Graphics.PDF.Typesetting | | Portability | portable | | Stability | experimental | | Maintainer | misc@NOSPAMalpheccar.org |
|
|
|
|
|
| Description |
| Experimental typesetting. It is a work in progress
|
|
| Synopsis |
|
| class Box a where | | | | class DisplayableBox a where | | | | | | type BoxDimension = (PDFFloat, PDFFloat, PDFFloat) | | | class ComparableStyle a => Style a where | | | | data TextStyle = TextStyle {} | | | | | class (ComparableStyle a, Style s) => ParagraphStyle a s | a -> s where | | | | class (Style s, Monad m) => MonadStyle s m | m -> s where | | | | class ComparableStyle a where | | | | data Para s a | | | data TM ps s a | | | data VBox ps s | | | data VerState s = VerState {} | | | data Container ps s | | | | | | | displayFormattedText :: ParagraphStyle ps s => Rectangle -> ps -> s -> TM ps s a -> Draw a | | | txt :: Style s => String -> Para s () | | | kern :: Style s => PDFFloat -> Para s () | | | addPenalty :: Int -> Para s () | | | mkLetter :: (Show a, Box a, DisplayableBox a) => BoxDimension -> Maybe s -> a -> Letter s | | | mkDrawBox :: Draw () -> DrawBox | | | forceNewLine :: Style s => Para s () | | | paragraph :: Style s => Para s a -> TM ps s a | | | endPara :: Style s => Para s () | | | startPara :: Style s => Para s () | | | getParaStyle :: TM ps s ps | | | setParaStyle :: ParagraphStyle ps s => ps -> TM ps s () | | | mkContainer :: PDFFloat -> PDFFloat -> PDFFloat -> PDFFloat -> PDFFloat -> Container ps s | | | fillContainer :: (ParagraphStyle ps s, ComparableStyle ps) => VerState ps -> Container ps s -> [VBox ps s] -> (Draw (), Container ps s, [VBox ps s]) | | | defaultVerState :: s -> VerState s | | | getBoxes :: ParagraphStyle ps s => ps -> s -> TM ps s a -> [VBox ps s] | | | containerX :: Container ps s -> PDFFloat | | | containerY :: Container ps s -> PDFFloat | | | containerWidth :: Container ps s -> PDFFloat | | | containerHeight :: Container ps s -> PDFFloat | | | containerContentHeight :: Container ps s -> PDFFloat | | | containerContentRightBorder :: Container ps s -> PDFFloat | | | containerContentLeftBorder :: Container ps s -> PDFFloat | | | containerCurrentHeight :: Container ps s -> PDFFloat | | | containerContentRectangle :: Container ps s -> Rectangle | | | drawTextBox :: (ParagraphStyle ps s, Style s) => PDFFloat -> PDFFloat -> PDFFloat -> PDFFloat -> Orientation -> ps -> s -> TM ps s a -> (Rectangle, Draw ()) | | | setFirstPassTolerance :: PDFFloat -> TM ps s () | | | setSecondPassTolerance :: PDFFloat -> TM ps s () | | | setHyphenPenaltyValue :: Int -> TM ps s () | | | setFitnessDemerit :: PDFFloat -> TM ps s () | | | setHyphenDemerit :: PDFFloat -> TM ps s () | | | setLinePenalty :: PDFFloat -> TM ps s () | | | getFirstPassTolerance :: TM ps s PDFFloat | | | getSecondPassTolerance :: TM ps s PDFFloat | | | getHyphenPenaltyValue :: TM ps s Int | | | getFitnessDemerit :: TM ps s PDFFloat | | | getHyphenDemerit :: TM ps s PDFFloat | | | getLinePenalty :: TM ps s PDFFloat | | | setJustification :: Justification -> TM ps s () | | | setBaseLineSkip :: PDFFloat -> PDFFloat -> PDFFloat -> TM ps s () | | | setLineSkipLimit :: PDFFloat -> TM ps s () | | | setLineSkip :: PDFFloat -> PDFFloat -> PDFFloat -> TM ps s () | | | getBaseLineSkip :: TM ps s (PDFFloat, PDFFloat, PDFFloat) | | | getLineSkipLimit :: TM ps s PDFFloat | | | getLineSkip :: TM ps s (PDFFloat, PDFFloat, PDFFloat) | | | data StandardStyle = Font PDFFont Color Color | | | data StandardParagraphStyle = NormalParagraph |
|
|
|
| Types
|
|
| Boxes
|
|
|
| A box is an object with dimensions and used in the typesetting process
| | | Methods | | | Instances | |
|
|
| class DisplayableBox a where | Source |
|
| A box that can be displayed
| | | Methods | | | :: a | The box
| | -> PDFFloat | Horizontal position
| | -> PDFFloat | Vertical position (top of the box and NOT baseline)
| | -> Draw () | |
|
| | Instances | |
|
|
|
| A letter which can be anything. Sizes are widths and for glue the dilation and compression factors
For the generic letter, height and descent are also provided
| | Constructors | | Instances | |
|
|
|
| Dimension of a box : width, height and descent
|
|
| Styles
|
|
|
| Style of text (sentences and words). Minimum definition textStyle
| | | Methods | | | :: | | | => a | The style
| | -> Maybe (Rectangle -> Draw b -> Draw ()) | Function receiving the bounding rectangle and the command for drawing the sentence
|
| | | | | | | | | | | |
| | Instances | |
|
|
|
| Text style used by PDF operators
| | Constructors | | TextStyle | | | textFont :: !PDFFont | | | textStrokeColor :: !Color | | | textFillColor :: !Color | | | textMode :: !TextMode | | | penWidth :: !PDFFloat | | | scaleSpace :: !PDFFloat | Scaling factor for normal space size (scale also the dilation and compression factors)
| | scaleDilatation :: !PDFFloat | Scale the dilation factor of glues
| | scaleCompression :: !PDFFloat | Scale the compression factor of glues
|
|
| Instances | |
|
|
|
| What kind of style drawing function is required for a word
when word styling is enabled
| | Constructors | | DrawWord | Must style a word
| | DrawGlue | Must style a glue
|
| Instances | |
|
|
|
| Paragraph style
| | | Methods | | | :: a | The style
| | -> PDFFloat | Width of the text area used by the typesetting algorithm
| | -> Int | Line number
| | -> PDFFloat | Line width
|
| | | | :: a | The style
| | -> PDFFloat | Width of the text area used by the typesetting algorithm
| | -> Int | Line number
| | -> PDFFloat | Horizontal offset from the left edge of the text area
|
| | | | | | | :: a | The style
| | -> Int | Line offset different from 0 when a paragraph has been broken
| | -> [Letter s] | List of letters in the paragraph
| | -> (a, [Letter s]) | Update style and list of letters
|
| | | |
| | Instances | |
|
|
|
| A MonadStyle where some typesetting operators can be used
| | | Methods | | | Set the current text style
| | | | Get the current text style
| | | | | | | :: PDFFloat | Size of glue (width or height depending on the mode)
| | -> PDFFloat | Dilatation factor
| | -> PDFFloat | Compression factor
| | -> m () | | | Add a glue using the current style
|
| | | | :: PDFFloat | Size of glue (width or height depending on the mode)
| | -> PDFFloat | Dilatation factor
| | -> PDFFloat | Compression factor
| | -> m () | | | Add a glue with no style (it is just a translation)
|
|
| | Instances | |
|
|
| class ComparableStyle a where | Source |
|
| Used to compare two style without taking into account the style state
| | | Methods | | | Instances | |
|
|
| Typesetting monads
|
|
|
Instances | |
|
|
|
Instances | |
|
|
| Containers
|
|
|
Instances | |
|
|
|
|
|
|
| Container for vboxes (x,y,width,maxheight,height,currenty,current z, tolerance para)
tolerance para means a paragraph is not started if too close from the bottom edge of the box
|
|
|
|
| Constructors | | FullJustification | | | Centered | | | LeftJustification | | | RightJustification | |
| Instances | |
|
|
|
| Constructors | | Instances | |
|
|
| Functions
|
|
| Text display
|
|
|
| :: ParagraphStyle ps s | | | => Rectangle | Text area
| | -> ps | default vertical style
| | -> s | Default horizontal style
| | -> TM ps s a | Typesetting monad
| | -> Draw a | Draw monad
| | Display a formatted text in a given bounding rectangle with a given default paragraph style, a given default text style. No clipping
is taking place. Drawing stop when the last line is crossing the bounding rectangle in vertical direction
|
|
|
| Text construction operators
|
|
|
| Add a text line
|
|
|
| add a kern (space that can be dilated or compressed and on which no line breaking can occur)
|
|
|
| Add a penalty
|
|
|
|
|
|
| Make a drawing box. A box object containing a Draw value
|
|
| Paragraph construction operators
|
|
|
| For a newline and end the current paragraph
|
|
|
| Add a new paragraph to the text
|
|
|
|
|
|
| Functions useful to change the paragraph style
|
|
|
| Get the current paragraph style
|
|
|
| Change the current paragraph style
|
|
| Container
|
|
|
|
|
|
|
|
|
Default vertical state
Default values
baselineskip = (12,0.17,0.0)
lineskip = (3.0,0.33,0.0)
lineskiplimit = 2
|
|
|
| :: ParagraphStyle ps s | | | => ps | default vertical style
| | -> s | Default horizontal style
| | -> TM ps s a | Typesetting monad
| | -> [VBox ps s] | List of boxes
| | Return the list of Vboxes for a text
|
|
|
|
| Container horizontal position
|
|
|
| Container vertical position
|
|
|
| Get the width of the container
|
|
|
| Get the height of the container
|
|
|
| Get the content height of the container with glue dilatation
|
|
|
| Get the maximum right border of the container content (maybe bigger than container width due to overfull lines)
|
|
|
| Get the minimum left border of the container content
|
|
|
| Get the current height of the container without glue dilatation
|
|
|
| Return the rectangle containing the text after formatting and glue dilatation
|
|
|
|
|
| Settings (similar to TeX ones)
|
|
| Line breaking settings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Vertical mode settings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Styles
|
|
|
| Standard styles for sentences
| | Constructors | | Instances | |
|
|
| data StandardParagraphStyle | Source |
|
| Standard styles for paragraphs
| | Constructors | | Instances | |
|
|
| Produced by Haddock version 2.3.0 |