Add the PDF generator snippets
This commit is contained in:
14
app/Main.hs
14
app/Main.hs
@ -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)
|
||||
|
Reference in New Issue
Block a user