void ResourceManager::CopyFrom( const ResourceManager& other ) {
	Clear();

	FontMap::const_iterator font_iter( other.m_fonts.begin() );
	FontMap::const_iterator font_iter_end( other.m_fonts.end() );

	for( ; font_iter != font_iter_end; ++font_iter ) {
		if( font_iter->second.second ) {
			const sf::Font* new_font( new sf::Font( *font_iter->second.first ) );
			AddFont( font_iter->first, *new_font, true );
		}
		else {
			AddFont( font_iter->first, *font_iter->second.first, false );
		}
	}

	TextureMap::const_iterator tex_iter( other.m_textures.begin() );
	TextureMap::const_iterator tex_iter_end( other.m_textures.end() );

	for( ; tex_iter != tex_iter_end; ++tex_iter ) {
		if( tex_iter->second.second ) {
			const sf::Texture* new_texture( new sf::Texture( *tex_iter->second.first ) );
			AddTexture( tex_iter->first, *new_texture, true );
		}
		else {
			AddTexture( tex_iter->first, *tex_iter->second.first, false );
		}
	}
}
CTWenUGCtrlEx::CTWenUGCtrlEx():m_nIndexBMP_Delete(-1),m_nIndexBMP_Add(-1),m_nIndexBMP_INF(-1),
m_nFontID_Title(-1),m_nFontID_Content(-1),m_crContent(RGB(255,255,255)),
m_bDislplayFirstColumn(false),m_bAutoAdd_RowButtonAdd(false)
{
	m_nFontID_Title = AddFont(_T("微软雅黑"), 19, 5);
	m_nFontID_Content = AddFont(_T("微软雅黑"), 18, 4);
}
示例#3
0
/////////////////////////////////////////////////////////////////////////////
//	OnSetup
//		This function is called just after the grid window 
//		is created or attached to a dialog item.
//		It can be used to initially setup the grid
void CDropDayCug::OnSetup()
{
	SetUserSizingMode( 0 );
	SetDefRowHeight( 50 );
	EnableMenu( TRUE );
	SetDefFont( AddFont( "Arial", -13, 400 ));
	m_crossedFont.CreateFont( -13, 0, 0, 0, 400, 0, 0, 1, 0, 0, 0, 0, 0, "Arial" );

	CUGCell cell;
	GetHeadingDefault( &cell );
	cell.SetFont( GetFont( AddFont( "Arial", -13, 700 )));
	SetHeadingDefault( &cell );
}
示例#4
0
void wxFontsManager::AddFontsFromDir(const wxString& indexFile)
{
    wxFileName fn(indexFile);
    wxString dir = fn.GetPath();

    if ( !fn.FileExists() )
    {
        wxLogWarning(_("Fonts index file %s disappeared while loading fonts."),
                     indexFile.c_str());
        return;
    }

    wxLogTrace("font", "adding fonts from %s", dir.c_str());

    wxFileConfig cfg(wxEmptyString, wxEmptyString,
                     indexFile, wxEmptyString,
                     wxCONFIG_USE_LOCAL_FILE);

    long i;
    wxString name;
    for ( bool cont = cfg.GetFirstGroup(name, i);
               cont;
               cont = cfg.GetNextGroup(name, i) )
    {
        AddFont(dir, name, cfg);
    }

    // set default fonts for families:
    SetDefaultFonts(cfg);
}
//-------------------------------------------------------------------------
void COption::ChooseFont(ObjType t, CDC &PrinterDC, HWND Window)
{
	CHOOSEFONT cf;
	LOGFONT aLogFont = *(GetFont(GetCurrentFont(t)));

	cf.lStructSize = sizeof(CHOOSEFONT);
    cf.hwndOwner = Window;
    cf.hDC = PrinterDC.m_hDC;
    cf.lpLogFont = &aLogFont;
    cf.iPointSize = 10;
    cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_BOTH;
    cf.rgbColors = cBLACK;
    cf.lCustData = 0;
    cf.lpfnHook = NULL;
    cf.lpTemplateName = NULL;
    cf.hInstance = NULL;
    cf.lpszStyle = NULL;
    cf.nFontType = SCREEN_FONTTYPE;
    cf.nSizeMin = 5;
    cf.nSizeMax = 128;

	if (::ChooseFont(&cf))
	{
		CurrentFont[ t ] = AddFont(&aLogFont);
	}
}
示例#6
0
MOboolean
moFontManager::Init() {

    m_Fonts.Init(0, NULL);



	moFont *pFont = NULL;

	pFont = new moFont();

	if (pFont) {

		moText	completepath;

		//completepath = m_pResourceManager->GetDataMan()->GetDataPath() + moText("/");
		completepath = moText("../../art/fonts/Tuffy.ttf");

		pFont->Init( MO_FONT_OUTLINE, completepath, 16 );


		//pFont->Init( MO_FONT_SOLID, completepath, 16 );

	}

	AddFont(pFont);

	return true;

}
示例#7
0
moFont*
moFontManager::LoadFont( moText p_fontname_path, moFontType p_fonttype, MOfloat p_fontsize ) {

    moFont *pFont = NULL;
    moTexture* p_Texture = NULL;
    int idx = -1;

	pFont = new moFont();

	if (pFont) {

        if ( p_fonttype == MO_FONT_GLBUILD ) {
            idx = m_pResourceManager->GetTextureMan()->GetTextureMOId( p_fontname_path, true );
            if (idx>-1) p_Texture = (moTexture*) m_pResourceManager->GetTextureMan()->GetTexture(idx);
            if (p_Texture)
              pFont->Init( p_fonttype, p_fontname_path, p_fontsize, p_Texture->GetGLId() );
            MODebug2->Push( moText("Loaded Bitmap Font: ") + (moText)p_fontname_path );
        } else if ( pFont->Init( p_fonttype, p_fontname_path, p_fontsize) ) {
            MODebug2->Push( moText("Loaded FreeType Font: ") + (moText)p_fontname_path );
        } else {
            MODebug2->Push( moText("Error: font: ") + (moText)p_fontname_path );
            return NULL;
        }

        AddFont(pFont);

	}

	return pFont;
}
示例#8
0
FreeTypeFontInfo* FreeTypeFontEngine::FindFont(LPCTSTR lpFaceName, int weight, bool italic, bool AddOnFind, BOOL* bIsFontLoaded)
{
/*
	if (m_bAddOnFind) 
	{
		m_bAddOnFind = false;
		return NULL;
	}*/

	CCriticalSectionLock __lock(CCriticalSectionLock::CS_FONTMAP);
	weight = CalcBoldWeight(weight);
	myfont font(lpFaceName, weight, italic);
	FontMap::const_iterator iter=m_mfontMap.find(font);
	if (iter!=m_mfontMap.end())
	{
		FreeTypeFontInfo* p = iter->second;
		p->SetMruCounter(this);
/*
		TCHAR buff[255]={0};
		if (wcslen(lpFaceName)==8)
		{
			wsprintf(buff, L"Finding familiyname \"%s\" weight %d\n\tFound: \"%s\"\n", lpFaceName,
				weight, p->GetFullName().c_str());
			Log(buff);
		}*/
		if (bIsFontLoaded)
			*bIsFontLoaded = true;
		return p;
	}
	//m_bAddOnFind = true;
	return AddFont(lpFaceName, weight, italic, bIsFontLoaded);
}
示例#9
0
myinline ArpMessage& ArpMessage::SetFont(const char *name, const BFont* dat)
{
	if( !this ) return *((ArpMessage*)NULL);
	if( status == B_NO_ERROR ) {
		status = AddFont(name, dat);
	}
	return *this;
}
示例#10
0
文件: atmfonts.cpp 项目: vata/xarino
INT32 ATMFontMan::InstallFont(TCHAR *pMenuName, WORD Style, TCHAR *lpMetricsFile, TCHAR *lpFontFile)
{
	INT32 err = BeginFontChange();

	if (err==ATM_NOERR)
		err = AddFont(pMenuName, Style, lpMetricsFile, lpFontFile);

	EndFontChange();

	return err;
}
示例#11
0
//-------------------------------------------------------------------------
//-- Change the size of a font and create a new entry
hFONT COption::ChangeFontSize( hFONT n, double delta_height, double width )
{
  LOGFONT Font = *GetFont( n );
  Font.lfHeight += static_cast<int>(delta_height);

  if (width != 0)
  {
	Font.lfWidth = static_cast<int>(width);
  }

  return AddFont( &Font );
}
示例#12
0
void FontSystem::InitFontNames() {
	// enumlate all fonts
	if(FontNamesInit) return;

	std::vector<std::wstring> list;
	TVPGetAllFontList( list );
	int count = list.size();
	for( int i = 0; i < count; i++ ) {
		AddFont( list[i] );
	}

	FontNamesInit = true;
}
status_t
TerminalThemesAddon::MakeThemeR5(BMessage &theme, uint32 flags)
{
	BMessage termpref;
	status_t err;
	struct termprefs tp;
	BPath pTermPref;
	
	(void)flags;
	err = MyMessage(theme, termpref);
	if (err)
		termpref.MakeEmpty();
	
	if (find_directory(B_USER_SETTINGS_DIRECTORY, &pTermPref) < B_OK)
		return EINVAL;
	pTermPref.Append("Terminal");
	BFile fTermPref(pTermPref.Path(), B_READ_ONLY);
	if (fTermPref.InitCheck() != B_OK)
		return fTermPref.InitCheck();
	if (fTermPref.Read(&tp, sizeof(struct termprefs)) < (ssize_t)sizeof(struct termprefs))
		return EIO;
	if ((tp.magic != TP_MAGIC) || (tp.version != TP_VERSION))
		return EINVAL;
	termpref.AddInt32(TP_COLS, tp.p.cols);
	termpref.AddInt32(TP_ROWS, tp.p.rows);
	termpref.AddInt32(TP_TABWIDTH, tp.p.tab_width);
	BFont tFont;
	font_family ff;
	font_style fs;
	BString str(tp.p.font);
	str.Truncate(str.FindFirst('/'));
	strncpy(ff, str.String(), sizeof(ff));
	str.SetTo(tp.p.font);
	str.Remove(0, str.FindFirst('/')+1);
	strncpy(fs, str.String(), sizeof(fs));
	tFont.SetFamilyAndStyle(ff, fs);
	tFont.SetSize(tp.p.font_size);
	AddFont(termpref, TP_FONT, &tFont);
	AddRGBColor(termpref, TP_BG, tp.p.bg);
	AddRGBColor(termpref, TP_FG, tp.p.fg);
	AddRGBColor(termpref, TP_CURBG, tp.p.curbg);
	AddRGBColor(termpref, TP_CURFG, tp.p.curfg);
	AddRGBColor(termpref, TP_SELBG, tp.p.selbg);
	AddRGBColor(termpref, TP_SELFG, tp.p.selfg);
	termpref.AddInt32(TP_ENCODING, tp.p.encoding);

	err = SetMyMessage(theme, termpref);
	return B_OK;
}
示例#14
0
/*
LPCTSTR FreeTypeFontEngine::GetFontById(int faceid, int& weight, bool& italic)
{
	CCriticalSectionLock __lock;

	FreeTypeFontInfo** pp	= m_arrFontList.Begin();
	FreeTypeFontInfo** end	= m_arrFontList.End();
	for(; pp != end; ++pp) {
		FreeTypeFontInfo* p = *pp;
		if (p->GetId() == faceid) {
			p->SetMruCounter(this);
			weight = p->GetWeight();
			italic = p->IsItalic();
			return p->GetName();
		}
	}
	return NULL;
}
*/
FreeTypeFontInfo* FreeTypeFontEngine::FindFont(void* lpparams)
{
	FREETYPE_PARAMS* params = (FREETYPE_PARAMS*)lpparams;
	CCriticalSectionLock __lock(CCriticalSectionLock::CS_FONTMAP);
	FullNameMap::const_iterator iter=m_mfullMap.find(params->strFullName);
	if (iter!=m_mfullMap.end())
	{
		FreeTypeFontInfo* p = iter->second;
		if (p->GetFullName()!=params->strFullName)	//属于替换字体
			return FindFont(params->lplf->lfFaceName, params->lplf->lfWeight, !!params->lplf->lfItalic);
		p->SetMruCounter(this);
		return p;
	}
	//m_bAddOnFind = true;
	return AddFont(params);
}
示例#15
0
int main(int argc, char* argv[])
{

	//\ Lets initialise the AIE Framework and give the window it creates an appropriate title
	Initialise(iScreenWidth, iScreenHeight, false, "One of Piece");
	SetBackgroundColour(SColour(0x00, 0x00, 0x00, 0xFF));
	AddFont("./fonts/invaders.fnt");

	g_AssetManager.Load("Player", "./images/invaders/luffyPlayer.png", 40, 64);
	g_AssetManager.Load("Bullet", "./images/invaders/chopperBullet.png", 24, 36);
	g_AssetManager.Load("Enemy", "./images/invaders/tumblrEnemy.png", 36, 42);
	g_AssetManager.Load("BG", "./images/invaders/OPbackground.png", iScreenWidth, iScreenHeight);
	g_AssetManager.Load("GameBG", "./images/invaders/Logo (2).png", iScreenWidth, iScreenHeight);
	g_AssetManager.Load("VicBG", "./images/invaders/Luffy_One_Piece_Chibi.png", 400, 500);

	new Player();
	Entity::init();
	GameState ecurrentState = gs_MENU;
	ScoreDB &ref = ScoreDB::getInstance();


	ref.Open();
	//ScoreData myScore = { 0, "Your Timer: " };


	do
	{
		ClearScreen();
		float fDeltaT = GetDeltaTime();

		SetFont("./fonts/invaders.fnt");
		Playgame(fDeltaT);
		
		std::string timeFrame = "DeltaTime: ";
		timeFrame.append(std::to_string(fDeltaT));
		SetFont(nullptr);

	} while (FrameworkUpdate() == false && running);

	ref.Close();
	g_AssetManager.FreeAll();
	Shutdown();

	return 0;
}
//-----------------------------------------------------------------------------
CPUTFont *CPUTAssetLibrary::GetFont(const std::string &name )
{
    // Resolve name to absolute path
    std::string absolutePathAndFilename;
    CPUTFileSystem::ResolveAbsolutePathAndFilename( (mFontDirectoryName + name), &absolutePathAndFilename);

    // If we already have one by this name, then return it
    CPUTFont *pFont = FindFont(absolutePathAndFilename, true);
    if(NULL==pFont)
    {
        CPUTFont *pFont = CPUTFont::Create( name, absolutePathAndFilename);
        LIBRARY_ASSERT(pFont, "Could not create font " + absolutePathAndFilename);
        if (pFont != NULL)
        AddFont(name, "", "", pFont);
        return pFont; 
    }
    pFont->AddRef();
    return pFont;
}
///////////
// Collect
void FontsCollectorThread::Collect() {
	// Make sure there is a separator at the end
	destination += _T("\\");

	// Reset log box
	wxTextCtrl *LogBox = collector->LogBox;
	wxMutexGuiEnter();
	LogBox->SetValue(_T(""));
	LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,0,180)));
	LogBox->AppendText(_("Searching for fonts in file...\n"));
	LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,0,0)));
	LogBox->Refresh();
	LogBox->Update();
	wxSafeYield();
	wxMutexGuiLeave();

	// Scans file
	bool fileModified = false;
	AssStyle *curStyle;
	AssDialogue *curDiag;
	curLine = 0;
	for (std::list<AssEntry*>::iterator cur=subs->Line.begin();cur!=subs->Line.end();cur++) {
		// Collect from style
		curStyle = AssEntry::GetAsStyle(*cur);
		if (curStyle) {
			AddFont(curStyle->font,true);
			wxMutexGuiEnter();
			LogBox->AppendText(wxString(_T("\"")) + curStyle->font + _("\" found on style \"") + curStyle->name + _T("\".\n"));
			LogBox->Refresh();
			LogBox->Update();
			wxSafeYield();
			wxMutexGuiLeave();
		}

		// Collect from dialogue
		else {
			curDiag = AssEntry::GetAsDialogue(*cur);
			if (curDiag) {
				curLine++;
				curDiag->ParseASSTags();
				curDiag->ProcessParameters(GetFonts);
				curDiag->ClearBlocks();
			}
		}
	}

#ifdef __WINDOWS__
	// Collect font data
	wxMutexGuiEnter();
	LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,0,180)));
	LogBox->AppendText(_("\nReading fonts from registry...\n"));
	LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,0,0)));
	wxSafeYield();
	wxMutexGuiLeave();
	CollectFontData();

	// Get fonts folder
	wxString source;
	TCHAR szPath[MAX_PATH];
	if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_FONTS,NULL,0,szPath))) {
		source = wxString(szPath);
	}
	else source = wxGetOSDirectory() + _T("\\fonts");
	source += _T("\\");

	// Get font file names
	wxArrayString work;
	wxArrayString copied;
	bool attaching = collector->AttachmentCheck->IsChecked();
	for (size_t i=0;i<fonts.GetCount();i++) {
		try {
			work = GetFontFiles(fonts[i]);
			for (size_t j=0;j<work.GetCount();j++) {
				// Get path to font file
				wxString srcFile,dstFile;
				wxFileName srcFileName(work[j]);
				if (srcFileName.FileExists() && srcFileName.IsAbsolute()) {
					srcFile = work[j];
					dstFile = destination + srcFileName.GetFullName();
				}
				else {
					srcFile = source + work[j];
					dstFile = destination + work[j];
				}

				if (copied.Index(work[j]) == wxNOT_FOUND) {
					copied.Add(work[j]);

					// Check if it exists
					if (!attaching && wxFileName::FileExists(dstFile)) {
						wxMutexGuiEnter();
						LogBox->SetDefaultStyle(wxTextAttr(wxColour(255,128,0)));
						LogBox->AppendText(wxString(_T("\"")) + work[j] + _("\" already exists on destination.\n"));
						LogBox->Refresh();
						LogBox->Update();
						wxSafeYield();
						wxMutexGuiLeave();
					}

					// Copy
					else {
						// Copy font
						bool success;
						if (attaching) {
							try {
								subs->InsertAttachment(srcFile);
								fileModified = true;
								success = true;
							}
							catch (...) { success = false; }
						}
						else success = Copy(srcFile,dstFile);

						// Report
						wxMutexGuiEnter();
						if (success) {
							LogBox->SetDefaultStyle(wxTextAttr(wxColour(0,180,0)));
							LogBox->AppendText(wxString(_T("\"")) + work[j] + _("\" copied.\n"));

						}
						else {
							LogBox->SetDefaultStyle(wxTextAttr(wxColour(220,0,0)));
							LogBox->AppendText(wxString(_("Failed copying \"")) + srcFile + _T("\".\n"));
						}
						LogBox->Refresh();
						LogBox->Update();
						wxSafeYield();
						wxMutexGuiLeave();
					}
				}
			}
		}

		catch (...) {
			wxMutexGuiEnter();
			LogBox->SetDefaultStyle(wxTextAttr(wxColour(220,0,0)));
			LogBox->AppendText(wxString(_("Could not find font ")) + fonts[i] + _T("\n"));
			wxMutexGuiLeave();
		}
	}
#endif

	// Flag file as modified
	if (fileModified) {
		subs->FlagAsModified();
		collector->main->SubsBox->CommitChanges();
	}
}
示例#18
0
void CPDF_InterForm::AddFormFont(const CPDF_Font* pFont,
                                 CFX_ByteString& csNameTag) {
  AddFont(m_pFormDict, m_pDocument, pFont, csNameTag);
}
示例#19
0
moFont*
moFontManager::AddFont( moText p_fontname, moText p_fonttype, MOfloat p_fontsize ) {
    return AddFont( p_fontname, GetFontType(p_fonttype), p_fontsize );
}
示例#20
0
int main( int argc, char* argv[] )
{	

	Initialise(iScreenWidth, iScreenHeight, false, "Space Invaders");
    
	SetBackgroundColour(SColour(0x00, 0x00, 0x00, 0xFF));

	//player settings
	player.SetSize(64.0f, 32.0f);
	player.iSpriteID = CreateSprite("./images/cannon.png", player.fWidth, player.fHeight, true);
	player.SetMovementExtremes(0.0f, iScreenWidth);
	player.SetMovementKeys(65, 68);
	player.x = iScreenWidth * 0.5f;
	player.y = 88.0f;

	//create Marquee sprite
	iArcadeMarquee = CreateSprite("./images/Space-Invaders-Marquee.png", iScreenWidth, iScreenHeight, true);

	//enemy creation
	CreateEnemies();
	enemyDirection = eRIGHT;
	nextDirection = eRIGHT;

	//font setting
	AddFont(pInvadersFont);

	//game state declaration
	GAMESTATES eCurrentState = eMAIN_MENU;

    //Game Loop
    do
    {
		float fDeltaT = GetDeltaTime();

		switch (eCurrentState) {
		case eMAIN_MENU:

			UpdateMainMenu();

			//input
			if (IsKeyDown(257) && !IsKeyDown(256)) {
				eCurrentState = eGAMEPLAY;
				ResetEnemies();
			}

			break;

		case eGAMEPLAY:

			UpdateGameState(fDeltaT);

			//ChangeState
			if (IsKeyDown(256)) {
				eCurrentState = eMAIN_MENU;
			}

			break;

		default:
			break;
		}

		//clear screen
		ClearScreen();


    } while(!FrameworkUpdate());

	Shutdown();

    return 0;
}
示例#21
0
void C_Font::FontFunction(short ID,long P[],_TCHAR *str,LOGFONT *lgfnt,long *NewID)
{
	switch(ID)
	{
		case CFNT_ID:
			*NewID=P[0];
			break;
		case CFNT_lfHeight:
			if(lgfnt)
				lgfnt->lfHeight|=P[0];
			break;
		case CFNT_lfWidth:
			if(lgfnt)
				lgfnt->lfWidth|=P[0];
			break;
		case CFNT_lfEscapement:
			if(lgfnt)
				lgfnt->lfEscapement|=P[0];
			break;
		case CFNT_lfOrientation:
			if(lgfnt)
				lgfnt->lfOrientation|=P[0];
			break;
		case CFNT_lfWeight:
			if(lgfnt)
				lgfnt->lfWeight|=P[0];
			break;
		case CFNT_lfItalic:
			if(lgfnt)
				lgfnt->lfItalic|=(BYTE)P[0];
			break;
		case CFNT_lfUnderline:
			if(lgfnt)
				lgfnt->lfUnderline|=(BYTE)P[0];
			break;
		case CFNT_lfStrikeOut:
			if(lgfnt)
				lgfnt->lfStrikeOut|=(BYTE)P[0];
			break;
		case CFNT_lfCharSet:
			if(lgfnt)
				lgfnt->lfCharSet|=(BYTE)P[0];
			break;
		case CFNT_lfOutPrecision:
			if(lgfnt)
				lgfnt->lfOutPrecision|=(BYTE)P[0];
			break;
		case CFNT_lfClipPrecision:
			if(lgfnt)
				lgfnt->lfClipPrecision|=(BYTE)P[0];
			break;
		case CFNT_lfQuality:
			if(lgfnt)
				lgfnt->lfQuality|=(BYTE)P[0];
			break;
		case CFNT_lfPitchAndFamily:
			if(lgfnt)
				lgfnt->lfPitchAndFamily|=(BYTE)P[0];
			break;
		case CFNT_lfFaceName:
			if(lgfnt)
				_tcsncpy(lgfnt->lfFaceName,str,LF_FACESIZE);
			break;
		case CFNT_SPACING:
			Spacing_=P[0];
			break;
		case CFNT_ADDFONT:
			AddFont(*NewID,lgfnt);
			Spacing_=0;
			memset(lgfnt,0,sizeof(LOGFONT));
			break;
		case CFNT_LOAD:
			LoadFont(P[0],str);
			break;
	}
}
示例#22
0
void GraphicsManager::AddGraphicScript(Display* display, const std::string& filepath)
{
	std::ifstream in;
	in.open(filepath);

	LOG("Loading graphics script...");
	int lineNum = 1;

	if (in.is_open())
	{
		while (!in.eof())
		{
			std::string line;
			std::getline(in, line);

			std::vector<std::string> linedata = SplitString(line, ' ');

			for (int i = 0; i < linedata.size(); i++)
			{
				std::string data = linedata[i];

				if (data[0] == NULL)
					continue;
				else if (data[0] == '#' || (data[0] == '/' && data[1] == '/'))
				{
					break;
				}
				else if (data == "basepath")
				{
					if (!(linedata.size() - 1 < i + 1))
					{
						std::string basepathType = linedata[i + 1];

						if (basepathType == "i")
						{
							if (!(linedata.size() - 1 < i + 2))
							{
								std::string basepath = linedata[i + 2];

								if (basepath == "NONE")
									imageBasepath = "";
								else
									imageBasepath = basepath;

								i += 2;
								continue;
							}
							else
								LOG_ERROR("Syntax error, invalid basepath in graphics script " << filepath << " at line " << lineNum);
						}
						else if (basepathType == "a")
						{
							if (!(linedata.size() - 1 < i + 2))
							{
								std::string basepath = linedata[i + 2];

								if (basepath == "NONE")
									animationBasepath = "";
								else
									animationBasepath = basepath;

								i += 2;
								continue;
							}
							else
								LOG_ERROR("Syntax error, invalid basepath in graphics script " << filepath << " at line " << lineNum);
						}
						else if (basepathType == "f")
						{
							if (!(linedata.size() - 1 < i + 2))
							{
								std::string basepath = linedata[i + 2];

								if (basepath == "NONE")
									fontBasepath = "";
								else
									fontBasepath = basepath;

								i += 2;
								continue;
							}
							else
								LOG_ERROR("Syntax error, invalid basepath in graphics script " << filepath << " at line " << lineNum);
						}
						else
							LOG_ERROR("Syntax error, invalid basepath type in graphics script " << filepath << " at line " << lineNum);
					}
					else
						LOG_ERROR("Syntax error, invalid basepath in graphics script " << filepath << " at line " << lineNum);
				}
				else if (data == "i")
				{
					if (!(linedata.size() - 1 < i + 1))
					{
						std::string imagepath = linedata[i + 1];

						if (!(linedata.size() - 1 < i + 2))
						{
							std::string imagekey = linedata[i + 2];

							AddTexture(display, (imageBasepath + imagepath), std::stoi(imagekey));

							i += 2;
							continue;
						}
						else
							LOG_ERROR("Syntax error, invalid image key in graphics script " << filepath << " at line " << lineNum);
					}
					else
						LOG_ERROR("Syntax error, invalid image path in graphics script " << filepath << " at line " << lineNum);

				}
				else if (data == "a")
				{
					//TODO: Add animation class and Implement this
				}
				else if (data == "f")
				{
					if (!(linedata.size() - 1 < i + 1))
					{
						std::string fontpath = linedata[i + 1];

						if (!(linedata.size() - 1 < i + 2))
						{
							std::string fontkey = linedata[i + 2];

							if (!(linedata.size() - 1 < i + 3))
							{
								std::string fontsize = linedata[i + 3];

								if (IsNumber(fontsize))
								{
									AddFont(display, (fontBasepath + fontpath), std::stoi(fontkey), std::stoi(fontsize));

									i += 3;
									continue;
								}
								else
									LOG_ERROR("Syntax error, invalid font size not a number in graphics script " << filepath << " at line " << lineNum);
							}
							else
								LOG_ERROR("Syntax error, invalid font size in graphics script " << filepath << " at line " << lineNum);
						}
						else
							LOG_ERROR("Syntax error, invalid font key in graphics script " << filepath << " at line " << lineNum);
					}
					else
						LOG_ERROR("Syntax error, invalid font path in graphics script " << filepath << " at line " << lineNum);
				}
				else
					LOG_ERROR("Syntax error, invalid command in graphics script " << filepath << " at line " << lineNum);
			}

			lineNum++;
		}
	}
	else
		LOG_ERROR("Couldn't load graphics script: " << filepath);
}
示例#23
0
文件: Font.cpp 项目: inosms/innocence
void FontManager::AddFont(std::string n_path, int n_size)
{
	Font* tmp_newFont = new Font(g_application->m_resourcePath+n_path,n_size);
	AddFont(n_path,tmp_newFont);
}
示例#24
0
int FontEnumForV2Console(ENUMLOGFONT *pelf, NEWTEXTMETRIC *pntm, int nFontType, LPARAM lParam)
{
    UINT i;
    LPCWSTR pwszFace = pelf->elfLogFont.lfFaceName;

    BOOL const fIsEastAsianCP = IsEastAsianCP(GetACP());

    LPCWSTR pwszCharSet;

    switch (pelf->elfLogFont.lfCharSet)
    {
    case ANSI_CHARSET:
        pwszCharSet = L"ANSI";
        break;
    case CHINESEBIG5_CHARSET:
        pwszCharSet = L"Chinese Big5";
        break;
    case EASTEUROPE_CHARSET:
        pwszCharSet = L"East Europe";
        break;
    case GREEK_CHARSET:
        pwszCharSet = L"Greek";
        break;
    case MAC_CHARSET:
        pwszCharSet = L"Mac";
        break;
    case RUSSIAN_CHARSET:
        pwszCharSet = L"Russian";
        break;
    case SYMBOL_CHARSET:
        pwszCharSet = L"Symbol";
        break;
    case BALTIC_CHARSET:
        pwszCharSet = L"Baltic";
        break;
    case DEFAULT_CHARSET:
        pwszCharSet = L"Default";
        break;
    case GB2312_CHARSET:
        pwszCharSet = L"Chinese GB2312";
        break;
    case HANGUL_CHARSET:
        pwszCharSet = L"Korean Hangul";
        break;
    case OEM_CHARSET:
        pwszCharSet = L"OEM";
        break;
    case SHIFTJIS_CHARSET:
        pwszCharSet = L"Japanese Shift-JIS";
        break;
    case TURKISH_CHARSET:
        pwszCharSet = L"Turkish";
        break;
    default:
        pwszCharSet = L"Unknown";
        break;

    }

    wprintf(L"Enum'd font: '%ls' (X: %d, Y: %d) weight 0x%lx (%d) charset %s \r\n",
            pelf->elfLogFont.lfFaceName,
            pelf->elfLogFont.lfWidth,
            pelf->elfLogFont.lfHeight,
            pelf->elfLogFont.lfWeight,
            pelf->elfLogFont.lfWeight,
            pwszCharSet);

    // reject non-monospaced fonts
    if (!(pelf->elfLogFont.lfPitchAndFamily & FIXED_PITCH))
    {
        wprintf(L"Rejecting non-monospaced font. \r\n");
        return CONTINUE_ENUM;
    }

    // reject non-modern or italic TT fonts
    if ((nFontType == TRUETYPE_FONTTYPE) &&
        (((pelf->elfLogFont.lfPitchAndFamily & 0xf0) != FF_MODERN) ||
         pelf->elfLogFont.lfItalic))
    {
        wprintf(L"Rejecting non-FF_MODERN or Italic TrueType font.\r\n");
        return CONTINUE_ENUM;
    }

    // reject non-TT fonts that aren't OEM
    if ((nFontType != TRUETYPE_FONTTYPE) &&
        (!fIsEastAsianCP || !IS_ANY_DBCS_CHARSET(pelf->elfLogFont.lfCharSet)) &&
        (pelf->elfLogFont.lfCharSet != OEM_CHARSET)) {
        wprintf(L"Rejecting raster font that isn't OEM_CHARSET.\r\n");
        return CONTINUE_ENUM;
    }

    // reject fonts that are vertical
    if (pwszFace[0] == TEXT('@'))
    {
        wprintf(L"Rejecting font face designed for vertical text.\r\n");
        return CONTINUE_ENUM;
    }

    // reject non-TT fonts that aren't terminal
    if ((nFontType != TRUETYPE_FONTTYPE) && (0 != lstrcmp(pwszFace, L"Terminal")))
    {
        wprintf(L"Rejecting raster font that isn't 'Terminal'.\r\n");
        return CONTINUE_ENUM;
    }

    // reject East Asian TT fonts that aren't East Asian charset.
    if (fIsEastAsianCP && !IS_ANY_DBCS_CHARSET(pelf->elfLogFont.lfCharSet)) {
        wprintf(L"Rejecting East Asian TrueType font that isn't marked with East Asian charsets.\r\n");
        return CONTINUE_ENUM;
    }

    // reject East Asian TT fonts on non-East Asian systems
    if (!fIsEastAsianCP && IS_ANY_DBCS_CHARSET(pelf->elfLogFont.lfCharSet))
    {
        wprintf(L"Rejecting East Asian TrueType font when Windows non-Unicode codepage isn't from CJK country.\r\n");
        return CONTINUE_ENUM;
    }

    if (nFontType & TRUETYPE_FONTTYPE) {
        for (i = 0; i < ARRAYSIZE(TTPoints); i++) {
            pelf->elfLogFont.lfHeight = TTPoints[i];

            // If it's an East Asian enum, skip all odd height fonts.
            if (fIsEastAsianCP && (pelf->elfLogFont.lfHeight % 2) != 0)
            {
                continue;
            }

            pelf->elfLogFont.lfWidth = 0;
            pelf->elfLogFont.lfWeight = pntm->tmWeight;
            AddFont(pelf, pntm, nFontType, (HDC)lParam);
        }
    }
    else {
        AddFont(pelf, pntm, nFontType, (HDC)lParam);
    }

    return CONTINUE_ENUM;  // and continue enumeration
}
示例#25
0
void ResourceManager::SetDefaultFont( std::shared_ptr<const sf::Font> font ) {
	AddFont( "", font );
}