From 294c8e19b136f06ca7fa1bb4e4d109e90e2bb033 Mon Sep 17 00:00:00 2001
From: Ben Sima <ben@bsima.me>
Date: Sat, 23 Nov 2019 16:38:47 -0800
Subject: Add Com.MusicMeetsComics

---
 Com/MusicMeetsComics/Look/Typography.hs | 89 +++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Com/MusicMeetsComics/Look/Typography.hs

(limited to 'Com/MusicMeetsComics/Look')

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"
-- 
cgit v1.2.3