module Data.Text.ParagraphLayout.FontLoader (loadUbuntuRegular) where import Data.ByteString (readFile) import Data.Text.Glyphize (Font ,FontOptions(optionPPEm, optionScale) ,createFace ,createFontWithOptions ,defaultFontOptions ) import Prelude (IO, Int, Maybe(Just), String, Word, return) import System.FilePath (()) ubuntuRegularPath :: String ubuntuRegularPath = "assets" "fonts" "ubuntu" "Ubuntu-R.ttf" -- TODO: Figure out if this affects hinting! testingPixelSize :: (Word, Word) testingPixelSize = (24, 24) -- This controls the output units. -- The default is "unscaled", which uses the value of `faceUpem` in both axes. testingScale :: (Int, Int) testingScale = (1000, 1000) loadUbuntuRegular :: IO Font loadUbuntuRegular = do ttf <- readFile ubuntuRegularPath let face = createFace ttf 0 let font = createFontWithOptions (defaultFontOptions { optionPPEm = Just testingPixelSize, optionScale = Just testingScale }) face return font