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

Safe HaskellNone
LanguageHaskell2010

Graphics.Rendering.MiniTypeset.MultiFont

Contents

Description

Typically, we use multiple fonts to compose a document. Some examples for this are:

  • bold, italic, etc typefaces as separate font files
  • greek, cyrillic and other non-latin alphabets
  • a monospace font
  • mathematical symbols

We can also use different font sizes, for example subscript, superscript, etc.

This module provides a layer on the top FontTexture to support this.

For a good trade-off between simplicity and generality, we opt to encode a glyph as a Unicode code point together with a user-defined style attribute, and let the user provide a mapping from this to different physical font files.

Synopsis

Documentation

stdFontTextureSize :: Int -> (Int, Int) Source #

given a font height (in pixels), we return how big texture(s) should we allocate for this

data UserFontConfig fontfile style Source #

The user-defined types fontfile and style should encode the available font files and styles. They should be an enumerated type for efficiency. fontfile must have Eq and Ord instances, too.

Constructors

UserFontConfig 

Fields

data MultiFont fontfile style Source #

Constructors

MultiFont 

Fields

mfCharMap :: MultiFont fontfile style -> style -> Char -> fontfile Source #

newMultiFont :: Ord fontfile => UserFontConfig fontfile style -> IO (MultiFont fontfile style) Source #

mapInsert :: Ord k => a -> (a -> a) -> k -> Map k a -> Map k a Source #

mapIntLookup :: Ord k => k -> Int -> Map k (IntMap a) -> Maybe a Source #

mfAddNewFontTex :: Ord fontfile => MultiFont fontfile style -> (fontfile, Int) -> IO () Source #

Multifont glyphs

lkpMultiFont :: Ord fontfile => MultiFont fontfile style -> Int -> style -> Char -> IO MultiFontGlyph Source #