Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- _ufcLineGapFactor :: !Double
- data MultiFont fontfile style = MultiFont {
- _mfUserConfig :: !(UserFontConfig fontfile style)
- _mfFontTexs :: !(IORef (Map fontfile (IntMap FontTexture)))
- mfCharMap :: MultiFont fontfile style -> style -> Char -> fontfile
- mfLineGapFactor :: MultiFont fontfile style -> Double
- 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
- encodeXYHeight :: (Int, Int) -> Int
- mfAddNewFontTex :: Ord fontfile => MultiFont fontfile style -> (fontfile, (Int, Int)) -> IO ()
- data MultiFontGlyph = MFG !FontTexture !BufLoc
- mfgLineGapFactor :: MultiFontGlyph -> Double
- lkpMultiFont :: Ord fontfile => MultiFont fontfile style -> Int -> style -> Char -> IO MultiFontGlyph
- lkpMultiFont' :: Ord fontfile => MultiFont fontfile style -> (Int, 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.
UserFontConfig | |
|
data MultiFont fontfile style Source #
MultiFont | |
|
mfLineGapFactor :: MultiFont fontfile style -> Double Source #
newMultiFont :: Ord fontfile => UserFontConfig fontfile style -> IO (MultiFont fontfile style) Source #
mfAddNewFontTex :: Ord fontfile => MultiFont fontfile style -> (fontfile, (Int, Int)) -> IO () Source #
Multifont glyphs
data MultiFontGlyph Source #
Instances
Show MultiFontGlyph Source # | |
Defined in Graphics.Rendering.MiniTypeset.MultiFont showsPrec :: Int -> MultiFontGlyph -> ShowS # show :: MultiFontGlyph -> String # showList :: [MultiFontGlyph] -> ShowS # |
lkpMultiFont :: Ord fontfile => MultiFont fontfile style -> Int -> style -> Char -> IO MultiFontGlyph Source #
lkpMultiFont' :: Ord fontfile => MultiFont fontfile style -> (Int, Int) -> style -> Char -> IO MultiFontGlyph Source #