summaryrefslogtreecommitdiff
path: root/app/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/Main.hs b/app/Main.hs
index c2c9787..23a86b9 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -15,7 +15,7 @@ import qualified Data.Text.Lazy as Text.Lazy
import qualified Data.Text.Lazy.IO as Text.Lazy
import qualified Data.Text.Encoding as Text
import GHC.Records (HasField(..))
-import Graphics.Fountainhead.Dumper (dumpTrueType)
+import Graphics.Fountainhead.Dumper (DumpError(..), dumpTrueType)
-- TODO: kern table since format 1.
-- For details on subtable format see examples in TrueType reference.
import Graphics.Fountainhead.Parser
@@ -40,8 +40,12 @@ fontMain fontFile = do
ttfContents <- ByteString.readFile fontFile
case dumpTrueType ttfContents fontFile of
- (Right fontDump) -> Text.Lazy.putStrLn $ Text.Builder.toLazyText fontDump
- Left e -> putStr (Megaparsec.errorBundlePretty e)
+ Right fontDump -> Text.Lazy.putStrLn $ Text.Builder.toLazyText fontDump
+ Left e
+ | DumpParseError bundle <- e -> putStr
+ $ Megaparsec.errorBundlePretty bundle
+ | DumpRequiredTableMissingError tableName <- e -> putStr
+ $ "Required table " <> tableName <> " is missing."
main :: IO ()
main = do