Beispiel #1
0
void SFont::AddInstance( SFontInstance * pcInstance )
{
	g_cFontLock.Lock();
	__assertw( g_cFontLock.IsLocked() );
	m_cInstances[pcInstance->m_cInstanceProperties] = pcInstance;
	g_cFontLock.Unlock();
}
Beispiel #2
0
SFontInstance *SFont::FindInstance( const FontProperty & cFP ) const
{
	std::map <FontProperty, SFontInstance * >::const_iterator i;

	__assertw( g_cFontLock.IsLocked() );
	i = m_cInstances.find( cFP );

	if( i == m_cInstances.end() )
	{
		return ( NULL );
	}
	else
	{
		return ( ( *i ).second );
	}
}
Beispiel #3
0
void SFont::RemoveInstance( SFontInstance * pcInstance )
{
	g_cFontLock.Lock();

	std::map <FontProperty, SFontInstance * >::iterator i;

	__assertw( g_cFontLock.IsLocked() );
	i = m_cInstances.find( pcInstance->m_cInstanceProperties );

	if( i != m_cInstances.end() )
	{
		m_cInstances.erase( i );
	}
	else
	{
		dbprintf( "Error: SFont::RemoveInstance could not find instance\n" );
	}
	if( m_bDeleted && m_cInstances.empty() )
	{
		dbprintf( "Last instance of deleted font %s, %s removed. Deleting font\n", m_pcFamily->GetName().c_str(  ), m_cStyle.c_str(  ) );
		delete this;
	}
	g_cFontLock.Unlock();
}