Kaydet (Commit) e2adbfc3 authored tarafından Michael Meeks's avatar Michael Meeks

vcl: factor out font name lookup for future re-use.

Change-Id: I35f80610862528d7525fa61135604468271ca37a
üst dd1c49d1
...@@ -54,6 +54,7 @@ public: ...@@ -54,6 +54,7 @@ public:
// find the device font // find the device font
PhysicalFontFamily* FindFontFamily( const OUString& rFontName ) const; PhysicalFontFamily* FindFontFamily( const OUString& rFontName ) const;
PhysicalFontFamily* FindOrCreateFamily( const OUString &rFamilyName );
PhysicalFontFamily* ImplFindByFont( FontSelectPattern& ) const; PhysicalFontFamily* ImplFindByFont( FontSelectPattern& ) const;
PhysicalFontFamily* ImplFindBySearchName( const OUString& ) const; PhysicalFontFamily* ImplFindBySearchName( const OUString& ) const;
......
...@@ -353,16 +353,7 @@ void PhysicalFontCollection::Add( PhysicalFontFace* pNewData ) ...@@ -353,16 +353,7 @@ void PhysicalFontCollection::Add( PhysicalFontFace* pNewData )
GetEnglishSearchFontName( aSearchName ); GetEnglishSearchFontName( aSearchName );
PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.find( aSearchName ); PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.find( aSearchName );
PhysicalFontFamily* pFoundData = NULL; PhysicalFontFamily* pFoundData = FindOrCreateFamily( aSearchName );
if( it != maPhysicalFontFamilies.end() )
pFoundData = (*it).second;
if( !pFoundData )
{
pFoundData = new PhysicalFontFamily( aSearchName );
maPhysicalFontFamilies[ aSearchName ] = pFoundData;
}
bool bKeepNewData = pFoundData->AddFontFace( pNewData ); bool bKeepNewData = pFoundData->AddFontFace( pNewData );
...@@ -434,6 +425,23 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( const OUString& rFon ...@@ -434,6 +425,23 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( const OUString& rFon
return pFound; return pFound;
} }
PhysicalFontFamily *PhysicalFontCollection::FindOrCreateFamily( const OUString &rFamilyName )
{
PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.find( rFamilyName );
PhysicalFontFamily* pFoundData = NULL;
if( it != maPhysicalFontFamilies.end() )
pFoundData = (*it).second;
if( !pFoundData )
{
pFoundData = new PhysicalFontFamily( rFamilyName );
maPhysicalFontFamilies[ rFamilyName ] = pFoundData;
}
return pFoundData;
}
PhysicalFontFamily* PhysicalFontCollection::ImplFindByTokenNames(const OUString& rTokenStr) const PhysicalFontFamily* PhysicalFontCollection::ImplFindByTokenNames(const OUString& rTokenStr) const
{ {
PhysicalFontFamily* pFoundData = NULL; PhysicalFontFamily* pFoundData = NULL;
......
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