void BitmapText::LoadFromNode( const XNode* pNode ) { RString sText; pNode->GetAttrValue( "Text", sText ); RString sAltText; pNode->GetAttrValue( "AltText", sAltText ); ThemeManager::EvaluateString( sText ); ThemeManager::EvaluateString( sAltText ); RString sFont; if( !ActorUtil::GetAttrPath(pNode, "Font", sFont) && !ActorUtil::GetAttrPath(pNode, "File", sFont) ) { if( !pNode->GetAttrValue("Font", sFont) && !pNode->GetAttrValue("File", sFont) ) // accept "File" for backward compatibility { LOG->Warn( "%s: BitmapText: Font or File attribute not found", ActorUtil::GetWhere(pNode).c_str() ); sFont = "Common Normal"; } sFont = THEME->GetPathF( "", sFont ); } LoadFromFont( sFont ); SetText( sText, sAltText ); Actor::LoadFromNode( pNode ); }
void BitmapText::LoadFromNode( const CString& sDir, const XNode* pNode ) { /* XXX: How to handle translations? Maybe we should have one metrics section, * "Text", eg: * * [Text] * SoundVolume=Sound Volume * TextItem=Hello * * and allow "$TextItem$" in .actors to reference that. */ /* It's a BitmapText. Note that we could do the actual text setting with metrics, * by adding "text" and "alttext" commands, but right now metrics can't contain * commas or semicolons. It's useful to be able to refer to fonts in the real * theme font dirs, too. */ CString sText; pNode->GetAttrValue("Text", sText ); CString sAltText; pNode->GetAttrValue("AltText", sAltText ); ThemeManager::EvaluateString( sText ); ThemeManager::EvaluateString( sAltText ); /* Be careful: if sFile is "", and we don't check it, then we can end up recursively * loading the BGAnimationLayer that we're in. */ CString sFont; pNode->GetAttrValue( "Font", sFont ); if( sFont.empty() ) pNode->GetAttrValue("File", sFont ); // accept "File" for backward compatibility if( sFont == "" ) RageException::Throw( "An object '%s' in '%s' is missing the Font attribute", pNode->m_sName.c_str(), sDir.c_str() ); LoadFromFont( THEME->GetPathToF( sFont ) ); SetText( sText, sAltText ); Actor::LoadFromNode( sDir, pNode ); }
void BitmapText::LoadFromNode( const XNode* pNode ) { RString sText; pNode->GetAttrValue( "Text", sText ); RString sAltText; pNode->GetAttrValue( "AltText", sAltText ); ThemeManager::EvaluateString( sText ); ThemeManager::EvaluateString( sAltText ); RString sFont; if( !ActorUtil::GetAttrPath(pNode, "File", sFont) ) { if( !pNode->GetAttrValue("Font", sFont) ) // accept "File" for backward compatibility RageException::Throw( "%s: BitmapText: missing the File attribute", ActorUtil::GetWhere(pNode).c_str() ); sFont = THEME->GetPathF( "", sFont ); } LoadFromFont( sFont ); SetText( sText, sAltText ); Actor::LoadFromNode( pNode ); }