diff options
| author | Akshay Nair <phenax5@gmail.com> | 2024-12-15 22:14:51 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2024-12-15 23:53:13 +0530 |
| commit | 9842a86563058cc04dc06cd07fcede688c36d8df (patch) | |
| tree | 9e975f31633b31acdcfba49db2d78ceb8e7f9afb /src/Chelleport/Context.hs | |
| parent | a94f867fdba27211700eccb3f4acdba7041bdb68 (diff) | |
| download | chelleport-9842a86563058cc04dc06cd07fcede688c36d8df.tar.gz chelleport-9842a86563058cc04dc06cd07fcede688c36d8df.zip | |
Add embedding of font
Diffstat (limited to 'src/Chelleport/Context.hs')
| -rw-r--r-- | src/Chelleport/Context.hs | 9 |
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 |
