forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TextWidth and TextHeight functions?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
Giuliano



Joined: 13 Sep 2005
Posts: 78

PostPosted: Mon Sep 26, 2005 12:56 am    Post subject: TextWidth and TextHeight functions? Reply with quote

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 ?
Back to top
View user's profile Send private message
flattspott



Joined: 22 Aug 2005
Posts: 22

PostPosted: Mon Sep 26, 2005 1:53 am    Post subject: Reply with quote

from counting the pixels on a zoomed in image
s would be a space

font = {h=7, w=5, s= 3}
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Mon Sep 26, 2005 1:55 am    Post subject: Re: TextWidth and TextHeight functions? Reply with quote

Giuliano wrote:
Is it possible somehow to either
a)change the default font that Lua uses


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:

b)calculate the print text height and width of a string (I need this for doing accurate clipping)


Length: string.len(text) * 8, Height: 8.
Back to top
View user's profile Send private message
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Mon Sep 26, 2005 2:34 am    Post subject: Re: TextWidth and TextHeight functions? Reply with quote

Shine wrote:
Length: string.len(text) * 8, Height: 8.

note: this works for monospaced fonts only

Giuliano wrote:
Is it possible somehow to either
a)change the default font that Lua uses


and you can already access an example on my website (the nick selector, which uses monospaced font [formula as the one of shine above])

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.
_________________
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Back to top
View user's profile Send private message Visit poster's website
Giuliano



Joined: 13 Sep 2005
Posts: 78

PostPosted: Mon Sep 26, 2005 7:13 am    Post subject: Re: TextWidth and TextHeight functions? Reply with quote

LuMo wrote:
Shine wrote:
Length: string.len(text) * 8, Height: 8.

note: this works for monospaced fonts only

Giuliano wrote:
Is it possible somehow to either
a)change the default font that Lua uses


and you can already access an example on my website (the nick selector, which uses monospaced font [formula as the one of shine above])

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.


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 fonts
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group