summaryrefslogtreecommitdiff
path: root/vcl/source/font
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-08-21 23:37:44 +0100
committerMichael Meeks <michael.meeks@collabora.com>2014-08-22 16:22:13 +0100
commite2adbfc33c2cf9ad9844427f6c393da64bf48852 (patch)
tree29ba6044ca179dba6cca28e8082a41d3ac64cc39 /vcl/source/font
parentdd1c49d172e57e08f87ec69c4143f190b2a14a04 (diff)
vcl: factor out font name lookup for future re-use.
Change-Id: I35f80610862528d7525fa61135604468271ca37a
Diffstat (limited to 'vcl/source/font')
-rw-r--r--vcl/source/font/PhysicalFontCollection.cxx28
1 files changed, 18 insertions, 10 deletions
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
index e195065f01a4..15552c4472cb 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -353,16 +353,7 @@ void PhysicalFontCollection::Add( PhysicalFontFace* pNewData )
GetEnglishSearchFontName( aSearchName );
PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.find( aSearchName );
- PhysicalFontFamily* pFoundData = NULL;
-
- if( it != maPhysicalFontFamilies.end() )
- pFoundData = (*it).second;
-
- if( !pFoundData )
- {
- pFoundData = new PhysicalFontFamily( aSearchName );
- maPhysicalFontFamilies[ aSearchName ] = pFoundData;
- }
+ PhysicalFontFamily* pFoundData = FindOrCreateFamily( aSearchName );
bool bKeepNewData = pFoundData->AddFontFace( pNewData );
@@ -434,6 +425,23 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( const OUString& rFon
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* pFoundData = NULL;