Dump cmap encodings

This commit is contained in:
2023-11-12 10:13:38 +01:00
parent 1d4efb44bb
commit 6923bceaa5
2 changed files with 45 additions and 25 deletions

View File

@ -38,29 +38,10 @@ fontMain fontFile = do
putStrLn $ "Dumping File:" <> fontFile <> "\n\n"
ttfContents <- ByteString.readFile fontFile
let initialState = Megaparsec.State
{ stateInput = ttfContents
, stateOffset = 0
, statePosState = Megaparsec.PosState
{ pstateInput = ttfContents
, pstateOffset = 0
, pstateSourcePos = Megaparsec.initialPos fontFile
, pstateTabWidth = Megaparsec.defaultTabWidth
, pstateLinePrefix = ""
}
, stateParseErrors = []
}
(processedState, initialResult) = Megaparsec.runParser' fontDirectoryP initialState
case initialResult >>= dumpTrueType processedState of
case dumpTrueType ttfContents fontFile of
(Right fontDump) -> Text.Lazy.putStrLn $ Text.Builder.toLazyText fontDump
Left e -> putStr (Megaparsec.errorBundlePretty e)
{-
let Just tableDirectory' = find (("OS/2" ==) . tag) $ tableDirectory directory
tableResult = parseTable tableDirectory' os2TableP processedState
case tableResult of
Right x -> print x -}
main :: IO ()
main = do