[Libreoffice-commits] .: vcl/unx

Caolán McNamara caolan at kemper.freedesktop.org
Sun Jan 30 09:41:24 PST 2011


 vcl/unx/source/fontmanager/fontmanager.cxx |   25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 6ce730bef2b7ab768c6a9daf80fdd23445b7adc7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 30 17:41:15 2011 +0000

    fdo#33349 archaic 'Berling Antiqua' claims to also be 'Times New Roman'

diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx
index 045da84..0321d90 100644
--- a/vcl/unx/source/fontmanager/fontmanager.cxx
+++ b/vcl/unx/source/fontmanager/fontmanager.cxx
@@ -1794,6 +1794,29 @@ OUString PrintFontManager::convertTrueTypeName( void* pRecord ) const
     return aValue;
 }
 
+//fdo#33349.There exists an archaic Berling Antiqua font which has a "Times New
+//Roman" name field in it. We don't want the "Times New Roman" name to take
+//precedence in this case. We take Berling Antiqua as a higher priority name,
+//and erase the "Times New Roman" name
+namespace
+{
+    bool isBadTNR(const OUString &rName, ::std::set< OUString >& rSet)
+    {
+        bool bRet = false;
+        if (rName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Berling Antiqua")))
+        {
+            ::std::set< OUString >::iterator aEnd = rSet.end();
+            ::std::set< OUString >::iterator aI = rSet.find(OUString(RTL_CONSTASCII_USTRINGPARAM("Times New Roman")));
+            if (aI != aEnd)
+            {
+                bRet = true;
+                rSet.erase(aI);
+            }
+        }
+        return bRet;
+    }
+}
+
 // -------------------------------------------------------------------------
 
 void PrintFontManager::analyzeTrueTypeFamilyName( void* pTTFont, ::std::list< OUString >& rNames ) const
@@ -1831,7 +1854,7 @@ void PrintFontManager::analyzeTrueTypeFamilyName( void* pTTFont, ::std::list< OU
             }
             OUString aName = convertTrueTypeName( pNameRecords + i );
             aSet.insert( aName );
-            if( nMatch > nLastMatch )
+            if( nMatch > nLastMatch || isBadTNR(aName, aSet) )
             {
                 nLastMatch = nMatch;
                 aFamily = aName;


More information about the Libreoffice-commits mailing list