summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-08-22 00:37:46 +0100
committerMichael Meeks <michael.meeks@collabora.com>2014-08-22 16:22:14 +0100
commit8d6697587776136f3121733e1c29d4200720dbd9 (patch)
treee8df952d46f1225ed7829dc60a3df72258dc46e3 /vcl
parent46ac7d60dde9a09239709716efcfcf66dd0e0a85 (diff)
fdo#79761 - avoid re-canonicalising each font name on clone repeatedly.
Change-Id: I5b32787943ab3f824249359e9924eae25ba5783b
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/font/PhysicalFontFamily.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx
index 3cba47056f81..6307ac0ea444 100644
--- a/vcl/source/font/PhysicalFontFamily.cxx
+++ b/vcl/source/font/PhysicalFontFamily.cxx
@@ -281,6 +281,10 @@ void PhysicalFontFamily::GetFontHeights( std::set<int>& rHeights ) const
void PhysicalFontFamily::UpdateCloneFontList( PhysicalFontCollection& rFontCollection,
bool bScalable, bool bEmbeddable ) const
{
+ // This is rather expensive to do per face.
+ OUString aFamilyName = GetEnglishSearchFontName( GetFamilyName() );
+ PhysicalFontFamily* pFamily = rFontCollection.FindOrCreateFamily( aFamilyName );
+
for( PhysicalFontFace* pFace = mpFirst; pFace; pFace = pFace->GetNextFace() )
{
if( bScalable && !pFace->IsScalable() )
@@ -289,7 +293,12 @@ void PhysicalFontFamily::UpdateCloneFontList( PhysicalFontCollection& rFontColle
continue;
PhysicalFontFace* pClonedFace = pFace->Clone();
- rFontCollection.Add( pClonedFace );
+
+ assert( pClonedFace->GetFamilyName() == GetFamilyName() );
+ assert( rFontCollection.FindOrCreateFamily( GetEnglishSearchFontName( pClonedFace->GetFamilyName() ) ) == pFamily );
+
+ if (! pFamily->AddFontFace( pClonedFace ) )
+ delete pClonedFace;
}
}