mirror of https://code.videolan.org/videolan/vlc
* moved the default font in share/skins2/fonts
* parser/builder.cpp: a font with ID "defaultfont" is loaded from the common font directory
This commit is contained in:
parent
8c85b41474
commit
0c81e3b452
|
@ -116,8 +116,16 @@ void Builder::addTheme( const BuilderData::Theme &rData )
|
|||
rManager.setMagnetValue( rData.m_magnet );
|
||||
rManager.setAlphaValue( rData.m_alpha );
|
||||
rManager.setMoveAlphaValue( rData.m_moveAlpha );
|
||||
GenericFont *pFont = new FT2Font( getIntf(), "FreeSans.ttf", 12 );
|
||||
pFont->init();
|
||||
GenericFont *pFont = getFont( rData.m_tooltipfont );
|
||||
if( pFont )
|
||||
{
|
||||
rManager.createTooltip( *pFont );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg_Warn( getIntf(), "Invalid tooltip font: %s",
|
||||
rData.m_tooltipfont.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -381,7 +389,7 @@ void Builder::addText( const BuilderData::Text &rData )
|
|||
return;
|
||||
}
|
||||
|
||||
GenericFont *pFont = m_pTheme->m_fonts[rData.m_fontId].get();
|
||||
GenericFont *pFont = getFont( rData.m_fontId );
|
||||
if( pFont == NULL )
|
||||
{
|
||||
msg_Err( getIntf(), "Unknown font id: %s", rData.m_fontId.c_str() );
|
||||
|
@ -524,7 +532,7 @@ void Builder::addList( const BuilderData::List &rData )
|
|||
return;
|
||||
}
|
||||
|
||||
GenericFont *pFont = m_pTheme->m_fonts[rData.m_fontId].get();
|
||||
GenericFont *pFont = getFont( rData.m_fontId );
|
||||
if( pFont == NULL )
|
||||
{
|
||||
msg_Err( getIntf(), "Unknown font id: %s", rData.m_fontId.c_str() );
|
||||
|
@ -651,6 +659,32 @@ const Position Builder::makePosition( const string &rLeftTop,
|
|||
}
|
||||
|
||||
|
||||
GenericFont *Builder::getFont( const string &fontId )
|
||||
{
|
||||
GenericFont *pFont = m_pTheme->m_fonts[fontId].get();
|
||||
if( !pFont && fontId == "defaultfont" )
|
||||
{
|
||||
#ifdef WIN32_SKINS
|
||||
string defaultFont = (string)getIntf()->p_libvlc->psz_vlcpath +
|
||||
"\\skins2\\fonts\\FreeSans.ttf";
|
||||
#else
|
||||
string defaultFont = (string)DATA_PATH + "/skins2/fonts/FreeSans.ttf";
|
||||
#endif
|
||||
pFont = new FT2Font( getIntf(), defaultFont, 12 );
|
||||
if( pFont->init() )
|
||||
{
|
||||
m_pTheme->m_fonts["defaultfont"] = GenericFontPtr( pFont );
|
||||
}
|
||||
else
|
||||
{
|
||||
delete pFont;
|
||||
pFont = NULL;
|
||||
}
|
||||
}
|
||||
return pFont;
|
||||
}
|
||||
|
||||
|
||||
Bezier *Builder::getPoints( const char *pTag ) const
|
||||
{
|
||||
vector<float> xBez, yBez;
|
||||
|
|
|
@ -84,6 +84,9 @@ class Builder: public SkinObject
|
|||
int xPos, int yPos, int width, int height,
|
||||
const Box &rBox ) const;
|
||||
|
||||
/// Get a font from its id
|
||||
GenericFont *getFont( const string &fontId );
|
||||
|
||||
/// Function to parse "points" tags
|
||||
Bezier *getPoints( const char *pTag ) const;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue