termtab-0.1.0.0: TUI guitar tablature and score editor
Safe HaskellNone
LanguageGHC2021

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

Documentation

data GlyphFont Source #

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.

openGlyphFont :: FilePath -> IO GlyphFont Source #

Load a font face and start an empty glyph cache.

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.