add script to lántas pages

This commit is contained in:
Rhiannon Morris 2021-04-29 11:55:54 +02:00
parent ba5522187c
commit f61e5b1146
13 changed files with 332 additions and 143 deletions

View file

@ -1,5 +1,3 @@
{-# OPTIONS_GHC -fdefer-typed-holes #-}
import Prelude hiding (getContents, readFile, writeFile, putStrLn)
import Svg
import Glyphs (doGlyphs, lineHeight')
@ -13,8 +11,9 @@ import Data.Text.Lazy.IO (writeFile, putStrLn)
data Options =
Opts {
width, size, stroke :: {-# UNPACK #-} !Double,
inFile, outFile :: Maybe FilePath,
text :: Maybe Text
inFile, outFile :: Maybe FilePath,
text :: Maybe Text,
color :: Text
}
deriving Show
@ -29,6 +28,7 @@ options = execParser desc where
<*> filePath 'i' "input"
<*> filePath 'o' "output"
<*> text
<*> color
dimOpt s l d = dimOpt' s l l d
dimOpt' s l n d = option auto $ mconcat
[short s, long l, help $ n <> " in pixels", metavar "SIZE", value d]
@ -37,6 +37,9 @@ options = execParser desc where
text = optional $ option str $ mconcat
[short 't', long "text", help $ "use given text instead of a file",
metavar "TEXT"]
color = option str $ mconcat
[short 'C', long "color", help $ "set stroke color (any css syntax)",
metavar "COLOR", value "black"]
main :: IO ()
main = do