diff options
| author | Eugen Wissner <belka@caraus.de> | 2024-02-04 11:07:15 +0100 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2024-02-04 11:07:15 +0100 |
| commit | 3160ceab080fca8fef0cf2cf196b46284d15c19f (patch) | |
| tree | e9849111325d8431b39618f190a2f0f7a570945f /app/Main.hs | |
| parent | a34b46e1b553623d5dc385fc8e235df808fbadb2 (diff) | |
| download | fountainhead-3160ceab080fca8fef0cf2cf196b46284d15c19f.tar.gz | |
Create a Metrics module
Diffstat (limited to 'app/Main.hs')
| -rw-r--r-- | app/Main.hs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/app/Main.hs b/app/Main.hs deleted file mode 100644 index b79acaa..0000000 --- a/app/Main.hs +++ /dev/null @@ -1,53 +0,0 @@ -module Main - ( main - ) where - -import qualified Data.Text.Lazy.Builder as Text.Builder -import qualified Data.Text.Lazy.IO as Text.Lazy -import Graphics.Fountainhead (dumpFontFile) -import System.Exit (exitWith) -import GHC.IO.Exception (ExitCode(..)) -import Options.Applicative - ( Parser - , ParserInfo(..) - , argument - , command - , execParser - , info - , fullDesc - , metavar - , progDesc - , str - , subparser - ) - -data Operation - = Dump FilePath - | Afm FilePath - deriving (Eq, Show) - -dump :: Parser Operation -dump = Dump - <$> argument str (metavar "FONTFILE") - -afm :: Parser Operation -afm = Afm - <$> argument str (metavar "FONTFILE") - -operationOptions :: ParserInfo Operation -operationOptions = info commands fullDesc - where - commands = subparser - $ command "dump" (info dump (progDesc "Dumping the contents of a TrueType Font file")) - <> command "afm" (info afm (progDesc "Generating Adobe Font Metrics files for TrueType fonts")) - -main :: IO () -main = execParser operationOptions >>= handleArguments - where - handleArguments (Dump fontFile) - = putStrLn ("Dumping File:" <> fontFile <> "\n\n") - >> dumpFontFile fontFile - >>= either print (Text.Lazy.putStrLn . Text.Builder.toLazyText) - handleArguments (Afm _) - = putStrLn "The program expects exactly one argument, the font file path." - >> exitWith (ExitFailure 2) |
