Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |
Font load monad handling IO (file system access), failure and logging.
- data FontLoadIO a
- runFontLoadIO :: FontLoadIO a -> IO (Either FontLoadMsg a, FontLoadLog)
- evalFontLoadIO :: FontLoadIO a -> IO (Either FontLoadMsg a)
- loadError :: FontLoadMsg -> FontLoadIO a
- tellLoadMsg :: String -> FontLoadIO ()
- promoteIO :: IO a -> FontLoadIO a
- promoteEither :: Either FontLoadMsg a -> FontLoadIO a
- runParserFLIO :: FilePath -> Parser Char a -> FontLoadIO a
- sequenceAll :: [FontLoadIO a] -> FontLoadIO [a]
- buildAfmFontProps :: MonospaceDefaults AfmUnit -> AfmFile -> FontLoadIO (FontProps AfmUnit)
- checkFontPath :: FilePath -> FilePath -> FontLoadIO FilePath
Documentation
runFontLoadIO :: FontLoadIO a -> IO (Either FontLoadMsg a, FontLoadLog)Source
evalFontLoadIO :: FontLoadIO a -> IO (Either FontLoadMsg a)Source
loadError :: FontLoadMsg -> FontLoadIO aSource
tellLoadMsg :: String -> FontLoadIO ()Source
promoteIO :: IO a -> FontLoadIO aSource
Promote an IO
action into the the FontLoadIO
monad.
This function is equivalent to liftIO
.
promoteEither :: Either FontLoadMsg a -> FontLoadIO aSource
runParserFLIO :: FilePath -> Parser Char a -> FontLoadIO aSource
sequenceAll :: [FontLoadIO a] -> FontLoadIO [a]Source
The standard monadic sequence
would finish on first fail
for the FontLoadIO monad. As we want to be able to sequence
the loading of a list of fonts, this is not really the
behaviour we want for Wumpus. Instead we prefer to use fallback
metrics and produce an inaccurate drawing on a font load error
rather than fail and produce no drawing.
Font loading
buildAfmFontProps :: MonospaceDefaults AfmUnit -> AfmFile -> FontLoadIO (FontProps AfmUnit)Source
Afm files do not have a default advance vec so use the monospace default.
Afm files hopefully have CapHeight
and FontBBox
properties
in the header. Use the monospace default only if they are
missing.