From 9842a86563058cc04dc06cd07fcede688c36d8df Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 15 Dec 2024 22:14:51 +0530 Subject: Add embedding of font --- src/Chelleport/Context.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Chelleport') diff --git a/src/Chelleport/Context.hs b/src/Chelleport/Context.hs index de5c94b..17fdae0 100644 --- a/src/Chelleport/Context.hs +++ b/src/Chelleport/Context.hs @@ -1,6 +1,8 @@ -module Chelleport.Context where +module Chelleport.Context (initializeContext) where import Chelleport.Types +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFileRelative) import Foreign.C (CFloat) import qualified Graphics.X11 as X11 import SDL (($=)) @@ -29,9 +31,12 @@ initializeContext = do ctxX11Display = display } +rawFontData :: ByteString +rawFontData = $(embedFileRelative "./static/font.ttf") + loadFont :: IO TTF.Font loadFont = do - font <- TTF.load "Inter-Regular.ttf" fontSize + font <- TTF.decode rawFontData fontSize TTF.setStyle font [TTF.Bold] pure font -- cgit v1.3.1