aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-15 22:14:51 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-15 23:53:13 +0530
commit9842a86563058cc04dc06cd07fcede688c36d8df (patch)
tree9e975f31633b31acdcfba49db2d78ceb8e7f9afb /src
parenta94f867fdba27211700eccb3f4acdba7041bdb68 (diff)
downloadchelleport-9842a86563058cc04dc06cd07fcede688c36d8df.tar.gz
chelleport-9842a86563058cc04dc06cd07fcede688c36d8df.zip
Add embedding of font
Diffstat (limited to '')
-rw-r--r--src/Chelleport/Context.hs9
1 files changed, 7 insertions, 2 deletions
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