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 

Help putting in fonts

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



Joined: 22 Mar 2006
Posts: 2

PostPosted: Wed Mar 22, 2006 11:46 am    Post subject: Help putting in fonts Reply with quote

well, to tell you the truth, i have no idea how to do that, but i really want to add it in for a program i am making. Can anyone help me with adding fonts in and how to do it? preferably a pixel font. THanks a lot
Back to top
View user's profile Send private message AIM Address
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Wed Mar 22, 2006 3:56 pm    Post subject: Reply with quote

McZonk has added a new font sample not too long ago
update your pspsdk and study the sample under dir

pspsdk/src/samples/gu/text

its pretty self explanatory and you can swap
the included font with your own
the sample shows simple ways to display your font,
change the color of font, change block width of font,
change opacity of font (transparency/alpha if its unclear)
even add a nice little drop shadow :)

enjoy
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Thu Mar 23, 2006 12:49 am    Post subject: Reply with quote

The text sample in sdk is pretty nice for a basic pixel font output. I worked on a bitmap font engine myself for PMPMod and my first attempt was pretty much like the sample, but it has a huge dropdown on performance if you make more use of the font than just to display some fps stats or alike.
That's because for every frame, every single char has to be blitted as textured quad. Say you have a string that is made up of 300 chars, then you'll make the GU render 300 alphablended, textured quads every frame, which is already as much precessing as a simple 3D Object would use (In my case, I also wanted to draw a border around the font and therefore first tried to draw the string 8 times around the original string in black, which would end up drawing 9*300 = 2700 quads every frame - unbareable, esp for the speed critical PMPMod).
So I gathered some information on more efficient ways of font-rendering, and after freetype was out of the question for the overkill-complexity, I tried to write a caching-system for the strings, based on how freetype and alike render their glyphs.
It's basically not more than just drawing your text to a offscren texture, saving the rendered string to a buffer and then just render one quad with the offscreen texture every time the string in the buffer is to be drawn.
Well, it's little bit more complicated if you want to minimize on memory usage (by using 4bit textures for the font like me), because then no rendertotexture will work. But I finally managed to get it working and it's pretty fast now, yet the source is very uncleaned. However, I also have a little Windows Tool for converting TTF fonts to my format (a header with a 256x256x4bit texture following).

I'll release the sources when I release the next version of PMPMod with subtitle support.
It's pretty easy to use and you'll just need to use my valloc routines for allocating frame and drawbuffers for the cache to work correctly then.
Back to top
View user's profile Send private message Visit poster's website
skinticket



Joined: 22 Mar 2006
Posts: 2

PostPosted: Mon Mar 27, 2006 2:14 am    Post subject: Reply with quote

Edit: Ok nvm i got it, now what is a RAW font. i thought it was with .png and now its .raw?
Back to top
View user's profile Send private message AIM Address
TheMan



Joined: 03 Jan 2006
Posts: 10

PostPosted: Mon Mar 27, 2006 7:50 am    Post subject: Reply with quote

skinticket wrote:
Edit: Ok nvm i got it, now what is a RAW font. i thought it was with .png and now its .raw?

i was having the same problem. im not sure what a .raw file is, could anyone explain it to me? is it like an image? also, anyone know some good code that would allow simple png fonts to be used?
Back to top
View user's profile Send private message
Brunni



Joined: 08 Oct 2005
Posts: 186

PostPosted: Mon Mar 27, 2006 8:42 pm    Post subject: Reply with quote

.raw means RAW data, that is, not a predefined format. It can for example contain the image data without any header, but it can also contain more things.
Maybe the format he's using for images is documented, else you'll have to look at the source to find it ;-)
_________________
Sorry for my bad english
Oldschool library for PSP - PC version released
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 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