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 a20a52a2f4
)
Change-Id: I7daa53ff28187056e34efa4e2173dea45a47df27
This commit is contained in:
@@ -158,7 +158,8 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
|
|||||||
|
|
||||||
// add the new physical font face, replacing existing font face if necessary
|
// add the new physical font face, replacing existing font face if necessary
|
||||||
// TODO: get rid of linear search?
|
// 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;
|
PhysicalFontFace* pFoundFontFace = *it;
|
||||||
sal_Int32 eComp = pNewFontFace->CompareWithSize( *pFoundFontFace );
|
sal_Int32 eComp = pNewFontFace->CompareWithSize( *pFoundFontFace );
|
||||||
@@ -177,12 +178,11 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
|
|||||||
|
|
||||||
// replace existing font face with a better one
|
// replace existing font face with a better one
|
||||||
delete pFoundFontFace;
|
delete pFoundFontFace;
|
||||||
it = maFontFaces.erase( it );
|
*it = pNewFontFace; // insert at sort position
|
||||||
maFontFaces.push_back( pNewFontFace );
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
maFontFaces.push_back( pNewFontFace );
|
maFontFaces.insert(it, pNewFontFace); // insert at sort position
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user