| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
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
- stdFontTextureSize :: Int -> (Int, Int)
 - data UserFontConfig fontfile style = UserFontConfig {
- _ufcFontFiles :: fontfile -> FilePath
 - _ufcCharMap :: style -> Char -> fontfile
 - _ufcStyleMap :: BasicStyle -> style
 
 - data MultiFont fontfile style = MultiFont {
- _mfUserConfig :: !(UserFontConfig fontfile style)
 - _mfFontTexs :: !(IORef (Map fontfile (IntMap FontTexture)))
 
 - mfCharMap :: MultiFont fontfile style -> style -> Char -> fontfile
 - newMultiFont :: Ord fontfile => UserFontConfig fontfile style -> IO (MultiFont fontfile style)
 - loadFontFile :: FilePath -> IO Font
 - mapInsert :: Ord k => a -> (a -> a) -> k -> Map k a -> Map k a
 - mapIntLookup :: Ord k => k -> Int -> Map k (IntMap a) -> Maybe a
 - mfAddNewFontTex :: Ord fontfile => MultiFont fontfile style -> (fontfile, Int) -> IO ()
 - data MultiFontGlyph = MFG !FontTexture !BufLoc
 - lkpMultiFont :: Ord fontfile => MultiFont fontfile style -> Int -> style -> Char -> IO MultiFontGlyph
 
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 
  | |
newMultiFont :: Ord fontfile => UserFontConfig fontfile style -> IO (MultiFont fontfile style) Source #
Multifont glyphs
data MultiFontGlyph Source #
Constructors
| MFG !FontTexture !BufLoc | 
Instances
| Show MultiFontGlyph Source # | |
Defined in Graphics.Rendering.MiniTypeset.MultiFont Methods showsPrec :: Int -> MultiFontGlyph -> ShowS # show :: MultiFontGlyph -> String # showList :: [MultiFontGlyph] -> ShowS #  | |
lkpMultiFont :: Ord fontfile => MultiFont fontfile style -> Int -> style -> Char -> IO MultiFontGlyph Source #