summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-05-06 15:53:20 +0200
committerMichael Stahl <mstahl@redhat.com>2016-05-06 16:18:29 +0200
commit3b12b5f44c1c46a4aae644a577cb015e2940af59 (patch)
tree8507224712a8bbd04fcfc3098c278c0ce106c8bb /vcl
parentsvtools: FontList loops with > 2^16 fonts (diff)
downloadcore-3b12b5f44c1c46a4aae644a577cb015e2940af59.tar.gz
core-3b12b5f44c1c46a4aae644a577cb015e2940af59.zip
vcl: PhysicalFontFamily::maFontFaces must be sorted
When toggling the "Apply replacement table" setting in Tools->Options->Fonts, the fonts are re-enumerated once per OutputDevice, so if the sorting isn't maintained properly duplicates will be inserted and the number of font faces goes from 400 to 40k. (regression from a20a52a2f47c67ab30bf764d420c663f7173f032) Change-Id: I7daa53ff28187056e34efa4e2173dea45a47df27
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/font/PhysicalFontFamily.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx
index b2eb5ceefe90..a1382a999d02 100644
--- a/vcl/source/font/PhysicalFontFamily.cxx
+++ b/vcl/source/font/PhysicalFontFamily.cxx
@@ -158,7 +158,8 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
// add the new physical font face, replacing existing font face if necessary
// TODO: get rid of linear search?
- for(std::vector< PhysicalFontFace* >::iterator it=maFontFaces.begin(); it != maFontFaces.end(); ++it )
+ auto it(maFontFaces.begin());
+ for (; it != maFontFaces.end(); ++it)
{
PhysicalFontFace* pFoundFontFace = *it;
sal_Int32 eComp = pNewFontFace->CompareWithSize( *pFoundFontFace );
@@ -177,12 +178,11 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
// replace existing font face with a better one
delete pFoundFontFace;
- it = maFontFaces.erase( it );
- maFontFaces.push_back( pNewFontFace );
+ *it = pNewFontFace; // insert at sort position
return true;
}
- maFontFaces.push_back( pNewFontFace );
+ maFontFaces.insert(it, pNewFontFace); // insert at sort position
return true;
}