Safe Haskell | None |
---|---|
Language | Haskell2010 |
A simple layout engine to render text (and later also mathematics).
Synopsis
- subSuperSize :: Double
- superPos :: Double
- subPos :: Double
- data Document ident
- newtype SizeIndex = SizeIndex Int
- mfgRelBox :: MultiFontGlyph -> Box
- data Layout ident style
- translateLayout :: Pos -> Layout ident style -> Layout ident style
- renderLayout :: Ord ident => Layout ident style -> Pos -> IO ()
- dryrunLayout :: Ord ident => Layout ident style -> Pos -> IO (Map ident AbsBox)
- renderLayout' :: forall ident style. Ord ident => Bool -> Layout ident style -> Pos -> IO (Map ident AbsBox)
- createLayout :: forall fontfile style ident. (Ord fontfile, Ord ident) => MultiFont fontfile style -> Height -> Document ident -> IO (Layout ident style)
- data Cfg = Cfg {
- _currentSize :: !SizeIndex
- _currentStyle :: !BasicStyle
- _currentColor :: !Col
- defaultCfg :: Cfg
- createLayout' :: forall fontfile style ident. (Ord fontfile, Ord ident) => MultiFont fontfile style -> Height -> Document ident -> IO (Box, Layout ident style)
Documentation
subSuperSize :: Double Source #
Subscript / superscript relative sizes
This data type describes what the user want to render.
The type parameter ident
is used when the user want to know positions (bounding boxes) of
different parts of the rendered text. It must have an Ord
instance.
Symbol !Char | |
String !String | |
Space | |
HorzCat !VAlign [Document ident] | |
VertCat !HAlign [Document ident] | |
WithColor !Col !(Document ident) | |
WithStyle !BasicStyle !(Document ident) | |
Identified !ident !(Document ident) | user identifier so that the layout engine can return position information |
Instances
Eq ident => Eq (Document ident) Source # | |
Ord ident => Ord (Document ident) Source # | |
Defined in Graphics.Rendering.MiniTypeset.Layout compare :: Document ident -> Document ident -> Ordering # (<) :: Document ident -> Document ident -> Bool # (<=) :: Document ident -> Document ident -> Bool # (>) :: Document ident -> Document ident -> Bool # (>=) :: Document ident -> Document ident -> Bool # | |
Show ident => Show (Document ident) Source # | |
0 is the default size, 1 is smaller, 2 is even smaller, etc (each subscript
mfgRelBox :: MultiFontGlyph -> Box Source #
data Layout ident style Source #
This data type is the output of the layout engine. The `identifying'
part
is retained, because everything is still relative, and only during the rendering
will positions become absolute. See dryrunLayout
LoutGlyph Pos style Col Char MultiFontGlyph | |
LoutGroup Box [Layout ident style] | |
LoutOfs Pos (Layout ident style) | |
LoutIdent ident (Layout ident style) | |
LoutEmpty |
renderLayout :: Ord ident => Layout ident style -> Pos -> IO () Source #
Renders the layout to the OpenGL framebuffer.
Note: you should set up the OpenGL coordinate transformation matrices so that the coordinate system is screen-space, measured in pixels. For example something like
matrixMode $= Projection loadIdentity ortho 0 xres yres 0 (-1) 1 matrixMode $= Modelview 0 loadIdentity
should do.
dryrunLayout :: Ord ident => Layout ident style -> Pos -> IO (Map ident AbsBox) Source #
Does not actually render, but computes the bounding boxes of the identified parts of the layout.
createLayout :: forall fontfile style ident. (Ord fontfile, Ord ident) => MultiFont fontfile style -> Height -> Document ident -> IO (Layout ident style) Source #
Creates a layout from a document. Then you can render the resulting layout
with renderLayout
Cfg | |
|
defaultCfg :: Cfg Source #