コード例 #1
0
//! returns the font
IGUIFont* CGUIEnvironment::getFont(const c8* filename)
{
	// search existing font

	SFont f;
	if (!filename)
		filename = "";

	f.Filename = filename;
	f.Filename.make_lower();

	s32 index = Fonts.binary_search(f);
	if (index != -1)
		return Fonts[index].Font;

	// not existing yet. try to load font.

	CGUIFont* font = new CGUIFont(Driver);
	if (!font->load(filename))
	{
		font->drop();
		return 0;
	}

	// add to fonts.

	f.Font = font;
	Fonts.push_back(f);

	return font;
}
コード例 #2
0
void CGUIEnvironment::loadBuidInFont()
{
	const c8* filename = "#DefaultFont";

#ifdef PPC
	for (int i=0; i<sizeof(BuildInFontData)/sizeof(s32); i++) BuildInFontData[i] = OSReadSwapInt32(&BuildInFontData[i],0);
#endif

	io::IReadFile* file = io::createMemoryReadFile(BuildInFontData, BuildInFontDataSize, filename, false);

	CGUIFont* font = new CGUIFont(Driver);
	if (!font->load(file))
	{
		os::Printer::log("Error: Could not load built-in Font.", ELL_ERROR);
		font->drop();
		file->drop();
		return;
	}

	SFont f;
	f.Filename = filename;
	f.Font = font;
	Fonts.push_back(f);

	file->drop();
}