BMP font or TTF font library/code sample?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
PosX100
Posts: 98
Joined: Wed Aug 15, 2007 1:02 am

BMP font or TTF font library/code sample?

Post by PosX100 »

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.
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

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.
PosX100
Posts: 98
Joined: Wed Aug 15, 2007 1:02 am

Post by PosX100 »

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: Select all

//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 :)
PosX100
Posts: 98
Joined: Wed Aug 15, 2007 1:02 am

Post by PosX100 »

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


Here's my test code :


DEMO.CPP :

Code: Select all

	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: Select all

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

gfx end code :

	oslEndDrawing();
	oslSwapBuffers();
	oslEndFrame(); 
Post Reply