| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Termtab.Graphics.Font
Description
A Bravura font handle with a glyph rasterization cache.
Wraps the raw Termtab.Graphics.FreeType FFI: loads the face once and memoizes
rendered glyphs by (pixel-size, char) so the notation renderer never
re-rasterizes the same SMuFL glyph across frames. Failures (glyph not found)
are cached too, so a bad code point is only attempted once.
Synopsis
- data GlyphFont
- bravuraFontPath :: IO (Maybe FilePath)
- openGlyphFont :: FilePath -> IO GlyphFont
- withGlyphFont :: FilePath -> (GlyphFont -> IO a) -> IO a
- closeGlyphFont :: GlyphFont -> IO ()
- cachedGlyph :: GlyphFont -> Int -> Char -> IO (Maybe GlyphBitmap)
Documentation
An open font face plus its memoized glyph cache, keyed by
(pixel size, character) in cachedGlyph.
bravuraFontPath :: IO (Maybe FilePath) Source #
The configured Bravura font path (TERMTAB_BRAVURA_FONT), if any.
withGlyphFont :: FilePath -> (GlyphFont -> IO a) -> IO a Source #
Bracketed openGlyphFont / closeGlyphFont.
closeGlyphFont :: GlyphFont -> IO () Source #
Release the underlying face.
cachedGlyph :: GlyphFont -> Int -> Char -> IO (Maybe GlyphBitmap) Source #
Rasterize a glyph at the given pixel size, returning a cached result on
repeat calls. Nothing means FreeType could not render the code point.