It's nice to be back in the world of Blitz (having last played with it on my Amiga many moons ago), and thought I'd jump straight in and have a go with Fonts...
But I'm a bit stuck at the moment :-(
I thought... FreeType fonts... cool !.... then I tried it... not so cool...
I found that I have to have the .ttf file in my project folder to be able load the font. (from my experience with FreeType, I thought it would know the locations of my fonts for my particular OS - but I've had no joy so far...)
screenFont = TFreeTypeFont.Load("Tahoma.ttf",12,0)
And then... how to put them on screen?
The Glyphs are stored as pixmaps, and so I came up with...
sprint("The Quick Brown Fox Jumped Over The Lazy Dog", 10, 10)
Function sprint(s, x, y)
Local i, advance, char
For i = 1 To s.length
char = s[i-1] - 32
If (char > 0) Then
DrawPixmap screenFont.Glyph(char).pixels(), x + advance, y
advance:+ screenFont.Glyph(char).advance() + 1
Else
advance:+ 8
End If
Next
End Function
It's rather messy... has anyone a better method?
Or perhaps I'm missing something else that's un-documented?
:-/
Brucey
But I'm a bit stuck at the moment :-(
I thought... FreeType fonts... cool !.... then I tried it... not so cool...
I found that I have to have the .ttf file in my project folder to be able load the font. (from my experience with FreeType, I thought it would know the locations of my fonts for my particular OS - but I've had no joy so far...)
screenFont = TFreeTypeFont.Load("Tahoma.ttf",12,0)
And then... how to put them on screen?
The Glyphs are stored as pixmaps, and so I came up with...
sprint("The Quick Brown Fox Jumped Over The Lazy Dog", 10, 10)
Function sprint(s, x, y)
Local i, advance, char
For i = 1 To s.length
char = s[i-1] - 32
If (char > 0) Then
DrawPixmap screenFont.Glyph(char).pixels(), x + advance, y
advance:+ screenFont.Glyph(char).advance() + 1
Else
advance:+ 8
End If
Next
End Function
It's rather messy... has anyone a better method?
Or perhaps I'm missing something else that's un-documented?
:-/
Brucey