* parser/builder.cpp: a font with ID "defaultfont" is loaded from
the common font directory
rManager.setMagnetValue( rData.m_magnet );
rManager.setAlphaValue( rData.m_alpha );
rManager.setMoveAlphaValue( rData.m_moveAlpha );
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() );
+ }
- 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() );
if( pFont == NULL )
{
msg_Err( getIntf(), "Unknown font id: %s", rData.m_fontId.c_str() );
- 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() );
if( pFont == NULL )
{
msg_Err( getIntf(), "Unknown font id: %s", rData.m_fontId.c_str() );
+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;
Bezier *Builder::getPoints( const char *pTag ) const
{
vector<float> xBez, yBez;
int xPos, int yPos, int width, int height,
const Box &rBox ) const;
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;
};
/// Function to parse "points" tags
Bezier *getPoints( const char *pTag ) const;
};