From 207dc7c39ecc2081b3cda8ca06989625af64b08c Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Wed, 23 Jan 2019 13:15:49 -0500 Subject: use system-installed font file --- axis.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/axis.hs b/axis.hs index 5363c36..3dd18ed 100644 --- a/axis.hs +++ b/axis.hs @@ -228,6 +228,9 @@ data Env = Env { _warpMouse :: IO () } +fontFile :: FilePath +fontFile = "/usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf" + main :: IO () main = withAlsaInit $ \h public private q publicAddr privateAddr -> do @@ -243,7 +246,7 @@ main = _ <- setVideoMode sWidth sHeight _ <- SDL.TTF.init - font <- SDL.TTF.openFont "LiberationMono-Bold.ttf" (chooseFontSize sWidth sHeight) + font <- SDL.TTF.openFont fontFile (chooseFontSize sWidth sHeight) -- _ <- SDL.showCursor False _ <- SDL.grabInput True warpMouse _ <- SDL.setRelativeMouseMode True -- -- SDL2. Should I use it? using the pixelFormat methods gives the wrong color, with both the real -- pixelFormat or the faked one, so fuck it. See colorToPixel let pixelFormat = @@ -261,7 +264,7 @@ setFont :: (MonadIO m, MonadState LoopState m) => (Int, Int) -> m () setFont resolution = do let (w, h) = resolution fontSize = chooseFontSize w h - font' <- liftIO $ SDL.TTF.openFont "LiberationMono-Bold.ttf" fontSize + font' <- liftIO $ SDL.TTF.openFont fontFile fontSize modify $ \s -> s { _sdlFont = font' } parseEvents :: RWST Env () LoopState IO (Bool, Set.Set SDLKey, MidiPitchSet, (Int, Int), Integer) -- cgit v1.2.3