Some more work on font metrics integration.
The problem with IO is a bit more drastic than I previously realized, previously I made pictures like this:
dctx :: DrawingContext
dctx = fontface courier_bold $ standardContext 24
pic1 :: DPicture
pic1 = liftToPictureU $ execTraceDrawing dctx $ do
draw $ textlineMulti ["hello", "world"] `at` zeroPt
However, to accommodate the font loader I'll no longer be able to create a DrawingContext statically as a top level binding, I'll have to acquire BaseGlyphMetrics in IO then make a context like this:
makeDctx :: BaseGlyphMetrics Double -> DrawingContext
makeDctx base_metrics =
fontface courier_bold $ standardContext 24 base_metrics
This will also mandate a change to pic1, it will have to become a functional type taking the runtime drawing context rather than just a picture:
pic1 :: DrawingContext -> DPicture
pic1 dctx = liftToPictureU $ execTraceDrawing dctx $ do
draw $ textlineMulti ["hello", "world"] `at` zeroPt
This probably means I'll end up changing the (Wumpus-basic) Picture type so it is a function from DrawingContext to (Wumpus-core) Picture rather than just a Picture. The thought of this does make me worry about efficiency and that Wumpus is getting too higher-order, though.