diff options
author | Ben Sima <ben@bsima.me> | 2019-11-23 16:38:47 -0800 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2019-11-23 16:45:05 -0800 |
commit | 294c8e19b136f06ca7fa1bb4e4d109e90e2bb033 (patch) | |
tree | d8f56bdfc0451f9ad33e4ae396204bd0ba171d4d /Com/MusicMeetsComics/Look | |
parent | eb7e442d930bda88aac3c6aad0825b5aa4173e5e (diff) |
Add Com.MusicMeetsComics
Diffstat (limited to 'Com/MusicMeetsComics/Look')
-rw-r--r-- | Com/MusicMeetsComics/Look/Typography.hs | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/Com/MusicMeetsComics/Look/Typography.hs b/Com/MusicMeetsComics/Look/Typography.hs new file mode 100644 index 0000000..91e157a --- /dev/null +++ b/Com/MusicMeetsComics/Look/Typography.hs @@ -0,0 +1,89 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +module Com.MusicMeetsComics.Look.Typography where + +import Clay +import Clay.Stylesheet (key) +import qualified Com.MusicMeetsComics.Assets as Assets +import Com.Simatime.Alpha +import Data.Semigroup ((<>)) +import Protolude + +main :: Css +main = fonts + +--------------------------------------------------------------------------------- +-- font modifiers +--------------------------------------------------------------------------------- + +euro, slim, wide, thicc, thinn, norm, lean, + smol, lower, upper :: Css + +euro = fontFamily ["Eurostile"] [sansSerif] + +-- stretch +slim = fontStretch condensed +wide = fontStretch expanded + +-- weight +thicc = fontWeight bold +thinn = fontWeight normal + +-- style +norm = fontStyle normal +lean = fontStyle italic + +-- "smallcaps" is already taken by Clay +smol = fontVariant smallCaps + +lower = textTransform lowercase +upper = textTransform uppercase + +--------------------------------------------------------------------------------- +-- font sizing +--------------------------------------------------------------------------------- + +-- | apparently "coat" is a synonym for "size" +coat :: Double -> Css +coat = fontSize . Clay.rem + +--------------------------------------------------------------------------------- +-- font faces +--------------------------------------------------------------------------------- + +fontRoot :: Text +fontRoot = Assets.cdnEdge <> "/old-assets/fonts/eurostile/Eurostile" + +fonts :: Css +fonts = mconcat $ mkEuro /@ + [ ("-Reg.otf", OpenType, fontWeight normal <> fontStyle normal) + , ("LTStd-Bold.otf", OpenType, thicc <> norm) + , ("LTStd-Cn.otf", OpenType, slim <> norm) + , ("LTStd-Ex2.otf", OpenType, wide <> norm) + , ("LTStd-BoldCn.otf", OpenType, slim <> thicc) + , ("LTStd-BoldEx2.otf", OpenType, wide <> thicc) + ] + where + mkEuro :: (Text, FontFaceFormat, Css) -> Css + mkEuro (sufx, fmt, extra) = fontFace $ do + fontFamily ["Eurostile"] [] + fontFaceSrc [FontFaceSrcUrl (fontRoot <> sufx) $ Just fmt] + extra + + +--------------------------------------------------------------------------------- +-- TODO: add the below to Clay.Font upstream +--------------------------------------------------------------------------------- + +newtype FontStretch = FontStretch Value + deriving (Val, Inherit, Normal, Other) + +expanded :: FontStretch +expanded = FontStretch "expanded" + +condensed :: FontStretch +condensed = FontStretch "condensed" + +fontStretch :: FontStretch -> Css +fontStretch = key "font-stretch" |