minitypeset-opengl-0.1.0.0: Layout and render text with TrueType fonts using OpenGL

Safe HaskellNone
LanguageHaskell2010

Graphics.Rendering.MiniTypeset.Layout

Description

A simple layout engine to render text (and later also mathematics).

Synopsis

Documentation

subSuperSize :: Double Source #

Subscript / superscript relative sizes

data Document ident Source #

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.

Constructors

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 # 
Instance details

Defined in Graphics.Rendering.MiniTypeset.Layout

Methods

(==) :: Document ident -> Document ident -> Bool #

(/=) :: Document ident -> Document ident -> Bool #

Ord ident => Ord (Document ident) Source # 
Instance details

Defined in Graphics.Rendering.MiniTypeset.Layout

Methods

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 #

max :: Document ident -> Document ident -> Document ident #

min :: Document ident -> Document ident -> Document ident #

Show ident => Show (Document ident) Source # 
Instance details

Defined in Graphics.Rendering.MiniTypeset.Layout

Methods

showsPrec :: Int -> Document ident -> ShowS #

show :: Document ident -> String #

showList :: [Document ident] -> ShowS #

newtype SizeIndex Source #

0 is the default size, 1 is smaller, 2 is even smaller, etc (each subscript

Constructors

SizeIndex Int 

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

Constructors

LoutGlyph Pos style Col Char MultiFontGlyph 
LoutGroup Box [Layout ident style] 
LoutOfs Pos (Layout ident style) 
LoutIdent ident (Layout ident style) 
LoutEmpty 
Instances
(Show style, Show ident) => Show (Layout ident style) Source # 
Instance details

Defined in Graphics.Rendering.MiniTypeset.Layout

Methods

showsPrec :: Int -> Layout ident style -> ShowS #

show :: Layout ident style -> String #

showList :: [Layout ident style] -> ShowS #

Translate (Layout ident style) Source # 
Instance details

Defined in Graphics.Rendering.MiniTypeset.Layout

Methods

translate :: Pos -> Layout ident style -> Layout ident style Source #

translateLayout :: Pos -> Layout ident style -> Layout ident style Source #

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.

renderLayout' Source #

Arguments

:: Ord ident 
=> Bool

True = dryrun (do not render); False = do the rendering

-> 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) Source #

Creates a layout from a document. Then you can render the resulting layout with renderLayout

createLayout' :: forall fontfile style ident. (Ord fontfile, Ord ident) => MultiFont fontfile style -> Height -> Document ident -> IO (Box, Layout ident style) Source #