I'm using the Fungen framework for Haskell and there is a function that uses BitmapFonts. The thing is, that the only BitmapFonts I can use are the ones that come with GLUT, here is the data:
data BitmapFont = Fixed8By13 | Fixed9By15 | TimesRoman10 | TimesRoman24 | Helvetica10 | Helvetica12 | Helvetica18
These fonts are very small for my application, and I want to use another BitmapFont, not just these, or make one of these bigger. How can I do it?
Here's the source of putGameText:
putGameText :: [Text] -> IO ()
putGameText [] = return ()
putGameText ((text,font,(x,y),r,g,b):ts) = do
loadIdentity
color (Color3 r g b)
rasterPos (Vertex2 x y)
renderString font text
putGameText ts
As I understand it, FunGEn's Text type constrains font to a fixed-size BitMapFont:
type Text = (String, BitmapFont, (GLdouble, GLdouble), GLclampf, GLclampf, GLclampf)
but renderString can also take a StrokeFont, which is even more limited in font family but responds to standard OpenGL scaling/transformation/rotation.
So, a good start might be to make myPutGameText that accepts a StrokeFont-capable MyText and does a scaling transform before rendering. Here's some pseudo-code which I hope someone will correct:
type MyText = (String, StrokeFont, (GLdouble, GLdouble), GLclampf, GLclampf, GLclampf)
myPutGameText :: [MyText] -> (GLDouble,GLDouble,GLDouble) -> IO ()
myPutGameText [] _ = return ()
myPutGameText ((text,font,(x,y),r,g,b):ts) (sx,sy,sz) = do
loadIdentity
preservingMatrix $ do
scale sx sy sz
color (Color3 r g b)
rasterPos (Vertex2 x y)
renderString font text
putGameText ts
For richer font rendering, the answer is probably to integrate something like FTGL.