Commit f0879515 authored by Erwan Tulou's avatar Erwan Tulou

skins2: fix font path processing

parent 69ea7b95
......@@ -278,19 +278,18 @@ void Builder::addBitmapFont( const BuilderData::BitmapFont &rData )
void Builder::addFont( const BuilderData::Font &rData )
{
string full_path = getFilePath( rData.m_fontFile );
if( !full_path.size() )
return;
// Try to load the font from the theme directory
string full_path = getFilePath( rData.m_fontFile );
if( full_path.size() )
{
GenericFont *pFont = new FT2Font( getIntf(), full_path, rData.m_size );
if( pFont->init() )
{
m_pTheme->m_fonts[rData.m_id] = GenericFontPtr( pFont );
return;
}
else
{
delete pFont;
}
// Font not found; try in the resource path
OSFactory *pOSFactory = OSFactory::instance( getIntf() );
......@@ -301,19 +300,15 @@ void Builder::addFont( const BuilderData::Font &rData )
for( it = resPath.begin(); it != resPath.end(); ++it )
{
string path = (*it) + sep + "fonts" + sep + rData.m_fontFile;
pFont = new FT2Font( getIntf(), path, rData.m_size );
GenericFont *pFont = new FT2Font( getIntf(), path, rData.m_size );
if( pFont->init() )
{
// Font loaded successfully
m_pTheme->m_fonts[rData.m_id] = GenericFontPtr( pFont );
break;
return;
}
else
{
delete pFont;
}
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment