Exemple #1
0
FontManager::FontPtr FontManager::Load(const std::string& locator){
	std::string file;
	int size;

	std::string::size_type plast = locator.find_last_not_of(";");
	std::string::size_type pfirst = locator.find_first_of(";");
	std::string tmp;

	if((plast == std::string::npos) || (pfirst == std::string::npos)){
		file = locator;
		size = DEFAULT_FONT_SIZE;
	}else{
		file = locator.substr(0, plast - 2);
		tmp = locator.substr(pfirst + 1);
		std::istringstream iss(tmp);
		iss >> size;
	}

	file = "content/fonts/" + file;

	FontPtr font = FontPtr(new sf::Font());
	if( !font->LoadFromFile(file, size))
		return FontPtr();

	return font;
}