|
| Graphics.PDF.Typesetting | | Portability | portable | | Stability | experimental | | Maintainer | misc@NOSPAMalpheccar.org |
|
|
|
|
|
| Description |
| Experimental typesetting. It is a work in progress
|
|
| Synopsis |
|
|
|
|
| Typesetting
|
|
| Types
|
|
| class Box a where |
| A box is an object with dimensions and used in the typesetting process
| | | Methods | | boxWidth | | :: a | Box
| | -> PDFFloat | Width of the box
| | Box width
|
| | | boxHeight :: a -> PDFFloat | | Box height
| | | boxDescent :: a -> PDFFloat | | Distance between box bottom and box baseline
| | | boxAscent :: a -> PDFFloat | | Distance between box top and box baseline
|
| | Instances | |
|
|
| class DisplayableBox a where |
| A box that can be displayed
| | | Methods | | strokeBox | | :: a | The box
| | -> PDFFloat | Horizontal position
| | -> PDFFloat | Vertical position (top of the box and NOT baseline)
| | -> Draw () | | | Draw a box
|
|
| | Instances | |
|
|
| class Style a where |
| Style of text (sentences and words)
| | | Methods | | sentenceStyle | | :: a | The style
| | -> Maybe (Rectangle -> Draw b -> Draw ()) | Function receiving the bounding rectangle and the command for drawing the sentence
| | Modify the look of a sentence (sequence of words using the same style on a line)
|
| | | wordStyle | | | | textStyle :: a -> TextStyle | | | styleCode :: a -> Int | | All styles used in a document must have different style codes
| | | updateStyle :: a -> a | | A style may contain data changed from word to word
| | | styleHeight :: a -> PDFFloat | | A style may change the height of words
| | | styleDescent :: a -> PDFFloat | | A style may change the descent of lines
|
| | Instances | |
|
|
| data TextStyle |
| 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 | |
|
|
| data StyleFunction |
| 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 | |
|
|
| data AnyStyle |
| Any sentence style
| Instances | |
|
|
| class ParagraphStyle a where |
| Paragraph style
| | | Methods | | lineWidth | | :: a | The style
| | -> PDFFloat | Width of the text area used by the typesetting algorithm
| | -> Int | Line number
| | -> PDFFloat | Line width
| | Width of the line of the paragraph
|
| | | linePosition | | :: 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
| | Horizontal shift of the line position relatively to the left egde of the paragraph bounding box
|
| | | paraStyleCode | | :: a | The style
| | -> Int | Code identifying the style
| | All paragraph styles used in a document must have different codes
|
| | | interline | | :: a | The style
| | -> Maybe (Rectangle -> Draw ()) | Function used to style interline glues
| | How to style the interline glues added in a paragraph by the line breaking algorithm
|
| | | paraChange | | :: a | The style
| | -> [Letter] | List of letters in the paragraph
| | -> (a, [Letter]) | Update style and list of letters
| | Change the content of a paragraph before the line breaking algorithm is run. It may also change the style
|
| | | paragraphStyle | | :: a | The style
| | -> Maybe (Rectangle -> Draw b -> Draw ()) | Function used to style a paragraph
| | Get the paragraph bounding box and the paragraph draw command to apply additional effects
|
|
| | Instances | |
|
|
| data AnyParagraphStyle |
| Any paragraph style
| Instances | |
|
|
| class Monad m => MonadStyle m where |
| A MonadStyle where some typesetting operators can be used
| | | Methods | | setStyle :: Style a => a -> m () | | Set the current text style
| | | currentStyle :: m AnyStyle | | Get the current text style
| | | addBox | | | | glue | | :: 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
|
| | | unstyledGlue | | :: 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 | |
|
|
| data Letter |
| 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 | |
|
|
| type BoxDimension = (PDFFloat, PDFFloat, PDFFloat) |
| Dimension of a box : width, height and descent
|
|
| Functions
|
|
| Text display
|
|
| displayFormattedText |
| :: (Style s, ParagraphStyle s') | | | => Rectangle | Text area
| | -> s' | default vertical style
| | -> s | Default horizontal style
| | -> TM 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
|
|
| endParagraph |
| :: Bool | True if we use the same style to end a paragraph. false for an invisible style
| | -> Para () | | | End the current paragraph with or without using the same style
|
|
|
| txt :: String -> Para () |
Add a null char
nullChar :: Para ()
nullChar = Para . tell $ [nullLetter]
Add a text line
|
|
| paragraph :: Para a -> TM a |
| Add a new paragraph to the text
|
|
| Paragraph construction operators
|
|
| kern :: PDFFloat -> Para () |
| add a kern (space that can be dilated or compressed and on which no line breaking can occur)
|
|
| addPenalty :: Int -> Para () |
| Add a penalty
|
|
| mkLetter |
|
|
| Misc
|
|
| mkDrawBox :: Draw () -> DrawBox |
| Make a drawing box. A box object containing a Draw value
|
|
| Settings (similar to TeX ones)
|
|
| Line breaking settings
|
|
| setFirstPassTolerance :: PDFFloat -> TM () |
|
| setSecondPassTolerance :: PDFFloat -> TM () |
|
| setHyphenPenaltyValue :: Int -> TM () |
|
| setFitnessDemerit :: PDFFloat -> TM () |
|
| setHyphenDemerit :: PDFFloat -> TM () |
|
| setLinePenalty :: PDFFloat -> TM () |
|
| getFirstPassTolerance :: TM PDFFloat |
|
| getSecondPassTolerance :: TM PDFFloat |
|
| getHyphenPenaltyValue :: TM Int |
|
| getFitnessDemerit :: TM PDFFloat |
|
| getHyphenDemerit :: TM PDFFloat |
|
| getLinePenalty :: TM PDFFloat |
|
| Vertical mode settings
|
|
| setBaseLineSkip :: PDFFloat -> PDFFloat -> PDFFloat -> TM () |
|
| setLineSkipLimit :: PDFFloat -> TM () |
|
| setLineSkip :: PDFFloat -> PDFFloat -> PDFFloat -> TM () |
|
| getBaseLineSkip :: TM (PDFFloat, PDFFloat, PDFFloat) |
|
| getLineSkipLimit :: TM PDFFloat |
|
| getLineSkip :: TM (PDFFloat, PDFFloat, PDFFloat) |
|
| Styles
|
|
| Functions useful to change the paragraph style
|
|
| getParaStyle :: TM AnyParagraphStyle |
| Get the current paragraph style
|
|
| setParaStyle :: ParagraphStyle s => s -> TM () |
| Change the current paragraph style
|
|
| getTextArea :: TM Rectangle |
| Get the bounding rectangle containing the text
|
|
| Produced by Haddock version 0.8 |