vcl/inc/unx/fontmanager.hxx                 |  114 ++------
 vcl/inc/unx/printergfx.hxx                  |   23 -
 vcl/unx/generic/fontmanager/fontcache.cxx   |  123 +-------
 vcl/unx/generic/fontmanager/fontconfig.cxx  |    6 
 vcl/unx/generic/fontmanager/fontmanager.cxx |  368 +++++++-------------------
 vcl/unx/generic/print/genpspgraphics.cxx    |   58 +---
 vcl/unx/generic/print/glyphset.cxx          |  319 -----------------------
 vcl/unx/generic/print/glyphset.hxx          |   27 -
 vcl/unx/generic/print/text_gfx.cxx          |  387 ----------------------------
 9 files changed, 196 insertions(+), 1229 deletions(-)

New commits:
commit 30ebc895c95ee66adf172717249aa1789b309eff
Author: Khaled Hosny <khaledho...@eglug.org>
Date:   Fri Nov 25 09:19:15 2016 +0200

    There is one font file type now
    
    Change-Id: I47b6f36de5c77cfdf831a2b3ce10b973159520b1
    Reviewed-on: https://gerrit.libreoffice.org/31231
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledho...@eglug.org>

diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index a7a2753..0a2de15 100644
--- a/vcl/inc/unx/fontmanager.hxx
+++ b/vcl/inc/unx/fontmanager.hxx
@@ -53,14 +53,6 @@ class FontSelectPattern;
 namespace psp {
 class PPDParser;
 
-namespace fonttype
-{
-enum type {
-    Unknown = 0,
-    TrueType = 2,
-};
-}
-
 /*
  *  the difference between FastPrintFontInfo and PrintFontInfo
  *  is that the information in FastPrintFontInfo can usually
@@ -74,7 +66,6 @@ enum type {
 struct FastPrintFontInfo
 {
     fontID                         m_nID; // FontID
-    fonttype::type                 m_eType;
 
     // font attributes
     OUString                       m_aFamilyName;
@@ -90,7 +81,6 @@ struct FastPrintFontInfo
 
     FastPrintFontInfo()
         : m_nID(0)
-        , m_eType(fonttype::Unknown)
         , m_eFamilyStyle(FAMILY_DONTKNOW)
         , m_eItalic(ITALIC_DONTKNOW)
         , m_eWidth(WIDTH_DONTKNOW)
@@ -131,16 +121,13 @@ struct CharacterMetric
 class FontCache;
 
 // a class to manage printable fonts
-// aims are type1 and truetype fonts
 
 class FontCache;
 
 class VCL_PLUGIN_PUBLIC PrintFontManager
 {
     struct PrintFont;
-    struct TrueTypeFontFile;
     friend struct PrintFont;
-    friend struct TrueTypeFontFile;
     friend class FontCache;
 
     struct PrintFontMetrics
@@ -171,46 +158,37 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
 
     struct PrintFont
     {
-        fonttype::type                              m_eType;
-
         // font attributes
-        int                                         m_nFamilyName;  // atom
-        std::vector< int >                          m_aAliases;
-        int                                         m_nPSName;      // atom
-        OUString                                    m_aStyleName;
-        FontItalic                                  m_eItalic;
-        FontWidth                                   m_eWidth;
-        FontWeight                                  m_eWeight;
-        FontPitch                                   m_ePitch;
-        rtl_TextEncoding                            m_aEncoding;
-        CharacterMetric                             m_aGlobalMetricX;
-        CharacterMetric                             m_aGlobalMetricY;
-        PrintFontMetrics*                           m_pMetrics;
-        int                                         m_nAscend;
-        int                                         m_nDescend;
-        int                                         m_nLeading;
-        int                                         m_nXMin; // font bounding 
box
-        int                                         m_nYMin;
-        int                                         m_nXMax;
-        int                                         m_nYMax;
-        bool                                        
m_bHaveVerticalSubstitutedGlyphs;
-        bool                                        m_bUserOverride;
-
-        explicit PrintFont( fonttype::type eType );
-        virtual ~PrintFont();
-        virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* 
pProvider ) = 0;
-    };
-
-    struct TrueTypeFontFile : public PrintFont
-    {
-        int           m_nDirectory;       // atom containing system dependent 
path
-        OString  m_aFontFile;        // relative to directory
-        int           m_nCollectionEntry; // 0 for regular fonts, 0 to ... for 
fonts stemming from collections
-        unsigned int  m_nTypeFlags;       // copyright bits and PS-OpenType 
flag
-
-        TrueTypeFontFile();
-        virtual ~TrueTypeFontFile() override;
-        virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* 
pProvider ) override;
+        int               m_nFamilyName;  // atom
+        std::vector<int>  m_aAliases;
+        int               m_nPSName;      // atom
+        OUString          m_aStyleName;
+        FontItalic        m_eItalic;
+        FontWidth         m_eWidth;
+        FontWeight        m_eWeight;
+        FontPitch         m_ePitch;
+        rtl_TextEncoding  m_aEncoding;
+        CharacterMetric   m_aGlobalMetricX;
+        CharacterMetric   m_aGlobalMetricY;
+        PrintFontMetrics* m_pMetrics;
+        int               m_nAscend;
+        int               m_nDescend;
+        int               m_nLeading;
+        int               m_nXMin; // font bounding box
+        int               m_nYMin;
+        int               m_nXMax;
+        int               m_nYMax;
+        bool              m_bHaveVerticalSubstitutedGlyphs;
+        bool              m_bUserOverride;
+
+        int               m_nDirectory;       // atom containing system 
dependent path
+        OString           m_aFontFile;        // relative to directory
+        int               m_nCollectionEntry; // 0 for regular fonts, 0 to ... 
for fonts stemming from collections
+        unsigned int      m_nTypeFlags;       // copyright bits and 
PS-OpenType flag
+
+        explicit PrintFont();
+        ~PrintFont();
+        bool queryMetricPage(int nPage, utl::MultiAtomProvider* pProvider);
     };
 
     fontID                                      m_nNextFontID;
@@ -233,14 +211,14 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
     OString getFontFile( PrintFont* pFont ) const;
 
     bool analyzeFontFile( int nDirID, const OString& rFileName, std::list< 
PrintFont* >& rNewFonts, const char *pFormat=nullptr ) const;
-    static OUString convertTrueTypeName( void* pNameRecord ); // actually a 
NameRecord* formt font subsetting code
-    static void analyzeTrueTypeFamilyName( void* pTTFont, std::list< OUString 
>& rnames ); // actually a TrueTypeFont* from font subsetting code
-    bool analyzeTrueTypeFile( PrintFont* pFont ) const;
+    static OUString convertSfntName( void* pNameRecord ); // actually a 
NameRecord* formt font subsetting code
+    static void analyzeSfntFamilyName( void* pTTFont, std::list< OUString >& 
rnames ); // actually a TrueTypeFont* from font subsetting code
+    bool analyzeSfntFile(PrintFont* pFont) const;
     // finds the font id for the nFaceIndex face in this font file
-    // There may be multiple font ids for TrueType collections
+    // There may be multiple font ids for font collections
     fontID findFontFileID( int nDirID, const OString& rFile, int nFaceIndex ) 
const;
 
-    // There may be multiple font ids for TrueType collections
+    // There may be multiple font ids for font collections
     std::vector<fontID> findFontFileIDs( int nDirID, const OString& rFile ) 
const;
 
     static FontFamily matchFamilyName( const OUString& rFamily );
@@ -293,7 +271,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
 public:
     static PrintFontManager& get(); // one instance only
 
-    // There may be multiple font ids for TrueType collections
+    // There may be multiple font ids for font collections
     std::vector<fontID> addFontFile( const OString& rFileName );
 
     void initialize();
@@ -311,13 +289,6 @@ public:
     // get a specific fonts PSName name
     const OUString& getPSName( fontID nFontID ) const;
 
-    // get a specific fonts type
-    fonttype::type getFontType( fontID nFontID ) const
-    {
-        PrintFont* pFont = getFont( nFontID );
-        return pFont ? pFont->m_eType : fonttype::Unknown;
-    }
-
     // get a specific fonts italic type
     FontItalic getFontItalic( fontID nFontID ) const
     {
@@ -363,7 +334,7 @@ public:
     // the user is responsible to allocate pArray large enough
     bool getMetrics( fontID nFontID, const sal_Unicode* pString, int nLen, 
CharacterMetric* pArray ) const;
 
-    // creates a new font subset of an existing TrueType font
+    // creates a new font subset of an existing SFNT font
     // returns true in case of success, else false
     // nFont: the font to be subsetted
     // rOutFile: the file to put the new subset into;
diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx 
b/vcl/unx/generic/fontmanager/fontcache.cxx
index 5c6df51..7407efb 100644
--- a/vcl/unx/generic/fontmanager/fontcache.cxx
+++ b/vcl/unx/generic/fontmanager/fontcache.cxx
@@ -37,7 +37,7 @@
 #include <cstdio>
 #endif
 
-#define CACHE_MAGIC "LibreOffice PspFontCacheFile format 7"
+#define CACHE_MAGIC "LibreOffice PspFontCacheFile format 8"
 
 using namespace std;
 using namespace psp;
@@ -133,9 +133,7 @@ void FontCache::flush()
             aStream.WriteLine(aLine.makeStringAndClear());
 
             int nEntrySize = entry_it->second.m_aEntry.size();
-            // write: type;nfonts
-            aLine.append(static_cast<sal_Int32>(rEntry.front()->m_eType));
-            aLine.append(';');
+            // write: nfonts
             aLine.append(static_cast<sal_Int32>(nEntrySize));
             aStream.WriteLine(aLine.makeStringAndClear());
 
@@ -148,7 +146,7 @@ void FontCache::flush()
                  *  
fontnr;PSName;italic;weight;width;pitch;encoding;ascend;descend;leading;vsubst;gxw;gxh;gyw;gyh;useroverride;embed;antialias[;{metricfile,typeflags}][;stylename]
                  */
                 if( nEntrySize > 1 )
-                    nSubEntry = static_cast<const 
PrintFontManager::TrueTypeFontFile*>(*it)->m_nCollectionEntry;
+                    nSubEntry = (*it)->m_nCollectionEntry;
                 else
                     nSubEntry = 0;
 
@@ -200,15 +198,8 @@ void FontCache::flush()
                 aLine.append(static_cast<sal_Int32>(0));
                 aLine.append(';');
                 aLine.append(static_cast<sal_Int32>(0));
-
-                switch( (*it)->m_eType )
-                {
-                    case fonttype::TrueType:
-                        aLine.append(';');
-                        aLine.append(static_cast<sal_Int32>(static_cast<const 
PrintFontManager::TrueTypeFontFile*>(*it)->m_nTypeFlags));
-                        break;
-                    default: break;
-                }
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_nTypeFlags));
                 if( !(*it)->m_aStyleName.isEmpty() )
                 {
                     aLine.append(';');
@@ -308,15 +299,6 @@ void FontCache::read()
 
             const char* pLine = aLine.getStr();
 
-            fonttype::type eType = (fonttype::type)atoi( pLine );
-            if( eType != fonttype::TrueType )
-                continue;
-            while( *pLine && *pLine != ';' )
-                pLine++;
-            if( *pLine != ';' )
-                continue;
-
-            pLine++;
             sal_Int32 nFonts = atoi( pLine );
             for( int n = 0; n < nFonts; n++ )
             {
@@ -324,14 +306,7 @@ void FontCache::read()
                 pLine = aLine.getStr();
                 int nLen = aLine.getLength();
 
-                PrintFontManager::PrintFont* pFont = nullptr;
-                switch( eType )
-                {
-                    case fonttype::TrueType:
-                        pFont = new PrintFontManager::TrueTypeFontFile();
-                        break;
-                    default: break;
-                }
+                PrintFontManager::PrintFont* pFont = new 
PrintFontManager::PrintFont();
 
                 sal_Int32 nIndex;
 
@@ -397,18 +372,11 @@ void FontCache::read()
                 pFont->m_bUserOverride
                                     = (atoi( pLine + nTokenPos[15] ) != 0);
                 int nStyleTokenNr = 18;
-                switch( eType )
-                {
-                    case fonttype::TrueType:
-                        
static_cast<PrintFontManager::TrueTypeFontFile*>(pFont)->m_nTypeFlags = atoi( 
pLine + nTokenPos[18] );
-                        
static_cast<PrintFontManager::TrueTypeFontFile*>(pFont)->m_nCollectionEntry = 
nCollEntry;
-                        
static_cast<PrintFontManager::TrueTypeFontFile*>(pFont)->m_nDirectory = nDir;
-                        
static_cast<PrintFontManager::TrueTypeFontFile*>(pFont)->m_aFontFile = aFile;
-                        nStyleTokenNr++;
-                        break;
-                    break;
-                    default: break;
-                }
+                pFont->m_nTypeFlags = atoi( pLine + nTokenPos[18] );
+                pFont->m_nCollectionEntry = nCollEntry;
+                pFont->m_nDirectory = nDir;
+                pFont->m_aFontFile = aFile;
+                nStyleTokenNr++;
                 if( nTokens > nStyleTokenNr )
                     pFont->m_aStyleName = OUString::intern( pLine + 
nTokenPos[nStyleTokenNr],
                                                             nLen - 
nTokenPos[nStyleTokenNr],
@@ -459,18 +427,10 @@ void FontCache::read()
  */
 void FontCache::copyPrintFont( const PrintFontManager::PrintFont* pFrom, 
PrintFontManager::PrintFont* pTo )
 {
-    if( pFrom->m_eType != pTo->m_eType )
-        return;
-    switch( pFrom->m_eType )
-    {
-        case fonttype::TrueType:
-            
static_cast<PrintFontManager::TrueTypeFontFile*>(pTo)->m_nDirectory = 
static_cast<const PrintFontManager::TrueTypeFontFile*>(pFrom)->m_nDirectory;
-            static_cast<PrintFontManager::TrueTypeFontFile*>(pTo)->m_aFontFile 
= static_cast<const PrintFontManager::TrueTypeFontFile*>(pFrom)->m_aFontFile;
-            
static_cast<PrintFontManager::TrueTypeFontFile*>(pTo)->m_nCollectionEntry = 
static_cast<const 
PrintFontManager::TrueTypeFontFile*>(pFrom)->m_nCollectionEntry;
-            
static_cast<PrintFontManager::TrueTypeFontFile*>(pTo)->m_nTypeFlags = 
static_cast<const PrintFontManager::TrueTypeFontFile*>(pFrom)->m_nTypeFlags;
-            break;
-        default: break;
-    }
+    pTo->m_nDirectory       = pFrom->m_nDirectory;
+    pTo->m_aFontFile        = pFrom->m_aFontFile;
+    pTo->m_nCollectionEntry = pFrom->m_nCollectionEntry;
+    pTo->m_nTypeFlags       = pFrom->m_nTypeFlags;
     pTo->m_nFamilyName      = pFrom->m_nFamilyName;
     pTo->m_aStyleName       = pFrom->m_aStyleName;
     pTo->m_aAliases         = pFrom->m_aAliases;
@@ -498,24 +458,11 @@ void FontCache::copyPrintFont( const 
PrintFontManager::PrintFont* pFrom, PrintFo
  */
 bool FontCache::equalsPrintFont( const PrintFontManager::PrintFont* pLeft, 
PrintFontManager::PrintFont* pRight )
 {
-    if( pLeft->m_eType != pRight->m_eType )
-        return false;
-    switch( pLeft->m_eType )
-    {
-        case fonttype::TrueType:
-        {
-            const PrintFontManager::TrueTypeFontFile* pLT = static_cast<const 
PrintFontManager::TrueTypeFontFile*>(pLeft);
-            const PrintFontManager::TrueTypeFontFile* pRT = static_cast<const 
PrintFontManager::TrueTypeFontFile*>(pRight);
-            if( pRT->m_nDirectory       != pLT->m_nDirectory        ||
-                pRT->m_aFontFile        != pLT->m_aFontFile         ||
-                pRT->m_nCollectionEntry != pLT->m_nCollectionEntry  ||
-                pRT->m_nTypeFlags       != pLT->m_nTypeFlags )
-                return false;
-        }
-        break;
-        default: break;
-    }
-    if( pRight->m_nFamilyName       != pLeft->m_nFamilyName     ||
+    if (pRight->m_nDirectory        != pLeft->m_nDirectory      ||
+        pRight->m_aFontFile         != pLeft->m_aFontFile       ||
+        pRight->m_nCollectionEntry  != pLeft->m_nCollectionEntry ||
+        pRight->m_nTypeFlags        != pLeft->m_nTypeFlags      ||
+        pRight->m_nFamilyName       != pLeft->m_nFamilyName     ||
         pRight->m_aStyleName        != pLeft->m_aStyleName      ||
         pRight->m_nPSName           != pLeft->m_nPSName         ||
         pRight->m_eItalic           != pLeft->m_eItalic         ||
@@ -549,18 +496,8 @@ bool FontCache::equalsPrintFont( const 
PrintFontManager::PrintFont* pLeft, Print
  */
 PrintFontManager::PrintFont* FontCache::clonePrintFont( const 
PrintFontManager::PrintFont* pOldFont )
 {
-    PrintFontManager::PrintFont* pFont = nullptr;
-    switch( pOldFont->m_eType )
-    {
-        case fonttype::TrueType:
-            pFont = new PrintFontManager::TrueTypeFontFile();
-            break;
-        default: break;
-    }
-    if( pFont )
-    {
-        copyPrintFont( pOldFont, pFont );
-    }
+    PrintFontManager::PrintFont* pFont = new PrintFontManager::PrintFont();
+    copyPrintFont( pOldFont, pFont );
     return pFont;
  }
 
@@ -595,15 +532,8 @@ void FontCache::updateFontCacheEntry( const 
PrintFontManager::PrintFont* pFont,
 {
     OString aFile;
     int nDirID = 0;
-    switch( pFont->m_eType )
-    {
-        case fonttype::TrueType:
-            nDirID = static_cast<const 
PrintFontManager::TrueTypeFontFile*>(pFont)->m_nDirectory;
-            aFile = static_cast<const 
PrintFontManager::TrueTypeFontFile*>(pFont)->m_aFontFile;
-            break;
-        default:
-            return;
-    }
+    nDirID = pFont->m_nDirectory;
+    aFile  = pFont->m_aFontFile;
     FontCacheData::const_iterator dir = m_aCache.find( nDirID );
     FontDirMap::const_iterator entry;
     std::list< PrintFontManager::PrintFont* >::const_iterator font;
@@ -616,10 +546,7 @@ void FontCache::updateFontCacheEntry( const 
PrintFontManager::PrintFont* pFont,
         {
             for( font = entry->second.m_aEntry.begin(); font != 
entry->second.m_aEntry.end(); ++font )
             {
-                if( (*font)->m_eType == pFont->m_eType &&
-                    ( (*font)->m_eType != fonttype::TrueType ||
-                      static_cast<const 
PrintFontManager::TrueTypeFontFile*>(*font)->m_nCollectionEntry == 
static_cast<const 
PrintFontManager::TrueTypeFontFile*>(pFont)->m_nCollectionEntry
-                      ) )
+                if ((*font)->m_nCollectionEntry == pFont->m_nCollectionEntry)
                     break;
             }
             if( font != entry->second.m_aEntry.end() )
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx 
b/vcl/unx/generic/fontmanager/fontconfig.cxx
index ea01866..538bdba 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -593,8 +593,7 @@ void PrintFontManager::countFontconfigFonts( 
std::unordered_map<OString, int, OS
                 {
                     for( std::list< PrintFont* >::iterator it = 
aFonts.begin(); it != aFonts.end(); ++it )
                     {
-                        if( (*it)->m_eType == fonttype::TrueType &&
-                            
static_cast<TrueTypeFontFile*>(*it)->m_nCollectionEntry == nCollectionEntry )
+                        if( (*it)->m_nCollectionEntry == nCollectionEntry )
                         {
                             pUpdate = *it;
                             break;
@@ -604,8 +603,7 @@ void PrintFontManager::countFontconfigFonts( 
std::unordered_map<OString, int, OS
                     // additional entries will be created in the cache
                     // if this is a new index (that is if the loop above
                     // ran to the end of the list)
-                    if( pUpdate->m_eType == fonttype::TrueType ) // sanity 
check, this should always be the case here
-                        
static_cast<TrueTypeFontFile*>(pUpdate)->m_nCollectionEntry = nCollectionEntry;
+                    pUpdate->m_nCollectionEntry = nCollectionEntry;
                 }
                 else
                 {
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx 
b/vcl/unx/generic/fontmanager/fontmanager.cxx
index 152c01b..dbd816e 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -94,25 +94,27 @@ inline sal_uInt16 getUInt16BE( const sal_uInt8*& pBuffer )
 /*
  *  PrintFont implementations
  */
-PrintFontManager::PrintFont::PrintFont( fonttype::type eType ) :
-        m_eType( eType ),
-        m_nFamilyName( 0 ),
-        m_nPSName( 0 ),
-        m_eItalic( ITALIC_DONTKNOW ),
-        m_eWidth( WIDTH_DONTKNOW ),
-        m_eWeight( WEIGHT_DONTKNOW ),
-        m_ePitch( PITCH_DONTKNOW ),
-        m_aEncoding( RTL_TEXTENCODING_DONTKNOW ),
-        m_pMetrics( nullptr ),
-        m_nAscend( 0 ),
-        m_nDescend( 0 ),
-        m_nLeading( 0 ),
-        m_nXMin( 0 ),
-        m_nYMin( 0 ),
-        m_nXMax( 0 ),
-        m_nYMax( 0 ),
-        m_bHaveVerticalSubstitutedGlyphs( false ),
-        m_bUserOverride( false )
+PrintFontManager::PrintFont::PrintFont()
+:   m_nFamilyName(0)
+,   m_nPSName(0)
+,   m_eItalic(ITALIC_DONTKNOW)
+,   m_eWidth(WIDTH_DONTKNOW)
+,   m_eWeight(WEIGHT_DONTKNOW)
+,   m_ePitch(PITCH_DONTKNOW)
+,   m_aEncoding(RTL_TEXTENCODING_DONTKNOW)
+,   m_pMetrics(nullptr)
+,   m_nAscend(0)
+,   m_nDescend(0)
+,   m_nLeading(0)
+,   m_nXMin(0)
+,   m_nYMin(0)
+,   m_nXMax(0)
+,   m_nYMax(0)
+,   m_bHaveVerticalSubstitutedGlyphs(false)
+,   m_bUserOverride( false )
+,   m_nDirectory(0)
+,   m_nCollectionEntry(0)
+,   m_nTypeFlags(TYPEFLAG_INVALID)
 {
 }
 
@@ -121,18 +123,7 @@ PrintFontManager::PrintFont::~PrintFont()
     delete m_pMetrics;
 }
 
-PrintFontManager::TrueTypeFontFile::TrueTypeFontFile()
-:   PrintFont( fonttype::TrueType )
-,   m_nDirectory( 0 )
-,   m_nCollectionEntry( 0 )
-,   m_nTypeFlags( TYPEFLAG_INVALID )
-{}
-
-PrintFontManager::TrueTypeFontFile::~TrueTypeFontFile()
-{
-}
-
-bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, 
MultiAtomProvider* /*pProvider*/ )
+bool PrintFontManager::PrintFont::queryMetricPage( int nPage, 
MultiAtomProvider* /*pProvider*/ )
 {
     bool bSuccess = false;
 
@@ -365,11 +356,11 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const 
OString& rFontFile, ::
 
             for( int i = 0; i < nLength; i++ )
             {
-                TrueTypeFontFile* pFont     = new TrueTypeFontFile();
+                PrintFont* pFont     = new PrintFont();
                 pFont->m_nDirectory         = nDirID;
                 pFont->m_aFontFile          = rFontFile;
                 pFont->m_nCollectionEntry   = i;
-                if( ! analyzeTrueTypeFile( pFont ) )
+                if (!analyzeSfntFile(pFont))
                 {
                     delete pFont;
                     pFont = nullptr;
@@ -380,13 +371,13 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const 
OString& rFontFile, ::
         }
         else
         {
-            TrueTypeFontFile* pFont     = new TrueTypeFontFile();
+            PrintFont* pFont     = new PrintFont();
             pFont->m_nDirectory         = nDirID;
             pFont->m_aFontFile          = rFontFile;
             pFont->m_nCollectionEntry   = 0;
 
             // need to read the font anyway to get aliases inside the font file
-            if( ! analyzeTrueTypeFile( pFont ) )
+            if (!analyzeSfntFile(pFont))
             {
                 delete pFont;
                 pFont = nullptr;
@@ -411,19 +402,10 @@ fontID PrintFontManager::findFontFileID( int nDirID, 
const OString& rFontFile, i
         std::unordered_map< fontID, PrintFont* >::const_iterator it = 
m_aFonts.find( *font_it );
         if( it == m_aFonts.end() )
             continue;
-        switch( it->second->m_eType )
-        {
-            case fonttype::TrueType:
-            {
-                TrueTypeFontFile* const pFont = static_cast< TrueTypeFontFile* 
const >((*it).second);
-                if( pFont->m_nDirectory == nDirID &&
-                    pFont->m_aFontFile == rFontFile && 
pFont->m_nCollectionEntry == nFaceIndex )
-                        nID = it->first;
-            }
-            break;
-            default:
-                break;
-        }
+        PrintFont* const pFont = (*it).second;
+        if (pFont->m_nDirectory == nDirID &&
+            pFont->m_aFontFile == rFontFile && pFont->m_nCollectionEntry == 
nFaceIndex)
+                nID = it->first;
     }
 
     return nID;
@@ -442,25 +424,16 @@ std::vector<fontID> PrintFontManager::findFontFileIDs( 
int nDirID, const OString
         std::unordered_map< fontID, PrintFont* >::const_iterator it = 
m_aFonts.find( *font_it );
         if( it == m_aFonts.end() )
             continue;
-        switch( it->second->m_eType )
-        {
-            case fonttype::TrueType:
-            {
-                TrueTypeFontFile* const pFont = static_cast< TrueTypeFontFile* 
const >((*it).second);
-                if( pFont->m_nDirectory == nDirID &&
-                    pFont->m_aFontFile == rFontFile )
-                    aIds.push_back(it->first);
-            }
-            break;
-            default:
-                break;
-        }
+         PrintFont* const pFont = (*it).second;
+         if (pFont->m_nDirectory == nDirID &&
+             pFont->m_aFontFile == rFontFile)
+             aIds.push_back(it->first);
     }
 
     return aIds;
 }
 
-OUString PrintFontManager::convertTrueTypeName( void* pRecord )
+OUString PrintFontManager::convertSfntName( void* pRecord )
 {
     NameRecord* pNameRecord = static_cast<NameRecord*>(pRecord);
     OUString aValue;
@@ -605,7 +578,7 @@ namespace
     }
 }
 
-void PrintFontManager::analyzeTrueTypeFamilyName( void* pTTFont, ::std::list< 
OUString >& rNames )
+void PrintFontManager::analyzeSfntFamilyName( void* pTTFont, ::std::list< 
OUString >& rNames )
 {
     OUString aFamily;
 
@@ -650,7 +623,7 @@ void PrintFontManager::analyzeTrueTypeFamilyName( void* 
pTTFont, ::std::list< OU
                 else
                     nMatch = 1000;
             }
-            OUString aName = convertTrueTypeName( pNameRecords + i );
+            OUString aName = convertSfntName( pNameRecords + i );
             aSet.insert( aName );
             if (aName.isEmpty())
                 continue;
@@ -672,21 +645,20 @@ void PrintFontManager::analyzeTrueTypeFamilyName( void* 
pTTFont, ::std::list< OU
     return;
 }
 
-bool PrintFontManager::analyzeTrueTypeFile( PrintFont* pFont ) const
+bool PrintFontManager::analyzeSfntFile( PrintFont* pFont ) const
 {
     bool bSuccess = false;
     rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
     OString aFile = getFontFile( pFont );
     TrueTypeFont* pTTFont = nullptr;
 
-    TrueTypeFontFile* pTTFontFile = static_cast< TrueTypeFontFile* >(pFont);
-    if( OpenTTFontFile( aFile.getStr(), pTTFontFile->m_nCollectionEntry, 
&pTTFont ) == SF_OK )
+    if( OpenTTFontFile( aFile.getStr(), pFont->m_nCollectionEntry, &pTTFont ) 
== SF_OK )
     {
         TTGlobalFontInfo aInfo;
         GetTTGlobalFontInfo( pTTFont, & aInfo );
 
         ::std::list< OUString > aNames;
-        analyzeTrueTypeFamilyName( pTTFont, aNames );
+        analyzeSfntFamilyName( pTTFont, aNames );
 
         // set family name from XLFD if possible
         if( ! pFont->m_nFamilyName )
@@ -702,11 +674,11 @@ bool PrintFontManager::analyzeTrueTypeFile( PrintFont* 
pFont ) const
 
                  // poor font does not have a family name
                  // name it to file name minus the extension
-                 dotIndex = pTTFontFile->m_aFontFile.lastIndexOf( '.' );
+                 dotIndex = pFont->m_aFontFile.lastIndexOf( '.' );
                  if ( dotIndex == -1 )
-                     dotIndex = pTTFontFile->m_aFontFile.getLength();
+                     dotIndex = pFont->m_aFontFile.getLength();
 
-                 pFont->m_nFamilyName = m_pAtoms->getAtom( ATOM_FAMILYNAME, 
OStringToOUString( pTTFontFile->m_aFontFile.copy( 0, dotIndex ), aEncoding ) );
+                 pFont->m_nFamilyName = m_pAtoms->getAtom( ATOM_FAMILYNAME, 
OStringToOUString( pFont->m_aFontFile.copy( 0, dotIndex ), aEncoding ) );
             }
         }
         for( ::std::list< OUString >::iterator it = aNames.begin(); it != 
aNames.end(); ++it )
@@ -814,7 +786,7 @@ bool PrintFontManager::analyzeTrueTypeFile( PrintFont* 
pFont ) const
         pFont->m_nYMax = aInfo.yMax;
 
         // get type flags
-        pTTFontFile->m_nTypeFlags = (unsigned int)aInfo.typeFlags;
+        pFont->m_nTypeFlags = (unsigned int)aInfo.typeFlags;
 
         // get vertical substitutions flag
         pFont->m_bHaveVerticalSubstitutedGlyphs = DoesVerticalSubstitution( 
pTTFont, 1 );
@@ -941,15 +913,10 @@ void PrintFontManager::initialize()
             {
                 fontID aFont = m_nNextFontID++;
                 m_aFonts[ aFont ] = *it;
-                if( (*it)->m_eType == fonttype::TrueType )
-                    m_aFontFileToFontID[ 
static_cast<TrueTypeFontFile*>(*it)->m_aFontFile ].insert( aFont );
-#if OSL_DEBUG_LEVEL > 1
-                else
-                    fprintf(stderr, "Un-cached type '%d'\n", (*it)->m_eType);
+                m_aFontFileToFontID[(*it)->m_aFontFile].insert(aFont);
 #if OSL_DEBUG_LEVEL > 2
                 fprintf( stderr, "adding cached font %d: %s\n", aFont, 
getFontFileSysPath( aFont ).getStr() );
 #endif
-#endif
             }
             if( ! m_pFontCache->scanAdditionalFiles( aPath ) )
                 continue;
@@ -1004,7 +971,6 @@ void PrintFontManager::fillPrintFontInfo( PrintFont* 
pFont, FastPrintFontInfo& r
 {
     std::unordered_map< int, FontFamily >::const_iterator style_it =
           m_aFamilyTypes.find( pFont->m_nFamilyName );
-    rInfo.m_eType           = pFont->m_eType;
     rInfo.m_aFamilyName     = m_pAtoms->getString( ATOM_FAMILYNAME, 
pFont->m_nFamilyName );
     rInfo.m_aStyleName      = pFont->m_aStyleName;
     rInfo.m_eFamilyStyle    = style_it != m_aFamilyTypes.end() ? 
style_it->second : FAMILY_DONTKNOW;
@@ -1014,7 +980,7 @@ void PrintFontManager::fillPrintFontInfo( PrintFont* 
pFont, FastPrintFontInfo& r
     rInfo.m_ePitch          = pFont->m_ePitch;
     rInfo.m_aEncoding       = pFont->m_aEncoding;
 
-    rInfo.m_bSubsettable = (pFont->m_eType == fonttype::TrueType); // TODO: 
rename to SfntType
+    rInfo.m_bSubsettable    = true;
 
     rInfo.m_aAliases.clear();
     for( int i : pFont->m_aAliases )
@@ -1027,9 +993,7 @@ void PrintFontManager::fillPrintFontInfo( PrintFont* 
pFont, PrintFontInfo& rInfo
         ! pFont->m_pMetrics || pFont->m_pMetrics->isEmpty()
         )
     {
-        // might be a truetype font not analyzed
-        if( pFont->m_eType == fonttype::TrueType )
-            analyzeTrueTypeFile( pFont );
+        analyzeSfntFile(pFont);
     }
 
     fillPrintFontInfo( pFont, static_cast< FastPrintFontInfo& >( rInfo ) );
@@ -1069,8 +1033,7 @@ void PrintFontManager::getFontBoundingBox( fontID 
nFontID, int& xMin, int& yMin,
     {
         if( pFont->m_nXMin == 0 && pFont->m_nYMin == 0 && pFont->m_nXMax == 0 
&& pFont->m_nYMax == 0 )
         {
-            if( pFont->m_eType == fonttype::TrueType )
-                analyzeTrueTypeFile( pFont );
+            analyzeSfntFile(pFont);
         }
         xMin = pFont->m_nXMin;
         yMin = pFont->m_nYMin;
@@ -1083,8 +1046,7 @@ int PrintFontManager::getFontFaceNumber( fontID nFontID ) 
const
 {
     int nRet = 0;
     PrintFont* pFont = getFont( nFontID );
-    if( pFont && pFont->m_eType == fonttype::TrueType )
-        nRet = static_cast< TrueTypeFontFile* >(pFont)->m_nCollectionEntry;
+    nRet = pFont->m_nCollectionEntry;
     if (nRet < 0)
         nRet = 0;
     return nRet;
@@ -1159,13 +1121,12 @@ OString PrintFontManager::getFontFile( PrintFont* pFont 
) const
 {
     OString aPath;
 
-    if( pFont && pFont->m_eType == fonttype::TrueType )
+    if (pFont)
     {
-        TrueTypeFontFile* pTTFont = static_cast< TrueTypeFontFile* >(pFont);
-        std::unordered_map< int, OString >::const_iterator it = 
m_aAtomToDir.find( pTTFont->m_nDirectory );
+        std::unordered_map< int, OString >::const_iterator it = 
m_aAtomToDir.find(pFont->m_nDirectory);
         aPath = it->second;
         aPath += "/";
-        aPath += pTTFont->m_aFontFile;
+        aPath += pFont->m_aFontFile;
     }
     return aPath;
 }
@@ -1175,8 +1136,7 @@ const OUString& PrintFontManager::getPSName( fontID 
nFontID ) const
     PrintFont* pFont = getFont( nFontID );
     if( pFont && pFont->m_nPSName == 0 )
     {
-        if( pFont->m_eType == fonttype::TrueType )
-            analyzeTrueTypeFile( pFont );
+        analyzeSfntFile(pFont);
     }
 
     return m_pAtoms->getString( ATOM_PSNAME, pFont ? pFont->m_nPSName : 
INVALID_ATOM );
@@ -1187,9 +1147,7 @@ int PrintFontManager::getFontAscend( fontID nFontID ) 
const
     PrintFont* pFont = getFont( nFontID );
     if (pFont && pFont->m_nAscend == 0 && pFont->m_nDescend == 0)
     {
-        // might be a truetype font not yet analyzed
-        if( pFont->m_eType == fonttype::TrueType )
-            analyzeTrueTypeFile( pFont );
+        analyzeSfntFile(pFont);
     }
     return pFont ? pFont->m_nAscend : 0;
 }
@@ -1199,9 +1157,7 @@ int PrintFontManager::getFontDescend( fontID nFontID ) 
const
     PrintFont* pFont = getFont( nFontID );
     if (pFont && pFont->m_nAscend == 0 && pFont->m_nDescend == 0)
     {
-        // might be a truetype font not yet analyzed
-        if( pFont->m_eType == fonttype::TrueType )
-            analyzeTrueTypeFile( pFont );
+        analyzeSfntFile(pFont);
     }
     return pFont ? pFont->m_nDescend : 0;
 }
@@ -1216,9 +1172,7 @@ bool PrintFontManager::getMetrics( fontID nFontID, const 
sal_Unicode* pString, i
         || ! pFont->m_pMetrics || pFont->m_pMetrics->isEmpty()
         )
     {
-        // might be a font not yet analyzed
-        if( pFont->m_eType == fonttype::TrueType )
-            analyzeTrueTypeFile( pFont );
+        analyzeSfntFile(pFont);
     }
 
     for( int i = 0; i < nLen; i++ )
@@ -1256,14 +1210,7 @@ bool PrintFontManager::createFontSubset(
     if( !pFont )
         return false;
 
-    switch( pFont->m_eType )
-    {
-        case psp::fonttype::TrueType: rInfo.m_nFontType = 
FontSubsetInfo::SFNT_TTF; break;
-        default:
-            return false;
-    }
-    if( pFont->m_eType != fonttype::TrueType )
-        return false;
+    rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF;
 
     // reshuffle array of requested glyphs to make sure glyph0==notdef
     sal_uInt8  pEnc[256];
@@ -1299,8 +1246,7 @@ bool PrintFontManager::createFontSubset(
     const OString aFromFile = getFontFile( pFont );
 
     TrueTypeFont* pTTFont = nullptr; // TODO: rename to SfntFont
-    TrueTypeFontFile* pTTFontFile = static_cast< TrueTypeFontFile* >(pFont);
-    if( OpenTTFontFile( aFromFile.getStr(), pTTFontFile->m_nCollectionEntry, 
&pTTFont ) != SF_OK )
+    if( OpenTTFontFile( aFromFile.getStr(), pFont->m_nCollectionEntry, 
&pTTFont ) != SF_OK )
         return false;
 
     // prepare system name for write access for subset file target
@@ -1398,65 +1344,61 @@ void PrintFontManager::getGlyphWidths( fontID nFont,
                                        std::map< sal_Unicode, sal_uInt32 >& 
rUnicodeEnc )
 {
     PrintFont* pFont = getFont( nFont );
-    if( !pFont || pFont->m_eType != fonttype::TrueType )
+    if (!pFont)
         return;
-    if( pFont->m_eType == fonttype::TrueType )
+    TrueTypeFont* pTTFont = nullptr;
+    OString aFromFile = getFontFile( pFont );
+    if( OpenTTFontFile( aFromFile.getStr(), pFont->m_nCollectionEntry, 
&pTTFont ) != SF_OK )
+        return;
+    int nGlyphs = GetTTGlyphCount(pTTFont);
+    if (nGlyphs > 0)
     {
-        TrueTypeFont* pTTFont = nullptr;
-        TrueTypeFontFile* pTTFontFile = static_cast< TrueTypeFontFile* 
>(pFont);
-        OString aFromFile = getFontFile( pFont );
-        if( OpenTTFontFile( aFromFile.getStr(), 
pTTFontFile->m_nCollectionEntry, &pTTFont ) != SF_OK )
-            return;
-        int nGlyphs = GetTTGlyphCount( pTTFont );
-        if( nGlyphs > 0 )
+        rWidths.resize(nGlyphs);
+        std::vector<sal_uInt16> aGlyphIds(nGlyphs);
+        for (int i = 0; i < nGlyphs; i++)
+            aGlyphIds[i] = sal_uInt16(i);
+        TTSimpleGlyphMetrics* pMetrics = GetTTSimpleGlyphMetrics(pTTFont,
+                                                                 &aGlyphIds[0],
+                                                                 nGlyphs,
+                                                                 bVertical);
+        if (pMetrics)
         {
-            rWidths.resize(nGlyphs);
-            std::vector<sal_uInt16> aGlyphIds(nGlyphs);
-            for( int i = 0; i < nGlyphs; i++ )
-                aGlyphIds[i] = sal_uInt16(i);
-            TTSimpleGlyphMetrics* pMetrics = GetTTSimpleGlyphMetrics( pTTFont,
-                                                                      
&aGlyphIds[0],
-                                                                      nGlyphs,
-                                                                      
bVertical );
-            if( pMetrics )
-            {
-                for( int i = 0; i< nGlyphs; i++ )
-                    rWidths[i] = pMetrics[i].adv;
-                free( pMetrics );
-                rUnicodeEnc.clear();
-            }
+            for (int i = 0; i< nGlyphs; i++)
+                rWidths[i] = pMetrics[i].adv;
+            free(pMetrics);
+            rUnicodeEnc.clear();
+        }
 
-            // fill the unicode map
-            // TODO: isn't this map already available elsewhere in the 
fontmanager?
-            const sal_uInt8* pCmapData = nullptr;
-            int nCmapSize = 0;
-            if( GetSfntTable( pTTFont, O_cmap, &pCmapData, &nCmapSize ) )
+        // fill the unicode map
+        // TODO: isn't this map already available elsewhere in the fontmanager?
+        const sal_uInt8* pCmapData = nullptr;
+        int nCmapSize = 0;
+        if (GetSfntTable(pTTFont, O_cmap, &pCmapData, &nCmapSize))
+        {
+            CmapResult aCmapResult;
+            if (ParseCMAP(pCmapData, nCmapSize, aCmapResult))
             {
-                CmapResult aCmapResult;
-                if( ParseCMAP( pCmapData, nCmapSize, aCmapResult ) )
+                FontCharMapRef xFontCharMap(new FontCharMap(aCmapResult));
+                for (sal_uInt32 cOld = 0;;)
                 {
-                    FontCharMapRef xFontCharMap( new FontCharMap(aCmapResult) 
);
-                    for( sal_uInt32 cOld = 0;;)
-                    {
-                        // get next unicode covered by font
-                        const sal_uInt32 c = xFontCharMap->GetNextChar( cOld );
-                        if( c == cOld )
-                            break;
-                        cOld = c;
+                    // get next unicode covered by font
+                    const sal_uInt32 c = xFontCharMap->GetNextChar(cOld);
+                    if (c == cOld)
+                        break;
+                    cOld = c;
 #if 1 // TODO: remove when sal_Unicode covers all of unicode
-                        if( c > (sal_Unicode)~0 )
-                            break;
+                    if (c > (sal_Unicode)~0)
+                        break;
 #endif
-                        // get the matching glyph index
-                        const sal_GlyphId aGlyphId = 
xFontCharMap->GetGlyphIndex( c );
-                        // update the requested map
-                        rUnicodeEnc[ (sal_Unicode)c ] = aGlyphId;
-                    }
+                    // get the matching glyph index
+                    const sal_GlyphId aGlyphId = 
xFontCharMap->GetGlyphIndex(c);
+                    // update the requested map
+                    rUnicodeEnc[(sal_Unicode)c] = aGlyphId;
                 }
             }
         }
-        CloseTTFont( pTTFont );
     }
+    CloseTTFont(pTTFont);
 }
 
 /// used by online unit tests via dlopen.
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx 
b/vcl/unx/generic/print/genpspgraphics.cxx
index a0f1314..7bedffe 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -914,18 +914,8 @@ FontAttributes GenPspGraphics::Info2FontAttributes( const 
psp::FastPrintFontInfo
     aDFA.SetSymbolFlag( (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL) );
     aDFA.SetSubsettableFlag( rInfo.m_bSubsettable );
     aDFA.SetEmbeddableFlag(false);
-
-    switch( rInfo.m_eType )
-    {
-        case psp::fonttype::TrueType:
-            aDFA.SetQuality( 512 );
-            aDFA.SetBuiltInFontFlag( false );
-            break;
-        default:
-            aDFA.SetQuality( 0 );
-            aDFA.SetBuiltInFontFlag( false );
-            break;
-    }
+    aDFA.SetQuality(512);
+    aDFA.SetBuiltInFontFlag(false);
 
     aDFA.SetOrientationFlag( true );
 
@@ -970,28 +960,24 @@ void GenPspGraphics::AnnounceFonts( 
PhysicalFontCollection* pFontCollection, con
 {
     int nQuality = 0;
 
-    if( aInfo.m_eType == psp::fonttype::TrueType )
+    psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
+    OString aFileName( rMgr.getFontFileSysPath( aInfo.m_nID ) );
+    int nPos = aFileName.lastIndexOf( '_' );
+    if( nPos == -1 || aFileName[nPos+1] == '.' )
+        nQuality += 5;
+    else
     {
-        // asian type 1 fonts are not known
-        psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
-        OString aFileName( rMgr.getFontFileSysPath( aInfo.m_nID ) );
-        int nPos = aFileName.lastIndexOf( '_' );
-        if( nPos == -1 || aFileName[nPos+1] == '.' )
-            nQuality += 5;
-        else
+        static const char* pLangBoost = nullptr;
+        static bool bOnce = true;
+        if( bOnce )
         {
-            static const char* pLangBoost = nullptr;
-            static bool bOnce = true;
-            if( bOnce )
-            {
-                bOnce = false;
-                pLangBoost = vcl::getLangBoost();
-            }
-
-            if( pLangBoost )
-                if( aFileName.copy( nPos+1, 3 ).equalsIgnoreAsciiCase( 
pLangBoost ) )
-                    nQuality += 10;
+            bOnce = false;
+            pLangBoost = vcl::getLangBoost();
         }
+
+        if( pLangBoost )
+            if( aFileName.copy( nPos+1, 3 ).equalsIgnoreAsciiCase( pLangBoost 
) )
+                nQuality += 10;
     }
 
     ImplPspFontData* pFD = new ImplPspFontData( aInfo );
@@ -1127,15 +1113,7 @@ const void* GenPspGraphics::DoGetEmbedFontData( 
psp::fontID aFont, const sal_Ucs
     for (size_t i = 0; i < nLen; ++i)
         pWidths[i] = (aMetrics[i].width > 0 ? aMetrics[i].width : 0);
 
-    switch( aFontInfo.m_eType )
-    {
-        case psp::fonttype::TrueType:
-            rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF;
-            break;
-        default:
-            DoFreeEmbedFontData( pFile, *pDataLen );
-            return nullptr;
-    }
+    rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF;
 
     return pFile;
 }
diff --git a/vcl/unx/generic/print/glyphset.cxx 
b/vcl/unx/generic/print/glyphset.cxx
index 58b640a..7d8ee2e 100644
--- a/vcl/unx/generic/print/glyphset.cxx
+++ b/vcl/unx/generic/print/glyphset.cxx
@@ -49,7 +49,6 @@ GlyphSet::GlyphSet (sal_Int32 nFontID, bool bVertical)
           mbVertical (bVertical)
 {
     PrintFontManager &rMgr = PrintFontManager::get();
-    meBaseType          = rMgr.getFontType (mnFontID);
     maBaseName          = OUStringToOString (rMgr.getPSName(mnFontID),
                                            RTL_TEXTENCODING_ASCII_US);
     mnBaseEncoding      = rMgr.getFontEncoding(mnFontID);
@@ -181,20 +180,13 @@ GlyphSet::AddGlyphID (
 OString
 GlyphSet::GetGlyphSetName (sal_Int32 nGlyphSetID)
 {
-    if (meBaseType == fonttype::TrueType)
-    {
-        OStringBuffer aSetName( maBaseName.getLength() + 32 );
-        aSetName.append( maBaseName );
-        aSetName.append( "FID" );
-        aSetName.append( mnFontID );
-        aSetName.append( mbVertical ? "VGSet" : "HGSet" );
-        aSetName.append( nGlyphSetID );
-        return aSetName.makeStringAndClear();
-    }
-    else
-    {
-        return maBaseName;
-    }
+    OStringBuffer aSetName( maBaseName.getLength() + 32 );
+    aSetName.append( maBaseName );
+    aSetName.append( "FID" );
+    aSetName.append( mnFontID );
+    aSetName.append( mbVertical ? "VGSet" : "HGSet" );
+    aSetName.append( nGlyphSetID );
+    return aSetName.makeStringAndClear();
 }
 
 OString
@@ -341,10 +333,6 @@ static void CreatePSUploadableFont( TrueTypeFont* 
pSrcFont, FILE* pTmpFile,
 void
 GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool 
bAllowType42, std::list< OString >& rSuppliedFonts )
 {
-    // only for truetype fonts
-    if (meBaseType != fonttype::TrueType)
-        return;
-
     TrueTypeFont *pTTFont;
     OString aTTFileName (rGfx.GetFontMgr().getFontFileSysPath(mnFontID));
     int nFace = rGfx.GetFontMgr().getFontFaceNumber(mnFontID);
diff --git a/vcl/unx/generic/print/glyphset.hxx 
b/vcl/unx/generic/print/glyphset.hxx
index 7b0eba9..92c6756 100644
--- a/vcl/unx/generic/print/glyphset.hxx
+++ b/vcl/unx/generic/print/glyphset.hxx
@@ -43,7 +43,6 @@ private:
     sal_Int32           mnFontID;
     bool                mbVertical;
     OString             maBaseName;
-    fonttype::type      meBaseType;
     rtl_TextEncoding    mnBaseEncoding;
 
     typedef std::unordered_map< sal_Unicode, sal_uInt8 > char_map_t;
@@ -71,7 +70,6 @@ public:
     ~GlyphSet ();
 
     sal_Int32       GetFontID () { return mnFontID;}
-    fonttype::type  GetFontType () { return meBaseType;}
     static OString
     GetReencodedFontName (rtl_TextEncoding nEnc,
                           const OString &rFontName);
diff --git a/vcl/unx/generic/print/text_gfx.cxx 
b/vcl/unx/generic/print/text_gfx.cxx
index eda0f17..bff561a 100644
--- a/vcl/unx/generic/print/text_gfx.cxx
+++ b/vcl/unx/generic/print/text_gfx.cxx
@@ -232,10 +232,7 @@ PrinterGfx::writeResources( osl::File* pFile, std::list< 
OString >& rSuppliedFon
     std::list< GlyphSet >::iterator aIter;
     for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); ++aIter)
     {
-        if (aIter->GetFontType() == fonttype::TrueType)
-        {
-            aIter->PSUploadFont (*pFile, *this, mbUploadPS42Fonts, 
rSuppliedFonts );
-        }
+        aIter->PSUploadFont (*pFile, *this, mbUploadPS42Fonts, rSuppliedFonts 
);
     }
 }
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1c3526bfc07cd13636bfb84f5ad45a058ec74415
Author: Khaled Hosny <khaledho...@eglug.org>
Date:   Thu Nov 24 09:54:48 2016 +0200

    Dead code
    
    Change-Id: I24d365f8231431a4062d026622c2f72bb5ed7af7
    Reviewed-on: https://gerrit.libreoffice.org/31230
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledho...@eglug.org>

diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index 46a951a..a7a2753 100644
--- a/vcl/inc/unx/fontmanager.hxx
+++ b/vcl/inc/unx/fontmanager.hxx
@@ -357,23 +357,12 @@ public:
     // get a fonts glyph bounding box
     void getFontBoundingBox( fontID nFont, int& xMin, int& yMin, int& xMax, 
int& yMax );
 
-    // info whether an array of glyphs has vertical substitutions
-    void hasVerticalSubstitutions( fontID nFontID, const sal_Unicode* 
pCharacters,
-        int nCharacters, bool* pHasSubst ) const;
-
     // get a specific fonts metrics
 
-    // get metrics for a sal_Unicode range
-    // the user is responsible to allocate pArray large enough
-    bool getMetrics( fontID nFontID, sal_Unicode minCharacter, sal_Unicode 
maxCharacter, CharacterMetric* pArray, bool bVertical = false ) const;
     // get metrics for an array of sal_Unicode characters
     // the user is responsible to allocate pArray large enough
     bool getMetrics( fontID nFontID, const sal_Unicode* pString, int nLen, 
CharacterMetric* pArray ) const;
 
-    // evaluates copyright flags for TrueType fonts for printing/viewing
-    // type1 fonts do not have such a feature, so return for them is true
-    bool isFontDownloadingAllowedForPrinting( fontID nFont ) const;
-
     // creates a new font subset of an existing TrueType font
     // returns true in case of success, else false
     // nFont: the font to be subsetted
diff --git a/vcl/inc/unx/printergfx.hxx b/vcl/inc/unx/printergfx.hxx
index 88c04d5..7f8a735 100644
--- a/vcl/inc/unx/printergfx.hxx
+++ b/vcl/inc/unx/printergfx.hxx
@@ -102,7 +102,6 @@ public:
     }
 };
 
-class Font2;
 class GlyphSet;
 class PrinterJob;
 class PrintFontManager;
@@ -154,8 +153,6 @@ struct GraphicsStatus
     GraphicsStatus();
 };
 
-class Font2;
-
 class VCL_DLLPUBLIC PrinterGfx
 {
 private:
@@ -215,13 +212,6 @@ private:
     std::list< GraphicsStatus >     maGraphicsStack;
     GraphicsStatus& currentState() { return maGraphicsStack.front(); }
 
-    /* font */
-    friend class Font2;
-    int             getCharWidth (bool b_vert, sal_Unicode n_char,
-                                  CharacterMetric *p_bbox);
-    fontID          getCharMetric (const Font2 &rFont, sal_Unicode n_char,
-                                   CharacterMetric *p_bbox);
-
 public:
     /* graphics status update */
     void            PSSetColor ();
@@ -264,21 +254,11 @@ public:
                                 sal_Int16 nGlyphs, sal_Int16 nBytes,
                                 const sal_Int32* pDeltaArray = nullptr);
     void            PSComment (const sal_Char* pComment );
-    void            LicenseWarning (const Point& rPoint, const sal_Unicode* 
pStr,
-                                    sal_Int16 nLen, const sal_Int32* 
pDeltaArray);
 
     void            OnEndJob ();
     void            writeResources( osl::File* pFile, std::list< OString >& 
rSuppliedFonts );
     PrintFontManager& GetFontMgr () { return mrFontMgr; }
 
-    void            drawVerticalizedText (const Point& rPoint,
-                                          const sal_Unicode* pStr,
-                                          sal_Int16 nLen,
-                                          const sal_Int32* pDeltaArray );
-    void            drawText (const Point& rPoint,
-                              const sal_Unicode* pStr, sal_Int16 nLen,
-                              const sal_Int32* pDeltaArray = nullptr);
-
     void            drawGlyphs( const Point& rPoint,
                                 sal_GlyphId* pGlyphIds,
                                 sal_Unicode* pUnicodes,
@@ -360,9 +340,6 @@ public:
     { return maVirtualStatus.mbArtItalic; }
     bool            GetArtificialBold() const
     { return maVirtualStatus.mbArtBold; }
-    void            DrawText (const Point& rPoint,
-                              const sal_Unicode* pStr, sal_Int16 nLen,
-                              const sal_Int32* pDeltaArray);
     void            SetTextColor (PrinterColor& rTextColor)
     { maTextColor = rTextColor; }
 
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx 
b/vcl/unx/generic/fontmanager/fontmanager.cxx
index 4c839f4..152c01b 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -1206,69 +1206,6 @@ int PrintFontManager::getFontDescend( fontID nFontID ) 
const
     return pFont ? pFont->m_nDescend : 0;
 }
 
-void PrintFontManager::hasVerticalSubstitutions( fontID nFontID,
-    const sal_Unicode* pCharacters, int nCharacters, bool* pHasSubst ) const
-{
-    PrintFont* pFont = getFont( nFontID );
-    if (pFont && pFont->m_nAscend == 0 && pFont->m_nDescend == 0)
-    {
-        // might be a truetype font not yet analyzed
-        if( pFont->m_eType == fonttype::TrueType )
-            analyzeTrueTypeFile( pFont );
-    }
-
-    if (!pFont || !pFont->m_bHaveVerticalSubstitutedGlyphs)
-        memset( pHasSubst, 0, sizeof(bool)*nCharacters );
-    else
-    {
-        for( int i = 0; i < nCharacters; i++ )
-        {
-            sal_Unicode code = pCharacters[i];
-            if( ! pFont->m_pMetrics ||
-                ! ( pFont->m_pMetrics->m_aPages[ code >> 11 ] & ( 1 << ( ( 
code >> 8 ) & 7 ) ) ) )
-                pFont->queryMetricPage( code >> 8, m_pAtoms );
-            std::unordered_map< sal_Unicode, bool >::const_iterator it = 
pFont->m_pMetrics->m_bVerticalSubstitutions.find( code );
-            pHasSubst[i] = it != 
pFont->m_pMetrics->m_bVerticalSubstitutions.end();
-        }
-    }
-}
-
-bool PrintFontManager::isFontDownloadingAllowedForPrinting( fontID nFont ) 
const
-{
-    static const char* pEnable = getenv( 
"PSPRINT_ENABLE_TTF_COPYRIGHTAWARENESS" );
-    bool bRet = true;
-
-    if( pEnable && *pEnable )
-    {
-        PrintFont* pFont = getFont( nFont );
-        if( pFont && pFont->m_eType == fonttype::TrueType )
-        {
-            TrueTypeFontFile* pTTFontFile = 
static_cast<TrueTypeFontFile*>(pFont);
-            if( pTTFontFile->m_nTypeFlags & TYPEFLAG_INVALID )
-            {
-                TrueTypeFont* pTTFont = nullptr;
-                OString aFile = getFontFile( pFont );
-                if( OpenTTFontFile( aFile.getStr(), 
pTTFontFile->m_nCollectionEntry, &pTTFont ) == SF_OK )
-                {
-                    // get type flags
-                    TTGlobalFontInfo aInfo;
-                    GetTTGlobalFontInfo( pTTFont, & aInfo );
-                    pTTFontFile->m_nTypeFlags = (unsigned int)aInfo.typeFlags;
-                    CloseTTFont( pTTFont );
-                }
-            }
-
-            unsigned int nCopyrightFlags = pTTFontFile->m_nTypeFlags & 
TYPEFLAG_COPYRIGHT_MASK;
-
-            // http://www.microsoft.com/typography/tt/ttf_spec/ttch02.doc
-            // Font embedding is allowed if not restricted completely (only 
bit 1 set).
-            // Preview&Print (bit 2), Editable (bit 3) or Installable (==0) 
fonts are ok.
-            bRet = ( nCopyrightFlags & 0x02 ) != 0x02;
-        }
-    }
-    return bRet;
-}
-
 bool PrintFontManager::getMetrics( fontID nFontID, const sal_Unicode* pString, 
int nLen, CharacterMetric* pArray ) const
 {
     PrintFont* pFont = getFont( nFontID );
@@ -1304,51 +1241,6 @@ bool PrintFontManager::getMetrics( fontID nFontID, const 
sal_Unicode* pString, i
     return true;
 }
 
-bool PrintFontManager::getMetrics( fontID nFontID, sal_Unicode minCharacter, 
sal_Unicode maxCharacter, CharacterMetric* pArray, bool bVertical ) const
-{
-    OSL_PRECOND(minCharacter <= maxCharacter, "invalid char. range");
-    if (minCharacter > maxCharacter)
-        return false;
-
-    PrintFont* pFont = getFont( nFontID );
-    if( ! pFont )
-        return false;
-
-    if( ( pFont->m_nAscend == 0 && pFont->m_nDescend == 0 )
-        || ! pFont->m_pMetrics || pFont->m_pMetrics->isEmpty()
-        )
-    {
-        // might be a font not yet analyzed
-        if( pFont->m_eType == fonttype::TrueType )
-            analyzeTrueTypeFile( pFont );
-    }
-
-    sal_Unicode code = minCharacter;
-    do
-    {
-        if( ! pFont->m_pMetrics ||
-            ! ( pFont->m_pMetrics->m_aPages[ code >> 11 ] & ( 1 << ( ( code >> 
8 ) & 7 ) ) ) )
-            pFont->queryMetricPage( code >> 8, m_pAtoms );
-        pArray[ code - minCharacter ].width     = -1;
-        pArray[ code - minCharacter ].height    = -1;
-        if( pFont->m_pMetrics )
-        {
-            int effectiveCode = code;
-            effectiveCode |= bVertical ? 1 << 16 : 0;
-            std::unordered_map< int, CharacterMetric >::const_iterator it =
-                  pFont->m_pMetrics->m_aMetrics.find( effectiveCode );
-            // if no vertical metrics are available assume rotated horizontal 
metrics
-            if( bVertical && (it == pFont->m_pMetrics->m_aMetrics.end()) )
-                it = pFont->m_pMetrics->m_aMetrics.find( code );
-            // the character metrics are in it->second
-            if( it != pFont->m_pMetrics->m_aMetrics.end() )
-                pArray[ code - minCharacter ] = it->second;
-        }
-    } while( code++ != maxCharacter );
-
-    return true;
-}
-
 // TODO: move most of this stuff into the central font-subsetting code
 bool PrintFontManager::createFontSubset(
                                         FontSubsetInfo& rInfo,
diff --git a/vcl/unx/generic/print/glyphset.cxx 
b/vcl/unx/generic/print/glyphset.cxx
index 15c0fd8..58b640a 100644
--- a/vcl/unx/generic/print/glyphset.cxx
+++ b/vcl/unx/generic/print/glyphset.cxx
@@ -61,17 +61,6 @@ GlyphSet::~GlyphSet ()
 }
 
 bool
-GlyphSet::GetCharID (
-                     sal_Unicode nChar,
-                     unsigned char* nOutGlyphID,
-                     sal_Int32* nOutGlyphSetID
-                     )
-{
-    return    LookupCharID (nChar, nOutGlyphID, nOutGlyphSetID)
-           || AddCharID    (nChar, nOutGlyphID, nOutGlyphSetID);
-}
-
-bool
 GlyphSet::GetGlyphID (
                       sal_GlyphId nGlyph,
                       sal_Unicode nUnicode,
@@ -84,37 +73,6 @@ GlyphSet::GetGlyphID (
 }
 
 bool
-GlyphSet::LookupCharID (
-                        sal_Unicode nChar,
-                        unsigned char* nOutGlyphID,
-                        sal_Int32* nOutGlyphSetID
-                        )
-{
-    char_list_t::iterator aGlyphSet;
-    sal_Int32             nGlyphSetID;
-
-    // loop through all the font subsets
-    for (aGlyphSet  = maCharList.begin(), nGlyphSetID = 1;
-         aGlyphSet != maCharList.end();
-         ++aGlyphSet, nGlyphSetID++)
-    {
-        // check every subset if it contains the queried unicode char
-        char_map_t::const_iterator aGlyph = (*aGlyphSet).find (nChar);
-        if (aGlyph != (*aGlyphSet).end())
-        {
-            // success: found the unicode char, return the glyphid and the 
glyphsetid
-            *nOutGlyphSetID = nGlyphSetID;
-            *nOutGlyphID    = (*aGlyph).second;
-            return true;
-        }
-    }
-
-    *nOutGlyphSetID = -1;
-    *nOutGlyphID    =  0;
-    return false;
-}
-
-bool
 GlyphSet::LookupGlyphID (
                         sal_GlyphId nGlyph,
                         unsigned char* nOutGlyphID,
@@ -146,27 +104,6 @@ GlyphSet::LookupGlyphID (
 }
 
 unsigned char
-GlyphSet::GetAnsiMapping (sal_Unicode nUnicodeChar)
-{
-    static rtl_UnicodeToTextConverter aConverter =
-                rtl_createUnicodeToTextConverter(RTL_TEXTENCODING_MS_1252);
-    static rtl_UnicodeToTextContext aContext =
-             rtl_createUnicodeToTextContext( aConverter );
-
-    sal_Char            nAnsiChar;
-    sal_uInt32          nCvtInfo;
-    sal_Size            nCvtChars;
-       const sal_uInt32    nCvtFlags =  RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
-                                   | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR;
-
-    sal_Size nSize = rtl_convertUnicodeToText( aConverter, aContext,
-                &nUnicodeChar, 1, &nAnsiChar, 1,
-                nCvtFlags, &nCvtInfo, &nCvtChars );
-
-    return nSize == 1 ? (unsigned char)nAnsiChar : (unsigned char)0;
-}
-
-unsigned char
 GlyphSet::GetSymbolMapping (sal_Unicode nUnicodeChar)
 {
     if (0x0000 < nUnicodeChar && nUnicodeChar < 0x0100)
@@ -178,75 +115,11 @@ GlyphSet::GetSymbolMapping (sal_Unicode nUnicodeChar)
 }
 
 void
-GlyphSet::AddNotdef (char_map_t &rCharMap)
-{
-    if (rCharMap.empty())
-        rCharMap[0] = 0;
-}
-
-void
 GlyphSet::AddNotdef (glyph_map_t &rGlyphMap)
 {
     if (rGlyphMap.empty())
         rGlyphMap[0] = 0;
 }
-bool
-GlyphSet::AddCharID (
-                     sal_Unicode nChar,
-                     unsigned char* nOutGlyphID,
-                     sal_Int32* nOutGlyphSetID
-                     )
-{
-    unsigned char nMappedChar;
-
-    // XXX important: avoid to reencode type1 symbol fonts
-    if (mnBaseEncoding == RTL_TEXTENCODING_SYMBOL)
-        nMappedChar = GetSymbolMapping (nChar);
-    else
-        nMappedChar = GetAnsiMapping (nChar);
-
-    // create an empty glyphmap that is reserved for iso1252 encoded glyphs
-    // (or -- unencoded -- symbol glyphs) and a second map that takes any other
-    if (maCharList.empty())
-    {
-        char_map_t aMap, aMapp;
-
-        maCharList.push_back (aMap);
-        maCharList.push_back (aMapp);
-    }
-    // if the last map is full, create a new one
-    if ((!nMappedChar) && (maCharList.back().size() == 255))
-    {
-        char_map_t aMap;
-        maCharList.push_back (aMap);
-    }
-
-    // insert a new glyph in the font subset
-    if (nMappedChar)
-    {
-        // always put iso1252 chars into the first map, map them on itself
-        char_map_t& aGlyphSet = maCharList.front();
-        AddNotdef (aGlyphSet);
-
-        aGlyphSet [nChar] = nMappedChar;
-        *nOutGlyphSetID   = 1;
-        *nOutGlyphID      = nMappedChar;
-    }
-    else
-    {
-        // other chars are just appended to the list
-        char_map_t& aGlyphSet = maCharList.back();
-        AddNotdef (aGlyphSet);
-
-        int nSize         = aGlyphSet.size();
-
-        aGlyphSet [nChar] = nSize;
-        *nOutGlyphSetID   = maCharList.size();
-        *nOutGlyphID      = aGlyphSet [nChar];
-    }
-
-    return true;
-}
 
 bool
 GlyphSet::AddGlyphID (
@@ -306,25 +179,6 @@ GlyphSet::AddGlyphID (
 }
 
 OString
-GlyphSet::GetCharSetName (sal_Int32 nGlyphSetID)
-{
-    if (meBaseType == fonttype::TrueType)
-    {
-        OStringBuffer aSetName( maBaseName.getLength() + 32 );
-        aSetName.append( maBaseName );
-        aSetName.append( "FID" );
-        aSetName.append( mnFontID );
-        aSetName.append( mbVertical ? "VCSet" : "HCSet" );
-        aSetName.append( nGlyphSetID );
-        return aSetName.makeStringAndClear();
-    }
-    else
-    {
-        return maBaseName;
-    }
-}
-
-OString
 GlyphSet::GetGlyphSetName (sal_Int32 nGlyphSetID)
 {
     if (meBaseType == fonttype::TrueType)
@@ -343,48 +197,6 @@ GlyphSet::GetGlyphSetName (sal_Int32 nGlyphSetID)
     }
 }
 
-sal_Int32
-GlyphSet::GetGlyphSetEncoding (sal_Int32 nGlyphSetID)
-{
-    if (meBaseType == fonttype::TrueType)
-        return RTL_TEXTENCODING_DONTKNOW;
-    else
-    {
-        if (mnBaseEncoding == RTL_TEXTENCODING_SYMBOL)
-            return RTL_TEXTENCODING_SYMBOL;
-        else
-            return nGlyphSetID == 1 ? RTL_TEXTENCODING_MS_1252
-                                    : RTL_TEXTENCODING_USER_START + 
nGlyphSetID;
-    }
-}
-
-OString
-GlyphSet::GetGlyphSetEncodingName (rtl_TextEncoding nEnc, const OString 
&rFontName)
-{
-    if (   nEnc == RTL_TEXTENCODING_MS_1252
-        || nEnc == RTL_TEXTENCODING_ISO_8859_1)
-    {
-        return OString("ISO1252Encoding");
-    }
-    else
-    if (nEnc >= RTL_TEXTENCODING_USER_START && nEnc <= 
RTL_TEXTENCODING_USER_END)
-    {
-        return  rFontName
-                + OString("Enc")
-                + OString::number ((nEnc - RTL_TEXTENCODING_USER_START));
-    }
-    else
-    {
-        return OString();
-    }
-}
-
-OString
-GlyphSet::GetGlyphSetEncodingName (sal_Int32 nGlyphSetID)
-{
-    return GetGlyphSetEncodingName (GetGlyphSetEncoding(nGlyphSetID), 
maBaseName);
-}
-
 OString
 GlyphSet::GetReencodedFontName (rtl_TextEncoding nEnc, const OString 
&rFontName)
 {
@@ -413,8 +225,7 @@ void GlyphSet::DrawGlyphs(
                           const sal_GlyphId* pGlyphIds,
                           const sal_Unicode* pUnicodes,
                           sal_Int16 nLen,
-                          const sal_Int32* pDeltaArray,
-                          const bool bUseGlyphs)
+                          const sal_Int32* pDeltaArray)
 {
     unsigned char *pGlyphID    = static_cast<unsigned char*>(alloca (nLen * 
sizeof(unsigned char)));
     sal_Int32 *pGlyphSetID = static_cast<sal_Int32*>(alloca (nLen * 
sizeof(sal_Int32)));
@@ -423,10 +234,7 @@ void GlyphSet::DrawGlyphs(
     // convert unicode to font glyph id and font subset
     for (int nChar = 0; nChar < nLen; nChar++)
     {
-        if (bUseGlyphs)
-            GetGlyphID (pGlyphIds[nChar], pUnicodes[nChar], pGlyphID + nChar, 
pGlyphSetID + nChar);
-        else
-            GetCharID (pUnicodes[nChar], pGlyphID + nChar, pGlyphSetID + 
nChar);
+        GetGlyphID (pGlyphIds[nChar], pUnicodes[nChar], pGlyphID + nChar, 
pGlyphSetID + nChar);
         aGlyphSet.insert (pGlyphSetID[nChar]);
     }
 
@@ -475,72 +283,14 @@ void GlyphSet::DrawGlyphs(
         aPoint.Move (nOffset, 0);
 
         OString aGlyphSetName;
-        if (bUseGlyphs)
-            aGlyphSetName = GetGlyphSetName(*aSet);
-        else
-            aGlyphSetName = GetCharSetName(*aSet);
+        aGlyphSetName = GetGlyphSetName(*aSet);
 
-        rGfx.PSSetFont  (aGlyphSetName, GetGlyphSetEncoding(*aSet));
+        rGfx.PSSetFont  (aGlyphSetName, RTL_TEXTENCODING_DONTKNOW);
         rGfx.PSMoveTo   (aPoint);
         rGfx.PSShowText (pGlyphSubset, nGlyphs, nGlyphs, nGlyphs > 1 ? 
pDeltaSubset : nullptr);
     }
 }
 
-void
-GlyphSet::DrawText (PrinterGfx &rGfx, const Point& rPoint,
-                    const sal_Unicode* pStr, sal_Int16 nLen, const sal_Int32* 
pDeltaArray)
-{
-    // dispatch to the impl method
-    if (pDeltaArray == nullptr)
-        ImplDrawText (rGfx, rPoint, pStr, nLen);
-    else
-        ImplDrawText (rGfx, rPoint, pStr, nLen, pDeltaArray);
-}
-
-void
-GlyphSet::ImplDrawText (PrinterGfx &rGfx, const Point& rPoint,
-                        const sal_Unicode* pStr, sal_Int16 nLen)
-{
-    rGfx.PSMoveTo (rPoint);
-
-    int nChar;
-    unsigned char *pGlyphID    = static_cast<unsigned char*>(alloca (nLen * 
sizeof(unsigned char)));
-    sal_Int32 *pGlyphSetID = static_cast<sal_Int32*>(alloca (nLen * 
sizeof(sal_Int32)));
-
-    // convert unicode to glyph id and char set (font subset)
-    for (nChar = 0; nChar < nLen; nChar++)
-        GetCharID (pStr[nChar], pGlyphID + nChar, pGlyphSetID + nChar);
-
-    // loop over the string to draw subsequent pieces of chars
-    // with the same postscript font
-    for (nChar = 0; nChar < nLen; /* atend */)
-    {
-        sal_Int32 nGlyphSetID = pGlyphSetID [nChar];
-        sal_Int32 nGlyphs     = 1;
-        for (int nNextChar = nChar + 1; nNextChar < nLen; nNextChar++)
-        {
-            if (pGlyphSetID[nNextChar] == nGlyphSetID)
-                nGlyphs++;
-            else
-                break;
-        }
-
-        // show the text using the PrinterGfx text api
-        OString aGlyphSetName(GetCharSetName(nGlyphSetID));
-        rGfx.PSSetFont (aGlyphSetName, GetGlyphSetEncoding(nGlyphSetID));
-        rGfx.PSShowText (pGlyphID + nChar, nGlyphs, nGlyphs);
-
-        nChar += nGlyphs;
-    }
-}
-
-void
-GlyphSet::ImplDrawText (PrinterGfx &rGfx, const Point& rPoint,
-                        const sal_Unicode* pStr, sal_Int16 nLen, const 
sal_Int32* pDeltaArray)
-{
-    DrawGlyphs( rGfx, rPoint, nullptr, pStr, nLen, pDeltaArray, false);
-}
-
 struct EncEntry
 {
     unsigned char  aEnc;
@@ -608,47 +358,12 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx 
&rGfx, bool bAllowType42
     if (pTmpFile == nullptr)
         return;
 
-    // array of unicode source characters
-    sal_uInt16 pUChars[256];
-
     // encoding vector maps character encoding to the ordinal number
     // of the glyph in the output file
     unsigned char  pEncoding[256];
     sal_uInt16 pTTGlyphMapping[256];
     const bool bAllowCID = false; // TODO: nPSLanguageLevel>=3
 
-    // loop through all the font subsets
-    sal_Int32 nCharSetID;
-    char_list_t::iterator aCharSet;
-    for (aCharSet = maCharList.begin(), nCharSetID = 1;
-         aCharSet != maCharList.end();
-         ++aCharSet, nCharSetID++)
-    {
-        if ((*aCharSet).empty())
-            continue;
-
-        // loop through all the chars in the subset
-        char_map_t::const_iterator aChar;
-        sal_Int32 n = 0;
-        for (aChar = (*aCharSet).begin(); aChar != (*aCharSet).end(); ++aChar)
-        {
-            pUChars [n]   = (*aChar).first;
-            pEncoding [n] = (*aChar).second;
-            n++;
-        }
-        // create a mapping from the unicode chars to the char encoding in
-        // source TrueType font
-        MapString (pTTFont, pUChars, (*aCharSet).size(), pTTGlyphMapping, 
mbVertical);
-
-        // create the current subset
-        OString aCharSetName = GetCharSetName(nCharSetID);
-        fprintf( pTmpFile, "%%%%BeginResource: font %s\n", 
aCharSetName.getStr() );
-        CreatePSUploadableFont( pTTFont, pTmpFile, aCharSetName.getStr(), 
(*aCharSet).size(),
-                                pTTGlyphMapping, pEncoding, bAllowType42, 
bAllowCID );
-        fprintf( pTmpFile, "%%%%EndResource\n" );
-        rSuppliedFonts.push_back( aCharSetName );
-    }
-
     // loop through all the font glyph subsets
     sal_Int32 nGlyphSetID;
     glyph_list_t::iterator aGlyphSet;
diff --git a/vcl/unx/generic/print/glyphset.hxx 
b/vcl/unx/generic/print/glyphset.hxx
index d807af4..7b0eba9 100644
--- a/vcl/unx/generic/print/glyphset.hxx
+++ b/vcl/unx/generic/print/glyphset.hxx
@@ -51,21 +51,10 @@ private:
     typedef std::unordered_map< sal_GlyphId, sal_uInt8 > glyph_map_t;
     typedef std::list< glyph_map_t > glyph_list_t;
 
-    char_list_t         maCharList;
     glyph_list_t        maGlyphList;
 
     OString     GetGlyphSetName (sal_Int32 nGlyphSetID);
-    OString     GetCharSetName (sal_Int32 nGlyphSetID);
-    sal_Int32   GetGlyphSetEncoding (sal_Int32 nGlyphSetID);
-    OString     GetGlyphSetEncodingName (sal_Int32 nGlyphSetID);
 
-    bool        GetCharID (sal_Unicode nChar,
-                                unsigned char* nOutGlyphID, sal_Int32* 
nOutGlyphSetID);
-    bool        LookupCharID (sal_Unicode nChar,
-                                   unsigned char* nOutGlyphID, sal_Int32* 
nOutGlyphSetID);
-    bool        AddCharID (sal_Unicode nChar,
-                                unsigned char* nOutGlyphID,
-                                sal_Int32* nOutGlyphSetID);
     bool        GetGlyphID (sal_GlyphId nGlyphId, sal_Unicode nUnicode,
                                 unsigned char* nOutGlyphID, sal_Int32* 
nOutGlyphSetID);
     bool        LookupGlyphID (sal_GlyphId nGlyphId,
@@ -73,17 +62,9 @@ private:
     bool        AddGlyphID (sal_GlyphId nGlyphId, sal_Unicode nUnicode,
                                 unsigned char* nOutGlyphID,
                                 sal_Int32* nOutGlyphSetID);
-    static void     AddNotdef (char_map_t &rCharMap);
     static void     AddNotdef (glyph_map_t &rGlyphMap);
-    static unsigned char  GetAnsiMapping (sal_Unicode nUnicodeChar);
     static unsigned char  GetSymbolMapping (sal_Unicode nUnicodeChar);
 
-    void            ImplDrawText (PrinterGfx &rGfx, const Point& rPoint,
-                                  const sal_Unicode* pStr, sal_Int16 nLen);
-    void            ImplDrawText (PrinterGfx &rGfx, const Point& rPoint,
-                                  const sal_Unicode* pStr, sal_Int16 nLen,
-                                  const sal_Int32* pDeltaArray);
-
 public:
 
     GlyphSet (sal_Int32 nFontID, bool bVertical);
@@ -99,16 +80,12 @@ public:
                              const OString &rFontName);
     bool            IsVertical () { return mbVertical;}
 
-    void            DrawText (PrinterGfx &rGfx, const Point& rPoint,
-                              const sal_Unicode* pStr, sal_Int16 nLen,
-                              const sal_Int32* pDeltaArray);
     void            DrawGlyphs (PrinterGfx& rGfx,
                                 const Point& rPoint,
                                 const sal_GlyphId* pGlyphIds,
                                 const sal_Unicode* pUnicodes,
                                 sal_Int16 nLen,
-                                const sal_Int32* pDeltaArray,
-                                bool bUseGlyphs=true);
+                                const sal_Int32* pDeltaArray);
     void        PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool 
bAsType42, std::list< OString >& rSuppliedFonts );
 };
 
diff --git a/vcl/unx/generic/print/text_gfx.cxx 
b/vcl/unx/generic/print/text_gfx.cxx
index 12f23fd..eda0f17 100644
--- a/vcl/unx/generic/print/text_gfx.cxx
+++ b/vcl/unx/generic/print/text_gfx.cxx
@@ -32,56 +32,6 @@
 
 using namespace psp ;
 
-namespace psp {
-/*
- container for a font and its helper fonts:
- 1st is the font itself
- 2nd is a fallback font, usually a font with unicode glyph repertoire (e.g. 
andale)
- symbol fonts (adobe-fontspecific) may need special glyphmapping
- (symbol page vc. latin page)
-*/
-class Font2
-{
-    private:
-
-        #define Font2Size 2
-
-        fontID  mpFont [Font2Size];
-        bool    mbSymbol;
-
-    public:
-
-        fontID  GetFont (int nIdx) const
-                    { return nIdx < Font2Size ? mpFont[nIdx] : -1 ; }
-        bool    IsSymbolFont () const
-                    { return mbSymbol; }
-
-        explicit Font2 (const PrinterGfx &rGfx);
-        ~Font2 () {}
-};
-
-Font2::Font2(const PrinterGfx &rGfx)
-{
-    mpFont[0] = rGfx.GetFontID();
-    mpFont[1] = 0; // fallback ID
-
-    PrintFontManager &rMgr = PrintFontManager::get();
-    mbSymbol = mpFont[0] != -1 &&
-                rMgr.getFontEncoding(mpFont[0]) == RTL_TEXTENCODING_SYMBOL;
-}
-
-} // namespace psp
-
-static int getVerticalDeltaAngle( sal_Unicode nChar )
-{
-    int nRotation = GetVerticalFlags(nChar);
-    if (nRotation == GF_ROTR)
-        return -900;
-    if (nRotation == GF_ROTL)
-        return 900;
-    return 0;
-}
-
 /*
  * implement text handling printer routines,
  */
@@ -148,12 +98,6 @@ void PrinterGfx::DrawGlyphs(
     if( nLen <= 0 )
         return;
 
-    if ( !mrFontMgr.isFontDownloadingAllowedForPrinting( mnFontID ) )
-    {
-        LicenseWarning(rPoint, pUnicodes, nLen, pDeltaArray);
-        return;
-    }
-
     // move and rotate the user coordinate system
     // avoid the gsave/grestore for the simple cases since it allows
     // reuse of the current font if it hasn't changed
@@ -268,332 +212,6 @@ void PrinterGfx::DrawGlyphs(
     }
 }
 
-void
-PrinterGfx::DrawText (
-                      const Point& rPoint,
-                      const sal_Unicode* pStr,
-                      sal_Int16 nLen,
-                      const sal_Int32* pDeltaArray
-                      )
-{
-    if (!nLen)
-        return;
-
-    fontID nRestoreFont = mnFontID;
-
-    // setup font[substitutes] and map the string into the symbol area in case 
of
-    // symbol font
-    Font2 aFont(*this);
-    sal_Unicode *pEffectiveStr;
-    if ( aFont.IsSymbolFont() )
-    {
-        pEffectiveStr = static_cast<sal_Unicode*>(alloca(nLen * 
sizeof(pStr[0])));
-        for (int i = 0; i < nLen; i++)
-            pEffectiveStr[i] = pStr[i] < 256 ? pStr[i] + 0xF000 : pStr[i];
-    }
-    else
-    {
-        pEffectiveStr = const_cast<sal_Unicode*>(pStr);
-    }
-
-    fontID    *pFontMap   = static_cast<fontID*>(alloca(nLen * 
sizeof(fontID)));
-    sal_Int32 *pCharWidth = static_cast<sal_Int32*>(alloca(nLen * 
sizeof(sal_Int32)));
-
-    for( int n = 0; n < nLen; n++ )
-    {
-        CharacterMetric aBBox;
-        // coverity[callee_ptr_arith]
-        pFontMap[n] = getCharMetric(aFont, pEffectiveStr[n], &aBBox);
-        pCharWidth[n] = getCharWidth(mbTextVertical, pEffectiveStr[n], &aBBox);
-    }
-
-    // setup a new delta array, use virtual resolution of 1000
-    sal_Int32* pNewDeltaArray = static_cast<sal_Int32*>(alloca( sizeof( 
sal_Int32 )*nLen ));
-    if ( pDeltaArray != nullptr)
-    {
-        for (int i = 0; i < nLen - 1; i++)
-            pNewDeltaArray[i] = 1000 * pDeltaArray[i];
-        pNewDeltaArray[nLen - 1] = 0;
-    }
-    else
-    {
-        pNewDeltaArray[0] = pCharWidth[0];
-        for (int i = 1; i < nLen; i++)
-            pNewDeltaArray[i] = pNewDeltaArray[i-1] + pCharWidth[i];
-    }
-
-    // move and rotate the user coordinate system
-    // avoid the gsave/grestore for the simple cases since it allows
-    // reuse of the current font if it hasn't changed
-    sal_Int32 nCurrentTextAngle = mnTextAngle;
-    sal_Int32 nCurrentPointX;
-    sal_Int32 nCurrentPointY;
-
-    if (nCurrentTextAngle != 0)
-    {
-        PSGSave ();
-        PSTranslate (rPoint);
-        PSRotate (nCurrentTextAngle);
-        mnTextAngle = 0;
-
-        nCurrentPointX = 0;
-        nCurrentPointY = 0;
-    }
-    else
-    {
-        nCurrentPointX = rPoint.X();
-        nCurrentPointY = rPoint.Y();
-    }
-
-    // draw the string
-    sal_Int32 nDelta = 0;
-    for (int nTo = 0; nTo < nLen; )
-    {
-        int    nFrom = nTo;
-        fontID nFont = pFontMap[ nFrom ];
-
-        while ((nTo < nLen) && (nFont == pFontMap[nTo]))
-        {
-            pNewDeltaArray[ nTo ] = (sal_Int32)(((0.5 + pNewDeltaArray[ nTo ]) 
/ 1000.0) - nDelta);
-            nTo++ ;
-        }
-
-        SetFont( nFont,
-                 maVirtualStatus.mnTextHeight, maVirtualStatus.mnTextWidth,
-                 mnTextAngle,
-                 mbTextVertical,
-                 maVirtualStatus.mbArtItalic,
-                 maVirtualStatus.mbArtBold
-                 );
-
-        if (mbTextVertical)
-        {
-            drawVerticalizedText(
-                    Point(nCurrentPointX + nDelta, nCurrentPointY),
-                    pEffectiveStr + nFrom, nTo - nFrom,
-                    pNewDeltaArray + nFrom );
-        }
-        else
-        {
-            drawText(
-                    Point(nCurrentPointX + nDelta, nCurrentPointY),
-                    pEffectiveStr + nFrom, nTo - nFrom,
-                    pDeltaArray == nullptr ? nullptr : pNewDeltaArray + nFrom 
);
-        }
-        nDelta += pNewDeltaArray[ nTo - 1 ];
-    }
-
-    // restore the user coordinate system
-    if (nCurrentTextAngle != 0)
-    {
-        PSGRestore ();
-        mnTextAngle = nCurrentTextAngle;
-    }
-
-    // restore the original font settings
-    SetFont( nRestoreFont,
-             maVirtualStatus.mnTextHeight, maVirtualStatus.mnTextWidth,
-             mnTextAngle, mbTextVertical,
-             maVirtualStatus.mbArtItalic,
-             maVirtualStatus.mbArtBold
-             );
-}
-
-void PrinterGfx::drawVerticalizedText(
-                                      const Point& rPoint,
-                                      const sal_Unicode* pStr,
-                                      sal_Int16 nLen,
-                                      const sal_Int32* pDeltaArray
-                                      )
-{
-    PrintFontManager &rMgr = PrintFontManager::get();
-    PrintFontInfo aInfo;
-    if (!rMgr.getFontInfo(mnFontID, aInfo))
-        return;
-
-    sal_Int32* pDelta = static_cast<sal_Int32*>(alloca( nLen * 
sizeof(sal_Int32) ));
-
-    int nTextScale   = maVirtualStatus.mnTextWidth ? 
maVirtualStatus.mnTextWidth : maVirtualStatus.mnTextHeight;
-    int nNormalAngle = mnTextAngle;
-    int nLastPos = 0;
-
-    double fSin = sin( -2.0*M_PI*nNormalAngle/3600 );
-    double fCos = cos( -2.0*M_PI*nNormalAngle/3600 );
-
-    bool* pGsubFlags = static_cast<bool*>(alloca( nLen * sizeof(bool) ));
-    rMgr.hasVerticalSubstitutions( mnFontID, pStr, nLen, pGsubFlags );
-
-    Point aPoint( rPoint );
-    for( int i = 0; i < nLen; )
-    {
-        int nDeltaAngle;
-        while( ( nDeltaAngle = getVerticalDeltaAngle( pStr[i] ) ) == 0 && i < 
nLen )
-            i++;
-        if( i <= nLen && i > nLastPos )
-        {
-            for( int n = nLastPos; n < i; n++ )
-                pDelta[n] = pDeltaArray[n] - (aPoint.X() - rPoint.X() );
-
-            SetFont( mnFontID,
-                     maVirtualStatus.mnTextHeight, maVirtualStatus.mnTextWidth,
-                     nNormalAngle, mbTextVertical,
-                     maVirtualStatus.mbArtItalic,
-                     maVirtualStatus.mbArtBold );
-            drawText( aPoint, pStr + nLastPos, i - nLastPos, pDelta + nLastPos 
);
-
-            aPoint.X() = (sal_Int32)(rPoint.X() + ((double)pDeltaArray[i-1] * 
fCos));
-            aPoint.Y() = (sal_Int32)(rPoint.Y() + ((double)pDeltaArray[i-1] * 
fSin));
-        }
-        if( i < nLen )
-        {
-            int nOldWidth   = maVirtualStatus.mnTextWidth;
-            int nOldHeight  = maVirtualStatus.mnTextHeight;
-            SetFont( mnFontID,
-                     nTextScale,
-                     maVirtualStatus.mnTextHeight,
-                     nNormalAngle + nDeltaAngle,
-                     mbTextVertical,
-                     maVirtualStatus.mbArtItalic,
-                     maVirtualStatus.mbArtBold );
-
-            double nA = nTextScale * aInfo.m_nAscend / 1000.0;
-            double nD = nTextScale * aInfo.m_nDescend / 1000.0;
-            double fStretch = (double)maVirtualStatus.mnTextWidth / 
maVirtualStatus.mnTextHeight;
-            if( !pGsubFlags[i] )
-                nD *= fStretch;
-
-            Point aPos( aPoint );
-            switch( nDeltaAngle )
-            {
-                case +900:
-                    aPos.X() += (sal_Int32)(+nA * fCos + nD * fSin);
-                    aPos.Y() += (sal_Int32)(-nA * fSin + nD * fCos);
-                    break;
-                case -900:
-                    aPos.X() += (sal_Int32)(+nA * fSin + nD * fCos);
-                    aPos.Y() += (sal_Int32)(-(nTextScale*fStretch - nD) * 
fCos);
-                    break;
-            }
-            drawText( aPos, pStr+i, 1 );
-            if( i < nLen-1 && pDeltaArray )
-            {
-                aPoint.X() = (sal_Int32)(rPoint.X() + ((double)pDeltaArray[i] 
* fCos));
-                aPoint.Y() = (sal_Int32)(rPoint.Y() + ((double)pDeltaArray[i] 
* fSin));
-            }
-
-            // swap text width/height again
-            SetFont( mnFontID,
-                     nOldHeight,
-                     nOldWidth,
-                     nNormalAngle,
-                     mbTextVertical,
-                     maVirtualStatus.mbArtItalic,
-                     maVirtualStatus.mbArtBold );
-        }
-        i++;
-        nLastPos = i;
-    }
-    mnTextAngle = nNormalAngle;
-}
-
-void
-PrinterGfx::LicenseWarning(const Point& rPoint, const sal_Unicode* pStr,
-                           sal_Int16 nLen, const sal_Int32* pDeltaArray)
-{
-    // treat it like a builtin font in case a user has that font also in the
-    // printer. This is not so unlikely as it may seem; no print embedding
-    // licensed fonts are often used (or so they say) in companies:
-    // they are installed on displays and printers, but get not embedded in
-    // print files or documents because they are not licensed for use outside
-    // the company.
-    OString aMessage( "The font " );
-    aMessage += OUStringToOString( mrFontMgr.getPSName(mnFontID),
-            RTL_TEXTENCODING_ASCII_US );
-    aMessage += " could not be downloaded\nbecause its license does not allow 
for that";
-    PSComment( aMessage.getStr() );
-
-    OString aFontName = OUStringToOString(
-            mrFontMgr.getPSName(mnFontID),
-            RTL_TEXTENCODING_ASCII_US);
-    PSSetFont (aFontName, RTL_TEXTENCODING_ISO_8859_1);
-
-    std::size_t  nSize    = 4 * nLen;
-    unsigned char* pBuffer = static_cast<unsigned char*>(alloca (nSize* 
sizeof(unsigned char)));
-
-    ConverterFactory &rCvt = GetConverterFactory ();
-    nSize = rCvt.Convert (pStr, nLen, pBuffer, nSize, 
RTL_TEXTENCODING_ISO_8859_1);
-
-    PSMoveTo (rPoint);
-    PSShowText (pBuffer, nLen, nSize, pDeltaArray);
-}
-
-void
-PrinterGfx::drawText(
-                     const Point& rPoint,
-                     const sal_Unicode* pStr,
-                     sal_Int16 nLen,
-                     const sal_Int32* pDeltaArray
-                     )
-{
-    if (!(nLen > 0))
-        return;
-
-    fonttype::type   eType          = mrFontMgr.getFontType (mnFontID);
-
-    if (   eType == fonttype::TrueType
-        && !mrFontMgr.isFontDownloadingAllowedForPrinting(mnFontID))
-    {
-        LicenseWarning(rPoint, pStr, nLen, pDeltaArray);
-        return;
-    }
-
-    // search for a glyph set matching the set font
-    std::list< GlyphSet >::iterator aIter;
-    for (aIter = maPS3Font.begin(); aIter != maPS3Font.end(); ++aIter)
-        if (   ((*aIter).GetFontID()  == mnFontID)
-            && ((*aIter).IsVertical() == mbTextVertical))
-        {
-            (*aIter).DrawText (*this, rPoint, pStr, nLen, pDeltaArray);
-            break;
-        }
-
-    // not found ? create a new one
-    if (aIter == maPS3Font.end())
-    {
-        maPS3Font.push_back (GlyphSet(mnFontID, mbTextVertical));
-        maPS3Font.back().DrawText (*this, rPoint, pStr, nLen, pDeltaArray);
-    }
-}
-
-int
-PrinterGfx::getCharWidth (bool b_vert, sal_Unicode n_char, CharacterMetric 
*p_bbox)
-{
-    b_vert = b_vert && (getVerticalDeltaAngle(n_char) != 0);
-    int w = b_vert ? p_bbox->height : p_bbox->width;
-    w *= maVirtualStatus.mnTextWidth ? maVirtualStatus.mnTextWidth : 
maVirtualStatus.mnTextHeight;
-    return w;
-}
-
-fontID
-PrinterGfx::getCharMetric (const Font2 &rFont, sal_Unicode n_char, 
CharacterMetric *p_bbox)
-{
-    p_bbox->width  = -1;
-    p_bbox->height = -1;
-
-    for (fontID n = 0; n < Font2Size; n++)
-    {
-        fontID n_font = rFont.GetFont(n);
-        if (n_font != -1)
-            mrFontMgr.getMetrics( n_font, n_char, n_char, p_bbox );
-        if (p_bbox->width >= 0 && p_bbox->height >= 0)
-            return n_font;
-    }
-    if (n_char != '?')
-        return getCharMetric (rFont, '?', p_bbox);
-
-    return rFont.GetFont(0) != -1 ? rFont.GetFont(0) : rFont.GetFont(1);
-}
-
 /*
  * spool the converted truetype fonts to the page header after the page body is
  * complete
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to