M haphaestus.cabal => haphaestus.cabal +1 -1
@@ 25,7 25,7 @@ executable haphaestus
                        xml-conduit, containers,
                        stylist >= 2.5, stylist-traits, css-syntax, xml-conduit-stylist >=3,
                        text >= 2, bytestring,
-                       cattrap >= 0.1 && <0.2,
+                       cattrap >= 0.1 && <0.2, fontconfig-pure,
                        sdl2 >= 2.5.4, gl, mtl
   hs-source-dirs:      src
   default-language:    Haskell2010
 
M src/Main.hs => src/Main.hs +9 -6
@@ 30,8 30,9 @@ import           Data.HTML2CSS (el2stylist)
 
 import           Graphics.Layout.CSS (CSSBox(..), finalizeCSS')
 import           Graphics.Layout.CSS.Internal (placeholderFont)
-import           Graphics.Layout.Box (zeroBox, PaddedBox(..), Size(..))
+import           Graphics.Layout.Box as B (zeroBox, PaddedBox(..), Size(..))
 import           Graphics.Layout (boxLayout)
+import           Graphics.Text.Font.Choose (nameParse)
 
 import SDL hiding (rotate)
 import Graphics.GL.Core32
@@ 119,7 120,7 @@ main = do
         appName = "haphaestus"
     }
 
-    [arg] <- getArgs
+    [arg, scale'] <- getArgs
     let uri = nullURI `fromMaybe` parseURIReference arg `relativeTo` pageURL referer
     page <- fetchDocument sess referer uri
 
@@ 130,10 131,6 @@ main = do
     let style = CSSTxt.resolve $ inlinePseudos' $ stylize css' $ el2stylist $
             documentRoot $ html page
 
-    let outerbox = zeroBox -- FIXME: Parameterize!
-    let sysfont = placeholderFont -- FIXME: Parameterize!
-    let layout = boxLayout zeroBox (finalizeCSS' sysfont style) False
-
     SDL.initializeAll
     let openGL = defaultOpenGL { glProfile = Core Debug 3 3 }
         wcfg = defaultWindow {
@@ 152,6 149,12 @@ main = do
         sz@(V2 dw dh) <- glGetDrawableSize w
         glViewport 0 0 (fromIntegral dw) (fromIntegral dh)
 
+        let size = B.Size (fromIntegral dw) (fromIntegral dh)
+        let outerbox = zeroBox { B.min = size, B.size = size, B.max = size }
+        let sysfont = (pattern2font (nameParse "serif-12") temp
+                       placeholderFont placeholderfont) { scale = read scale' }
+        let layout = boxLayout outerbox (finalizeCSS' sysfont style) False
+
         glSwapWindow w
         unless (QuitEvent `elem` events) loop
     return ()