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 

BMP font or TTF font library/code sample?

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



Joined: 15 Aug 2007
Posts: 98

PostPosted: Sun Mar 16, 2008 7:58 am    Post subject: BMP font or TTF font library/code sample? Reply with quote

Hey guys! , anyone knows where can i find some code (or library)
using bmp font files? or TTF files.


Thanks!


Last edited by PosX100 on Mon Mar 17, 2008 6:32 am; edited 1 time in total
Back to top
View user's profile Send private message
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Sun Mar 16, 2008 10:37 am    Post subject: Reply with quote

There's my pgeFont library, which loads TTF and converts it to a bitmap font: http://insomniac.0x89.org/index.php?id=77

There's also intraFont which uses the PSP native fonts: http://www.psp-programming.com/benhur/

Also most of the available engines use font rendering on their own, oslib, tri etc.
Back to top
View user's profile Send private message
PosX100



Joined: 15 Aug 2007
Posts: 98

PostPosted: Mon Mar 17, 2008 5:59 am    Post subject: Reply with quote

Insert_witty_name wrote:
There's my pgeFont library, which loads TTF and converts it to a bitmap font: http://insomniac.0x89.org/index.php?id=77

There's also intraFont which uses the PSP native fonts: http://www.psp-programming.com/benhur/

Also most of the available engines use font rendering on their own, oslib, tri etc.


Wow , your lib looks nice.

Im using OSLIB but the font support is very poor.

I have created a "CTextEffects" class which prints preloaded images(OSL_IMAGE **) at a given position(x,y) , and increases the position by m_Img->width().

Im using my class like this:
Code:

//loads images from a directory A..Z a..z 0..9
CTextEffects text("data//raw_font_images//");

//add cached text
text.put_in_cache("Test text","TEST1");

//print cached text
text.print_from_cache("TEST1");

//another example(without using cached text)
text.print("Hello..");

//clean up
text.clear();


Easy ,...but very slow ..

Just 2 questions..
1)Your library is compatible with OSLIB?
2)And i would also like to know if it supports complex(with cool characters) TTF files.
Edit: Ohh , it uses freetype library..hmm then i guess it will work with any font file :)
Back to top
View user's profile Send private message
PosX100



Joined: 15 Aug 2007
Posts: 98

PostPosted: Mon Mar 17, 2008 9:38 pm    Post subject: Reply with quote

Too bad ...it doesn't work with oslib....(or im doing something wrong)


Here's my test code :


DEMO.CPP :
Code:

   e->init(INIT_SOUND|INIT_GFX);

   e->sound.push("lol.wav","L1");

   pgeFont *f = pgeFontLoad("impact.ttf", 20, PGE_FONT_SIZE_PIXELS, 128);

   if(!f)e->sys.shutdown();

   pgeFontActivate(f);

   while(e->sys.running())
   {
   e->sound.play("L1");
   int t = e->timer.elapsedTime();
   std::string s = e->conv_util.int2str(t);
   e->events.proccess();
   if(e->buttonPressed(B_CROSS))e->sys.shutdown();
        e->gfx.begin();   

   pgeFontPrint(f,200, 200, RED, s.c_str());
   e->gfx.end();
   e->sound.proccessChannels();
   e->timer.update();
   }



Code:

gfx begin code:
   oslCls();
   oslStartDrawing();

gfx end code :

   oslEndDrawing();
   oslSwapBuffers();
   oslEndFrame();
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