Add the PDF generator snippets

This commit is contained in:
2023-11-10 11:57:08 +01:00
parent 57478f8362
commit 82ecf51fea
6 changed files with 342 additions and 8 deletions

View File

@ -16,10 +16,11 @@ import Graphics.Fountainhead.Parser
)
import Graphics.Fountainhead.TrueType (FontDirectory(..), TableDirectory(..))
import System.Environment (getArgs)
import System.Exit (exitWith)
import GHC.IO.Exception (ExitCode(..))
fontMain :: IO ()
fontMain = do
fontFile <- head <$> getArgs
fontMain :: FilePath -> IO ()
fontMain fontFile = do
ttfContents <- ByteString.readFile fontFile
let initialState = Megaparsec.State
@ -43,4 +44,9 @@ fontMain = do
Right x -> print x
main :: IO ()
main = fontMain
main = do
programArguments <- getArgs
case programArguments of
[fontFile] -> fontMain fontFile
_ -> putStrLn "The program expects exactly one argument, the font file path."
>> exitWith (ExitFailure 2)