Is it possible somehow to either
a)change the default font that Lua uses
b)calculate the print text height and width of a string (I need this for doing accurate clipping)
If not, would it be possible to add in to the next version ?
TextWidth and TextHeight functions?
Moderators: Shine, Insert_witty_name
-
- Posts: 22
- Joined: Mon Aug 22, 2005 4:06 am
Re: TextWidth and TextHeight functions?
No, but it is easy to use your own font, see the tiles handling in the snake game and just use as the index for a tile, the characters of the string.Giuliano wrote:Is it possible somehow to either
a)change the default font that Lua uses
Length: string.len(text) * 8, Height: 8.Giuliano wrote: b)calculate the print text height and width of a string (I need this for doing accurate clipping)
Re: TextWidth and TextHeight functions?
note: this works for monospaced fonts onlyShine wrote:Length: string.len(text) * 8, Height: 8.
and you can already access an example on my website (the nick selector, which uses monospaced font [formula as the one of shine above])Giuliano wrote:Is it possible somehow to either
a)change the default font that Lua uses
greets
Lumo
PS: i already worked a "wordpad" out for a font that is not monospaced (supports, alignment: left, center, right, and auto-wordwrap)
but by now its only written in php.
Re: TextWidth and TextHeight functions?
I currently do use a monospaced bitmap font but drawing a lot of text requires blitting and it will get slow if I do too much, so instead I use print for some basic in-game captions. It would be nice to be able to change those fontsLuMo wrote:note: this works for monospaced fonts onlyShine wrote:Length: string.len(text) * 8, Height: 8.
and you can already access an example on my website (the nick selector, which uses monospaced font [formula as the one of shine above])Giuliano wrote:Is it possible somehow to either
a)change the default font that Lua uses
greets
Lumo
PS: i already worked a "wordpad" out for a font that is not monospaced (supports, alignment: left, center, right, and auto-wordwrap)
but by now its only written in php.