No more uses of printer built in fonts
Less parsing of AFM files at startup. Change-Id: I62d4c81d6e892f2356df22b53bb35c0f9f7bc344 Reviewed-on: https://gerrit.libreoffice.org/6860 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
committed by
Caolán McNamara
parent
ef1b4c3a5e
commit
003a3d7a55
@@ -56,7 +56,6 @@ enum type {
|
|||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
Type1 = 1,
|
Type1 = 1,
|
||||||
TrueType = 2,
|
TrueType = 2,
|
||||||
Builtin = 3
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,11 +140,9 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
|
|||||||
struct PrintFont;
|
struct PrintFont;
|
||||||
struct TrueTypeFontFile;
|
struct TrueTypeFontFile;
|
||||||
struct Type1FontFile;
|
struct Type1FontFile;
|
||||||
struct BuiltinFont;
|
|
||||||
friend struct PrintFont;
|
friend struct PrintFont;
|
||||||
friend struct TrueTypeFontFile;
|
friend struct TrueTypeFontFile;
|
||||||
friend struct Type1FontFile;
|
friend struct Type1FontFile;
|
||||||
friend struct BuiltinFont;
|
|
||||||
friend class FontCache;
|
friend class FontCache;
|
||||||
|
|
||||||
struct PrintFontMetrics
|
struct PrintFontMetrics
|
||||||
@@ -238,16 +235,6 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
|
|||||||
virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider );
|
virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider );
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BuiltinFont : public PrintFont
|
|
||||||
{
|
|
||||||
int m_nDirectory; // atom containing system dependent path
|
|
||||||
OString m_aMetricFile;
|
|
||||||
|
|
||||||
BuiltinFont() : PrintFont( fonttype::Builtin ) {}
|
|
||||||
virtual ~BuiltinFont();
|
|
||||||
virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider );
|
|
||||||
};
|
|
||||||
|
|
||||||
fontID m_nNextFontID;
|
fontID m_nNextFontID;
|
||||||
boost::unordered_map< fontID, PrintFont* > m_aFonts;
|
boost::unordered_map< fontID, PrintFont* > m_aFonts;
|
||||||
boost::unordered_map< int, FontFamily > m_aFamilyTypes;
|
boost::unordered_map< int, FontFamily > m_aFamilyTypes;
|
||||||
@@ -292,8 +279,6 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
|
|||||||
return findFontFileID(nDirID, rFile, 0) != 0;
|
return findFontFileID(nDirID, rFile, 0) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fontID findFontBuiltinID( int nPSNameAtom ) const;
|
|
||||||
|
|
||||||
FontFamily matchFamilyName( const OUString& rFamily ) const;
|
FontFamily matchFamilyName( const OUString& rFamily ) const;
|
||||||
|
|
||||||
PrintFont* getFont( fontID nID ) const
|
PrintFont* getFont( fontID nID ) const
|
||||||
@@ -349,16 +334,10 @@ public:
|
|||||||
// returns the number of managed fonts
|
// returns the number of managed fonts
|
||||||
int getFontCount() const { return m_aFonts.size(); }
|
int getFontCount() const { return m_aFonts.size(); }
|
||||||
|
|
||||||
// caution: the getFontList* methods can change the font list on demand
|
// returns the ids of all managed fonts.
|
||||||
// depending on the pParser argument. That is getFontCount() may
|
void getFontList( std::list< fontID >& rFontIDs );
|
||||||
// return a larger value after getFontList()
|
// get the font list and fast font info.
|
||||||
|
void getFontListWithFastInfo( std::list< FastPrintFontInfo >& rFonts );
|
||||||
// returns the ids of all managed fonts. on pParser != NULL
|
|
||||||
// all fonttype::Builtin type fonts are not listed
|
|
||||||
// which do not occur in the PPD of pParser
|
|
||||||
void getFontList( std::list< fontID >& rFontIDs, const PPDParser* pParser = NULL );
|
|
||||||
// get the font list and fast font info. see getFontList for pParser
|
|
||||||
void getFontListWithFastInfo( std::list< FastPrintFontInfo >& rFonts, const PPDParser* pParser = NULL );
|
|
||||||
|
|
||||||
// get font info for a specific font
|
// get font info for a specific font
|
||||||
bool getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const;
|
bool getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const;
|
||||||
@@ -453,16 +432,15 @@ public:
|
|||||||
// the user is responsible to allocate pArray large enough
|
// the user is responsible to allocate pArray large enough
|
||||||
bool getMetrics( fontID nFontID, const sal_Unicode* pString, int nLen, CharacterMetric* pArray, bool bVertical = false ) const;
|
bool getMetrics( fontID nFontID, const sal_Unicode* pString, int nLen, CharacterMetric* pArray, bool bVertical = false ) const;
|
||||||
|
|
||||||
// get encoding vector of font, currently only for Type1 and Builtin fonts
|
// get encoding vector of font, currently only for Type1 fonts
|
||||||
// returns NULL if encoding vector is empty or font is neither type1 or
|
// returns NULL if encoding vector is empty or font is not type1;
|
||||||
// builtin; if ppNonEncoded is set and non encoded type1 glyphs exist
|
// if ppNonEncoded is set and non encoded type1 glyphs exist
|
||||||
// then *ppNonEncoded is set to the mapping for nonencoded glyphs.
|
// then *ppNonEncoded is set to the mapping for nonencoded glyphs.
|
||||||
// the encoding vector contains -1 for non encoded glyphs
|
// the encoding vector contains -1 for non encoded glyphs
|
||||||
const std::map< sal_Unicode, sal_Int32 >* getEncodingMap( fontID nFontID, const std::map< sal_Unicode, OString >** ppNonEncoded ) const;
|
const std::map< sal_Unicode, sal_Int32 >* getEncodingMap( fontID nFontID, const std::map< sal_Unicode, OString >** ppNonEncoded ) const;
|
||||||
|
|
||||||
// evaluates copyright flags for TrueType fonts for printing/viewing
|
// evaluates copyright flags for TrueType fonts for printing/viewing
|
||||||
// type1 fonts do not have such a feature, so return for them is true
|
// type1 fonts do not have such a feature, so return for them is true
|
||||||
// returns true for builtin fonts (surprise!)
|
|
||||||
bool isFontDownloadingAllowedForPrinting( fontID nFont ) const;
|
bool isFontDownloadingAllowedForPrinting( fontID nFont ) const;
|
||||||
|
|
||||||
// helper for type 1 fonts
|
// helper for type 1 fonts
|
||||||
|
@@ -318,9 +318,7 @@ void FontCache::read()
|
|||||||
|
|
||||||
fonttype::type eType = (fonttype::type)atoi( pLine );
|
fonttype::type eType = (fonttype::type)atoi( pLine );
|
||||||
if( eType != fonttype::TrueType &&
|
if( eType != fonttype::TrueType &&
|
||||||
eType != fonttype::Type1 &&
|
eType != fonttype::Type1 )
|
||||||
eType != fonttype::Builtin
|
|
||||||
)
|
|
||||||
continue;
|
continue;
|
||||||
while( *pLine && *pLine != ';' )
|
while( *pLine && *pLine != ';' )
|
||||||
pLine++;
|
pLine++;
|
||||||
@@ -344,9 +342,6 @@ void FontCache::read()
|
|||||||
case fonttype::Type1:
|
case fonttype::Type1:
|
||||||
pFont = new PrintFontManager::Type1FontFile();
|
pFont = new PrintFontManager::Type1FontFile();
|
||||||
break;
|
break;
|
||||||
case fonttype::Builtin:
|
|
||||||
pFont = new PrintFontManager::BuiltinFont();
|
|
||||||
break;
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,10 +428,6 @@ void FontCache::read()
|
|||||||
nStyleTokenNr++;
|
nStyleTokenNr++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case fonttype::Builtin:
|
|
||||||
static_cast<PrintFontManager::BuiltinFont*>(pFont)->m_nDirectory = nDir;
|
|
||||||
static_cast<PrintFontManager::BuiltinFont*>(pFont)->m_aMetricFile = aFile;
|
|
||||||
break;
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
if( nTokens > nStyleTokenNr )
|
if( nTokens > nStyleTokenNr )
|
||||||
@@ -504,10 +495,6 @@ void FontCache::copyPrintFont( const PrintFontManager::PrintFont* pFrom, PrintFo
|
|||||||
static_cast<PrintFontManager::Type1FontFile*>(pTo)->m_aFontFile = static_cast<const PrintFontManager::Type1FontFile*>(pFrom)->m_aFontFile;
|
static_cast<PrintFontManager::Type1FontFile*>(pTo)->m_aFontFile = static_cast<const PrintFontManager::Type1FontFile*>(pFrom)->m_aFontFile;
|
||||||
static_cast<PrintFontManager::Type1FontFile*>(pTo)->m_aMetricFile = static_cast<const PrintFontManager::Type1FontFile*>(pFrom)->m_aMetricFile;
|
static_cast<PrintFontManager::Type1FontFile*>(pTo)->m_aMetricFile = static_cast<const PrintFontManager::Type1FontFile*>(pFrom)->m_aMetricFile;
|
||||||
break;
|
break;
|
||||||
case fonttype::Builtin:
|
|
||||||
static_cast<PrintFontManager::BuiltinFont*>(pTo)->m_nDirectory = static_cast<const PrintFontManager::BuiltinFont*>(pFrom)->m_nDirectory;
|
|
||||||
static_cast<PrintFontManager::BuiltinFont*>(pTo)->m_aMetricFile = static_cast<const PrintFontManager::BuiltinFont*>(pFrom)->m_aMetricFile;
|
|
||||||
break;
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
pTo->m_nFamilyName = pFrom->m_nFamilyName;
|
pTo->m_nFamilyName = pFrom->m_nFamilyName;
|
||||||
@@ -562,15 +549,6 @@ bool FontCache::equalsPrintFont( const PrintFontManager::PrintFont* pLeft, Print
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case fonttype::Builtin:
|
|
||||||
{
|
|
||||||
const PrintFontManager::BuiltinFont* pLT = static_cast<const PrintFontManager::BuiltinFont*>(pLeft);
|
|
||||||
const PrintFontManager::BuiltinFont* pRT = static_cast<const PrintFontManager::BuiltinFont*>(pRight);
|
|
||||||
if( pRT->m_nDirectory != pLT->m_nDirectory ||
|
|
||||||
pRT->m_aMetricFile != pLT->m_aMetricFile )
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
if( pRight->m_nFamilyName != pLeft->m_nFamilyName ||
|
if( pRight->m_nFamilyName != pLeft->m_nFamilyName ||
|
||||||
@@ -616,9 +594,6 @@ PrintFontManager::PrintFont* FontCache::clonePrintFont( const PrintFontManager::
|
|||||||
case fonttype::Type1:
|
case fonttype::Type1:
|
||||||
pFont = new PrintFontManager::Type1FontFile();
|
pFont = new PrintFontManager::Type1FontFile();
|
||||||
break;
|
break;
|
||||||
case fonttype::Builtin:
|
|
||||||
pFont = new PrintFontManager::BuiltinFont();
|
|
||||||
break;
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
if( pFont )
|
if( pFont )
|
||||||
@@ -669,10 +644,6 @@ void FontCache::updateFontCacheEntry( const PrintFontManager::PrintFont* pFont,
|
|||||||
nDirID = static_cast<const PrintFontManager::Type1FontFile*>(pFont)->m_nDirectory;
|
nDirID = static_cast<const PrintFontManager::Type1FontFile*>(pFont)->m_nDirectory;
|
||||||
aFile = static_cast<const PrintFontManager::Type1FontFile*>(pFont)->m_aFontFile;
|
aFile = static_cast<const PrintFontManager::Type1FontFile*>(pFont)->m_aFontFile;
|
||||||
break;
|
break;
|
||||||
case fonttype::Builtin:
|
|
||||||
nDirID = static_cast<const PrintFontManager::BuiltinFont*>(pFont)->m_nDirectory;
|
|
||||||
aFile = static_cast<const PrintFontManager::BuiltinFont*>(pFont)->m_aMetricFile;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -76,8 +76,6 @@
|
|||||||
#include "com/sun/star/beans/XMaterialHolder.hpp"
|
#include "com/sun/star/beans/XMaterialHolder.hpp"
|
||||||
#include "com/sun/star/beans/NamedValue.hpp"
|
#include "com/sun/star/beans/NamedValue.hpp"
|
||||||
|
|
||||||
#define PRINTER_METRICDIR "fontmetric"
|
|
||||||
|
|
||||||
using namespace vcl;
|
using namespace vcl;
|
||||||
using namespace utl;
|
using namespace utl;
|
||||||
using namespace psp;
|
using namespace psp;
|
||||||
@@ -205,12 +203,6 @@ PrintFontManager::TrueTypeFontFile::~TrueTypeFontFile()
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
PrintFontManager::BuiltinFont::~BuiltinFont()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool PrintFontManager::Type1FontFile::queryMetricPage( int /*nPage*/, MultiAtomProvider* pProvider )
|
bool PrintFontManager::Type1FontFile::queryMetricPage( int /*nPage*/, MultiAtomProvider* pProvider )
|
||||||
{
|
{
|
||||||
return readAfmMetrics( pProvider, false, false );
|
return readAfmMetrics( pProvider, false, false );
|
||||||
@@ -218,13 +210,6 @@ bool PrintFontManager::Type1FontFile::queryMetricPage( int /*nPage*/, MultiAtomP
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
bool PrintFontManager::BuiltinFont::queryMetricPage( int /*nPage*/, MultiAtomProvider* pProvider )
|
|
||||||
{
|
|
||||||
return readAfmMetrics( pProvider, false, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomProvider* /*pProvider*/ )
|
bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomProvider* /*pProvider*/ )
|
||||||
{
|
{
|
||||||
bool bSuccess = false;
|
bool bSuccess = false;
|
||||||
@@ -446,22 +431,6 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// hack for GB encoded builtin fonts posing as FontSpecific
|
|
||||||
if( m_eType == fonttype::Builtin && ( nAdobeEncoding == 3 || nAdobeEncoding == 0 ) )
|
|
||||||
{
|
|
||||||
int nLen = aFamily.getLength();
|
|
||||||
if( nLen > 2 &&
|
|
||||||
aFamily.endsWith("GB") &&
|
|
||||||
pInfo->numOfChars > 255 )
|
|
||||||
{
|
|
||||||
m_aEncoding = RTL_TEXTENCODING_GBK;
|
|
||||||
m_bFontEncodingOnly = true;
|
|
||||||
#if OSL_DEBUG_LEVEL > 1
|
|
||||||
fprintf( stderr, "found builtin font %s with GBK encoding\n", pInfo->gfi->fontName );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// #i37313# check if Fontspecific is not rather some character encoding
|
// #i37313# check if Fontspecific is not rather some character encoding
|
||||||
if( nAdobeEncoding == 3 && m_aEncoding == RTL_TEXTENCODING_SYMBOL )
|
if( nAdobeEncoding == 3 && m_aEncoding == RTL_TEXTENCODING_SYMBOL )
|
||||||
{
|
{
|
||||||
@@ -793,7 +762,7 @@ std::vector<fontID> PrintFontManager::addFontFile( const OString& rFileName )
|
|||||||
|
|
||||||
enum fontFormat
|
enum fontFormat
|
||||||
{
|
{
|
||||||
UNKNOWN, TRUETYPE, CFF, TYPE1, AFM
|
UNKNOWN, TRUETYPE, CFF, TYPE1
|
||||||
};
|
};
|
||||||
|
|
||||||
bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, ::std::list< PrintFontManager::PrintFont* >& rNewFonts, const char *pFormat ) const
|
bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, ::std::list< PrintFontManager::PrintFont* >& rNewFonts, const char *pFormat ) const
|
||||||
@@ -825,8 +794,6 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, ::
|
|||||||
OString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) );
|
OString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) );
|
||||||
if( aExt.equalsIgnoreAsciiCase("pfb") || aExt.equalsIgnoreAsciiCase("pfa") )
|
if( aExt.equalsIgnoreAsciiCase("pfb") || aExt.equalsIgnoreAsciiCase("pfa") )
|
||||||
eFormat = TYPE1;
|
eFormat = TYPE1;
|
||||||
else if( aExt.equalsIgnoreAsciiCase("afm"))
|
|
||||||
eFormat = AFM;
|
|
||||||
else if( aExt.equalsIgnoreAsciiCase("ttf")
|
else if( aExt.equalsIgnoreAsciiCase("ttf")
|
||||||
|| aExt.equalsIgnoreAsciiCase("ttc")
|
|| aExt.equalsIgnoreAsciiCase("ttc")
|
||||||
|| aExt.equalsIgnoreAsciiCase("tte") ) // #i33947# for Gaiji support
|
|| aExt.equalsIgnoreAsciiCase("tte") ) // #i33947# for Gaiji support
|
||||||
@@ -881,18 +848,6 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, ::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (eFormat == AFM)
|
|
||||||
{
|
|
||||||
BuiltinFont* pFont = new BuiltinFont();
|
|
||||||
pFont->m_nDirectory = nDirID;
|
|
||||||
pFont->m_aMetricFile = rFontFile;
|
|
||||||
if( pFont->readAfmMetrics( m_pAtoms, false, true ) )
|
|
||||||
{
|
|
||||||
rNewFonts.push_back( pFont );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
delete pFont;
|
|
||||||
}
|
|
||||||
else if (eFormat == TRUETYPE || eFormat == CFF)
|
else if (eFormat == TRUETYPE || eFormat == CFF)
|
||||||
{
|
{
|
||||||
// get number of ttc entries
|
// get number of ttc entries
|
||||||
@@ -966,21 +921,6 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, ::
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
fontID PrintFontManager::findFontBuiltinID( int nPSNameAtom ) const
|
|
||||||
{
|
|
||||||
fontID nID = 0;
|
|
||||||
::boost::unordered_map< fontID, PrintFont* >::const_iterator it;
|
|
||||||
for( it = m_aFonts.begin(); nID == 0 && it != m_aFonts.end(); ++it )
|
|
||||||
{
|
|
||||||
if( it->second->m_eType == fonttype::Builtin &&
|
|
||||||
it->second->m_nPSName == nPSNameAtom )
|
|
||||||
nID = it->first;
|
|
||||||
}
|
|
||||||
return nID;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
fontID PrintFontManager::findFontFileID( int nDirID, const OString& rFontFile, int nFaceIndex ) const
|
fontID PrintFontManager::findFontFileID( int nDirID, const OString& rFontFile, int nFaceIndex ) const
|
||||||
{
|
{
|
||||||
fontID nID = 0;
|
fontID nID = 0;
|
||||||
@@ -1012,11 +952,6 @@ fontID PrintFontManager::findFontFileID( int nDirID, const OString& rFontFile, i
|
|||||||
nID = it->first;
|
nID = it->first;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case fonttype::Builtin:
|
|
||||||
if( static_cast<const BuiltinFont*>((*it).second)->m_nDirectory == nDirID &&
|
|
||||||
static_cast<const BuiltinFont*>((*it).second)->m_aMetricFile == rFontFile )
|
|
||||||
nID = it->first;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1056,11 +991,6 @@ std::vector<fontID> PrintFontManager::findFontFileIDs( int nDirID, const OString
|
|||||||
aIds.push_back(it->first);
|
aIds.push_back(it->first);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case fonttype::Builtin:
|
|
||||||
if( static_cast<const BuiltinFont*>((*it).second)->m_nDirectory == nDirID &&
|
|
||||||
static_cast<const BuiltinFont*>((*it).second)->m_aMetricFile == rFontFile )
|
|
||||||
aIds.push_back(it->first);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1383,8 +1313,6 @@ void PrintFontManager::initialize()
|
|||||||
CALLGRIND_ZERO_STATS();
|
CALLGRIND_ZERO_STATS();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
long aDirEntBuffer[ (sizeof(struct dirent)+PATH_MAX)+1 ];
|
|
||||||
|
|
||||||
if( ! m_pFontCache )
|
if( ! m_pFontCache )
|
||||||
{
|
{
|
||||||
#if OSL_DEBUG_LEVEL > 1
|
#if OSL_DEBUG_LEVEL > 1
|
||||||
@@ -1416,9 +1344,6 @@ void PrintFontManager::initialize()
|
|||||||
clock_t aStart;
|
clock_t aStart;
|
||||||
clock_t aStep1;
|
clock_t aStep1;
|
||||||
clock_t aStep2;
|
clock_t aStep2;
|
||||||
clock_t aStep3;
|
|
||||||
int nBuiltinFonts = 0;
|
|
||||||
int nCached = 0;
|
|
||||||
|
|
||||||
struct tms tms;
|
struct tms tms;
|
||||||
|
|
||||||
@@ -1493,14 +1418,9 @@ void PrintFontManager::initialize()
|
|||||||
m_aFontFileToFontID[ static_cast<Type1FontFile*>(*it)->m_aFontFile ].insert( aFont );
|
m_aFontFileToFontID[ static_cast<Type1FontFile*>(*it)->m_aFontFile ].insert( aFont );
|
||||||
else if( (*it)->m_eType == fonttype::TrueType )
|
else if( (*it)->m_eType == fonttype::TrueType )
|
||||||
m_aFontFileToFontID[ static_cast<TrueTypeFontFile*>(*it)->m_aFontFile ].insert( aFont );
|
m_aFontFileToFontID[ static_cast<TrueTypeFontFile*>(*it)->m_aFontFile ].insert( aFont );
|
||||||
else if( (*it)->m_eType == fonttype::Builtin )
|
|
||||||
m_aFontFileToFontID[ static_cast<BuiltinFont*>(*it)->m_aMetricFile ].insert( aFont );
|
|
||||||
#if OSL_DEBUG_LEVEL > 1
|
#if OSL_DEBUG_LEVEL > 1
|
||||||
else
|
else
|
||||||
fprintf(stderr, "Un-cached type '%d'\n", (*it)->m_eType);
|
fprintf(stderr, "Un-cached type '%d'\n", (*it)->m_eType);
|
||||||
if( (*it)->m_eType == fonttype::Builtin )
|
|
||||||
nBuiltinFonts++;
|
|
||||||
nCached++;
|
|
||||||
#if OSL_DEBUG_LEVEL > 2
|
#if OSL_DEBUG_LEVEL > 2
|
||||||
fprintf( stderr, "adding cached font %d: %s\n", aFont, getFontFileSysPath( aFont ).getStr() );
|
fprintf( stderr, "adding cached font %d: %s\n", aFont, getFontFileSysPath( aFont ).getStr() );
|
||||||
#endif
|
#endif
|
||||||
@@ -1516,95 +1436,6 @@ void PrintFontManager::initialize()
|
|||||||
aStep1 = times( &tms );
|
aStep1 = times( &tms );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// part two - look for metrics for builtin printer fonts
|
|
||||||
std::list< OUString > aMetricDirs;
|
|
||||||
psp::getPrinterPathList( aMetricDirs, PRINTER_METRICDIR );
|
|
||||||
|
|
||||||
for( std::list< OUString >::const_iterator met_dir_it = aMetricDirs.begin(); met_dir_it != aMetricDirs.end(); ++met_dir_it )
|
|
||||||
{
|
|
||||||
OString aDir = OUStringToOString( *met_dir_it, aEncoding );
|
|
||||||
|
|
||||||
// ask the font cache whether it handles this directory
|
|
||||||
std::list< PrintFont* > aCacheFonts;
|
|
||||||
|
|
||||||
if( m_pFontCache->listDirectory( aDir, aCacheFonts ) )
|
|
||||||
{
|
|
||||||
#if OSL_DEBUG_LEVEL > 1
|
|
||||||
fprintf( stderr, "adding cache directory: %s\n", aDir.getStr() );
|
|
||||||
#endif
|
|
||||||
for( ::std::list< PrintFont* >::iterator it = aCacheFonts.begin(); it != aCacheFonts.end(); ++it )
|
|
||||||
{
|
|
||||||
fontID aFont = m_nNextFontID++;
|
|
||||||
m_aFonts[ aFont ] = *it;
|
|
||||||
if( (*it)->m_eType == fonttype::Type1 )
|
|
||||||
m_aFontFileToFontID[ static_cast<Type1FontFile*>(*it)->m_aFontFile ].insert( aFont );
|
|
||||||
else if( (*it)->m_eType == fonttype::TrueType )
|
|
||||||
m_aFontFileToFontID[ static_cast<TrueTypeFontFile*>(*it)->m_aFontFile ].insert( aFont );
|
|
||||||
else if( (*it)->m_eType == fonttype::Builtin )
|
|
||||||
m_aFontFileToFontID[ static_cast<BuiltinFont*>(*it)->m_aMetricFile ].insert( aFont );
|
|
||||||
#if OSL_DEBUG_LEVEL > 1
|
|
||||||
if( (*it)->m_eType == fonttype::Builtin )
|
|
||||||
nBuiltinFonts++;
|
|
||||||
nCached++;
|
|
||||||
#if OSL_DEBUG_LEVEL > 2
|
|
||||||
fprintf( stderr, "adding cached font %d: from %s\n", aFont,
|
|
||||||
getFontFileSysPath( aFont ).getStr() );
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
DIR* pDIR = opendir( aDir.getStr() );
|
|
||||||
if( pDIR )
|
|
||||||
{
|
|
||||||
struct dirent* pDirEntry = (struct dirent*)aDirEntBuffer;
|
|
||||||
int nDirID = getDirectoryAtom( aDir, true );
|
|
||||||
int nDirFonts = 0;
|
|
||||||
|
|
||||||
while( ! readdir_r( pDIR, (struct dirent*)aDirEntBuffer, &pDirEntry ) && pDirEntry )
|
|
||||||
{
|
|
||||||
OStringBuffer aFile(aDir);
|
|
||||||
aFile.append('/').append(pDirEntry->d_name);
|
|
||||||
struct stat aStat;
|
|
||||||
if( ! stat( aFile.getStr(), &aStat )
|
|
||||||
&& S_ISREG( aStat.st_mode )
|
|
||||||
)
|
|
||||||
{
|
|
||||||
OString aFileName( pDirEntry->d_name, strlen( pDirEntry->d_name ) );
|
|
||||||
OString aExt( aFileName.copy( aFileName.lastIndexOf( '.' )+1 ) );
|
|
||||||
if( aExt.equalsIgnoreAsciiCase( "afm" ) )
|
|
||||||
{
|
|
||||||
::std::list< PrintFont* > aNewFonts;
|
|
||||||
|
|
||||||
analyzeFontFile( nDirID, aFileName, aNewFonts );
|
|
||||||
for( ::std::list< PrintFont* >::iterator it = aNewFonts.begin(); it != aNewFonts.end(); ++it )
|
|
||||||
{
|
|
||||||
if( findFontBuiltinID( (*it)->m_nPSName ) == 0 )
|
|
||||||
{
|
|
||||||
m_aFontFileToFontID[ aFileName ].insert( m_nNextFontID );
|
|
||||||
m_aFonts[ m_nNextFontID++ ] = *it;
|
|
||||||
m_pFontCache->updateFontCacheEntry( *it, false );
|
|
||||||
++nDirFonts;
|
|
||||||
#if OSL_DEBUG_LEVEL > 2
|
|
||||||
nBuiltinFonts++;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
delete *it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir( pDIR );
|
|
||||||
if( ! nDirFonts )
|
|
||||||
m_pFontCache->markEmptyDir( nDirID );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if OSL_DEBUG_LEVEL > 1
|
|
||||||
aStep2 = times( &tms );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// part three - fill in family styles
|
// part three - fill in family styles
|
||||||
::boost::unordered_map< fontID, PrintFont* >::iterator font_it;
|
::boost::unordered_map< fontID, PrintFont* >::iterator font_it;
|
||||||
@@ -1621,12 +1452,11 @@ void PrintFontManager::initialize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if OSL_DEBUG_LEVEL > 1
|
#if OSL_DEBUG_LEVEL > 1
|
||||||
aStep3 = times( &tms );
|
aStep2 = times( &tms );
|
||||||
fprintf( stderr, "PrintFontManager::initialize: collected %" SAL_PRI_SIZET "u fonts (%d builtin, %d cached)\n", m_aFonts.size(), nBuiltinFonts, nCached );
|
fprintf( stderr, "PrintFontManager::initialize: collected %" SAL_PRI_SIZET "u fonts\n", m_aFonts.size() );
|
||||||
double fTick = (double)sysconf( _SC_CLK_TCK );
|
double fTick = (double)sysconf( _SC_CLK_TCK );
|
||||||
fprintf( stderr, "Step 1 took %lf seconds\n", (double)(aStep1 - aStart)/fTick );
|
fprintf( stderr, "Step 1 took %lf seconds\n", (double)(aStep1 - aStart)/fTick );
|
||||||
fprintf( stderr, "Step 2 took %lf seconds\n", (double)(aStep2 - aStep1)/fTick );
|
fprintf( stderr, "Step 2 took %lf seconds\n", (double)(aStep2 - aStep1)/fTick );
|
||||||
fprintf( stderr, "Step 3 took %lf seconds\n", (double)(aStep3 - aStep2)/fTick );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_pFontCache->flush();
|
m_pFontCache->flush();
|
||||||
@@ -1638,147 +1468,14 @@ void PrintFontManager::initialize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
inline bool
|
|
||||||
equalPitch (FontPitch from, FontPitch to)
|
|
||||||
{
|
|
||||||
return from == to;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool
|
void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs )
|
||||||
equalWeight (FontWeight from, FontWeight to)
|
|
||||||
{
|
|
||||||
return from > to ? (from - to) <= 3 : (to - from) <= 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool
|
|
||||||
equalItalic (FontItalic from, FontItalic to)
|
|
||||||
{
|
|
||||||
if ( (from == ITALIC_NORMAL) || (from == ITALIC_OBLIQUE) )
|
|
||||||
return (to == ITALIC_NORMAL) || (to == ITALIC_OBLIQUE);
|
|
||||||
return to == from;
|
|
||||||
}
|
|
||||||
inline bool
|
|
||||||
equalEncoding (rtl_TextEncoding from, rtl_TextEncoding to)
|
|
||||||
{
|
|
||||||
if ((from == RTL_TEXTENCODING_ISO_8859_1) || (from == RTL_TEXTENCODING_MS_1252))
|
|
||||||
return (to == RTL_TEXTENCODING_ISO_8859_1) || (to == RTL_TEXTENCODING_MS_1252);
|
|
||||||
return from == to;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
struct BuiltinFontIdentifier
|
|
||||||
{
|
|
||||||
OUString aFamily;
|
|
||||||
FontItalic eItalic;
|
|
||||||
FontWeight eWeight;
|
|
||||||
FontPitch ePitch;
|
|
||||||
rtl_TextEncoding aEncoding;
|
|
||||||
|
|
||||||
BuiltinFontIdentifier( const OUString& rFam,
|
|
||||||
FontItalic eIt,
|
|
||||||
FontWeight eWg,
|
|
||||||
FontPitch ePt,
|
|
||||||
rtl_TextEncoding enc ) :
|
|
||||||
aFamily( rFam ),
|
|
||||||
eItalic( eIt ),
|
|
||||||
eWeight( eWg ),
|
|
||||||
ePitch( ePt ),
|
|
||||||
aEncoding( enc )
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool operator==( const BuiltinFontIdentifier& rRight ) const
|
|
||||||
{
|
|
||||||
return equalItalic( eItalic, rRight.eItalic ) &&
|
|
||||||
equalWeight( eWeight, rRight.eWeight ) &&
|
|
||||||
equalPitch( ePitch, rRight.ePitch ) &&
|
|
||||||
equalEncoding( aEncoding, rRight.aEncoding ) &&
|
|
||||||
aFamily.equalsIgnoreAsciiCase( rRight.aFamily );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BuiltinFontIdentifierHash
|
|
||||||
{
|
|
||||||
size_t operator()( const BuiltinFontIdentifier& rFont ) const
|
|
||||||
{
|
|
||||||
return rFont.aFamily.hashCode() ^ rFont.eItalic ^ rFont.eWeight ^ rFont.ePitch ^ rFont.aEncoding;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDParser* pParser )
|
|
||||||
{
|
{
|
||||||
rFontIDs.clear();
|
rFontIDs.clear();
|
||||||
boost::unordered_map< fontID, PrintFont* >::const_iterator it;
|
boost::unordered_map< fontID, PrintFont* >::const_iterator it;
|
||||||
|
|
||||||
/*
|
|
||||||
* Note: there are two easy steps making this faster:
|
|
||||||
* first: insert the printer builtins first, then the not builtins,
|
|
||||||
* if they do not match.
|
|
||||||
* drawback: this would change the sequence of fonts; this could have
|
|
||||||
* subtle, unknown consequences in vcl font matching
|
|
||||||
* second: instead of comparing attributes to see whether a softfont
|
|
||||||
* is duplicate to a builtin one could simply compare the PSName (which is
|
|
||||||
* supposed to be unique), which at this point is just an int.
|
|
||||||
* drawback: this could change which fonts are listed; especially TrueType
|
|
||||||
* fonts often have a rather dubious PSName, so this could change the
|
|
||||||
* font list not so subtle.
|
|
||||||
* Until getFontList for a printer becomes a performance issue (which is
|
|
||||||
* currently not the case), best stay with the current algorithm.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// fill sets of printer supported fonts
|
|
||||||
if( pParser )
|
|
||||||
{
|
|
||||||
std::set<int> aBuiltinPSNames;
|
|
||||||
boost::unordered_set< BuiltinFontIdentifier,
|
|
||||||
BuiltinFontIdentifierHash
|
|
||||||
> aBuiltinFonts;
|
|
||||||
|
|
||||||
int nFonts = pParser->getFonts();
|
|
||||||
for( int i = 0; i < nFonts; i++ )
|
|
||||||
aBuiltinPSNames.insert( m_pAtoms->getAtom( ATOM_PSNAME, pParser->getFont( i ) ) );
|
|
||||||
for( it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
|
|
||||||
{
|
|
||||||
PrintFont* pFont = it->second;
|
|
||||||
if( it->second->m_eType == fonttype::Builtin &&
|
|
||||||
aBuiltinPSNames.find( pFont->m_nPSName ) != aBuiltinPSNames.end() )
|
|
||||||
{
|
|
||||||
aBuiltinFonts.insert( BuiltinFontIdentifier(
|
|
||||||
m_pAtoms->getString( ATOM_FAMILYNAME, pFont->m_nFamilyName ),
|
|
||||||
pFont->m_eItalic,
|
|
||||||
pFont->m_eWeight,
|
|
||||||
pFont->m_ePitch,
|
|
||||||
pFont->m_aEncoding
|
|
||||||
) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for( it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
|
|
||||||
{
|
|
||||||
PrintFont* pFont = it->second;
|
|
||||||
if( it->second->m_eType == fonttype::Builtin )
|
|
||||||
{
|
|
||||||
if( aBuiltinPSNames.find( pFont->m_nPSName ) != aBuiltinPSNames.end() )
|
|
||||||
{
|
|
||||||
rFontIDs.push_back( it->first );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( aBuiltinFonts.find( BuiltinFontIdentifier(
|
|
||||||
m_pAtoms->getString( ATOM_FAMILYNAME, pFont->m_nFamilyName ),
|
|
||||||
pFont->m_eItalic,
|
|
||||||
pFont->m_eWeight,
|
|
||||||
pFont->m_ePitch,
|
|
||||||
pFont->m_aEncoding
|
|
||||||
) ) == aBuiltinFonts.end() )
|
|
||||||
{
|
|
||||||
rFontIDs.push_back( it->first );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // no specific printer
|
|
||||||
{
|
|
||||||
for( it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
|
for( it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
|
||||||
rFontIDs.push_back( it->first );
|
rFontIDs.push_back( it->first );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@@ -1830,11 +1527,11 @@ void PrintFontManager::fillPrintFontInfo( PrintFont* pFont, PrintFontInfo& rInfo
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
void PrintFontManager::getFontListWithFastInfo( ::std::list< FastPrintFontInfo >& rFonts, const PPDParser* pParser )
|
void PrintFontManager::getFontListWithFastInfo( ::std::list< FastPrintFontInfo >& rFonts )
|
||||||
{
|
{
|
||||||
rFonts.clear();
|
rFonts.clear();
|
||||||
::std::list< fontID > aFontList;
|
::std::list< fontID > aFontList;
|
||||||
getFontList( aFontList, pParser );
|
getFontList( aFontList );
|
||||||
|
|
||||||
::std::list< fontID >::iterator it;
|
::std::list< fontID >::iterator it;
|
||||||
for( it = aFontList.begin(); it != aFontList.end(); ++it )
|
for( it = aFontList.begin(); it != aFontList.end(); ++it )
|
||||||
@@ -1883,7 +1580,7 @@ bool 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_nXMin == 0 && pFont->m_nYMin == 0 && pFont->m_nXMax == 0 && pFont->m_nYMax == 0 )
|
||||||
{
|
{
|
||||||
// might be a truetype font not analyzed or type1 without metrics read
|
// might be a truetype font not analyzed or type1 without metrics read
|
||||||
if( pFont->m_eType == fonttype::Type1 || pFont->m_eType == fonttype::Builtin )
|
if( pFont->m_eType == fonttype::Type1 )
|
||||||
pFont->readAfmMetrics( m_pAtoms, false, true );
|
pFont->readAfmMetrics( m_pAtoms, false, true );
|
||||||
else if( pFont->m_eType == fonttype::TrueType )
|
else if( pFont->m_eType == fonttype::TrueType )
|
||||||
analyzeTrueTypeFile( pFont );
|
analyzeTrueTypeFile( pFont );
|
||||||
@@ -1995,14 +1692,6 @@ OString PrintFontManager::getAfmFile( PrintFont* pFont ) const
|
|||||||
aMetricPath += pPSFont->m_aMetricFile;
|
aMetricPath += pPSFont->m_aMetricFile;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case fonttype::Builtin:
|
|
||||||
{
|
|
||||||
BuiltinFont* pBuiltinFont = static_cast< BuiltinFont* >(pFont);
|
|
||||||
aMetricPath = getDirectory( pBuiltinFont->m_nDirectory );
|
|
||||||
aMetricPath += "/";
|
|
||||||
aMetricPath += pBuiltinFont->m_aMetricFile;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2058,7 +1747,7 @@ int PrintFontManager::getFontAscend( fontID nFontID ) const
|
|||||||
// might be a truetype font not yet analyzed
|
// might be a truetype font not yet analyzed
|
||||||
if( pFont->m_eType == fonttype::TrueType )
|
if( pFont->m_eType == fonttype::TrueType )
|
||||||
analyzeTrueTypeFile( pFont );
|
analyzeTrueTypeFile( pFont );
|
||||||
else if( pFont->m_eType == fonttype::Type1 || pFont->m_eType == fonttype::Builtin )
|
else if( pFont->m_eType == fonttype::Type1 )
|
||||||
pFont->readAfmMetrics( m_pAtoms, false, true );
|
pFont->readAfmMetrics( m_pAtoms, false, true );
|
||||||
}
|
}
|
||||||
return pFont->m_nAscend;
|
return pFont->m_nAscend;
|
||||||
@@ -2074,7 +1763,7 @@ int PrintFontManager::getFontDescend( fontID nFontID ) const
|
|||||||
// might be a truetype font not yet analyzed
|
// might be a truetype font not yet analyzed
|
||||||
if( pFont->m_eType == fonttype::TrueType )
|
if( pFont->m_eType == fonttype::TrueType )
|
||||||
analyzeTrueTypeFile( pFont );
|
analyzeTrueTypeFile( pFont );
|
||||||
else if( pFont->m_eType == fonttype::Type1 || pFont->m_eType == fonttype::Builtin )
|
else if( pFont->m_eType == fonttype::Type1 )
|
||||||
pFont->readAfmMetrics( m_pAtoms, false, true );
|
pFont->readAfmMetrics( m_pAtoms, false, true );
|
||||||
}
|
}
|
||||||
return pFont->m_nDescend;
|
return pFont->m_nDescend;
|
||||||
@@ -2160,7 +1849,7 @@ bool PrintFontManager::getMetrics( fontID nFontID, const sal_Unicode* pString, i
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// might be a font not yet analyzed
|
// might be a font not yet analyzed
|
||||||
if( pFont->m_eType == fonttype::Type1 || pFont->m_eType == fonttype::Builtin )
|
if( pFont->m_eType == fonttype::Type1 )
|
||||||
pFont->readAfmMetrics( m_pAtoms, false, false );
|
pFont->readAfmMetrics( m_pAtoms, false, false );
|
||||||
else if( pFont->m_eType == fonttype::TrueType )
|
else if( pFont->m_eType == fonttype::TrueType )
|
||||||
analyzeTrueTypeFile( pFont );
|
analyzeTrueTypeFile( pFont );
|
||||||
@@ -2207,7 +1896,7 @@ bool PrintFontManager::getMetrics( fontID nFontID, sal_Unicode minCharacter, sal
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// might be a font not yet analyzed
|
// might be a font not yet analyzed
|
||||||
if( pFont->m_eType == fonttype::Type1 || pFont->m_eType == fonttype::Builtin )
|
if( pFont->m_eType == fonttype::Type1 )
|
||||||
pFont->readAfmMetrics( m_pAtoms, false, false );
|
pFont->readAfmMetrics( m_pAtoms, false, false );
|
||||||
else if( pFont->m_eType == fonttype::TrueType )
|
else if( pFont->m_eType == fonttype::TrueType )
|
||||||
analyzeTrueTypeFile( pFont );
|
analyzeTrueTypeFile( pFont );
|
||||||
@@ -2477,9 +2166,7 @@ void PrintFontManager::getGlyphWidths( fontID nFont,
|
|||||||
const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( fontID nFont, const std::map< sal_Unicode, OString >** pNonEncoded ) const
|
const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( fontID nFont, const std::map< sal_Unicode, OString >** pNonEncoded ) const
|
||||||
{
|
{
|
||||||
PrintFont* pFont = getFont( nFont );
|
PrintFont* pFont = getFont( nFont );
|
||||||
if( !pFont ||
|
if( !pFont || pFont->m_eType != fonttype::Type1 )
|
||||||
(pFont->m_eType != fonttype::Type1 && pFont->m_eType != fonttype::Builtin)
|
|
||||||
)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if( ! pFont->m_aEncodingVector.size() )
|
if( ! pFont->m_aEncodingVector.size() )
|
||||||
|
@@ -895,7 +895,7 @@ void GenPspGraphics::GetDevFontList( ImplDevFontList *pList )
|
|||||||
{
|
{
|
||||||
::std::list< psp::fontID > aList;
|
::std::list< psp::fontID > aList;
|
||||||
psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
|
psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
|
||||||
rMgr.getFontList( aList, m_pJobData->m_pParser );
|
rMgr.getFontList( aList );
|
||||||
|
|
||||||
::std::list< psp::fontID >::iterator it;
|
::std::list< psp::fontID >::iterator it;
|
||||||
psp::FastPrintFontInfo aInfo;
|
psp::FastPrintFontInfo aInfo;
|
||||||
@@ -1104,10 +1104,6 @@ ImplDevFontAttributes GenPspGraphics::Info2DevFontAttributes( const psp::FastPri
|
|||||||
|
|
||||||
switch( rInfo.m_eType )
|
switch( rInfo.m_eType )
|
||||||
{
|
{
|
||||||
case psp::fonttype::Builtin:
|
|
||||||
aDFA.mnQuality = 1024;
|
|
||||||
aDFA.mbDevice = true;
|
|
||||||
break;
|
|
||||||
case psp::fonttype::TrueType:
|
case psp::fonttype::TrueType:
|
||||||
aDFA.mnQuality = 512;
|
aDFA.mnQuality = 512;
|
||||||
aDFA.mbDevice = false;
|
aDFA.mbDevice = false;
|
||||||
|
@@ -338,7 +338,6 @@ GlyphSet::GetCharSetName (sal_Int32 nGlyphSetID)
|
|||||||
return aSetName.makeStringAndClear();
|
return aSetName.makeStringAndClear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* (meBaseType == fonttype::Type1 || meBaseType == fonttype::Builtin) */
|
|
||||||
{
|
{
|
||||||
return maBaseName;
|
return maBaseName;
|
||||||
}
|
}
|
||||||
@@ -358,7 +357,6 @@ GlyphSet::GetGlyphSetName (sal_Int32 nGlyphSetID)
|
|||||||
return aSetName.makeStringAndClear();
|
return aSetName.makeStringAndClear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* (meBaseType == fonttype::Type1 || meBaseType == fonttype::Builtin) */
|
|
||||||
{
|
{
|
||||||
return maBaseName;
|
return maBaseName;
|
||||||
}
|
}
|
||||||
@@ -371,7 +369,6 @@ GlyphSet::GetGlyphSetEncoding (sal_Int32 nGlyphSetID)
|
|||||||
return RTL_TEXTENCODING_DONTKNOW;
|
return RTL_TEXTENCODING_DONTKNOW;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* (meBaseType == fonttype::Type1 || meBaseType == fonttype::Builtin) */
|
|
||||||
if (mnBaseEncoding == RTL_TEXTENCODING_SYMBOL)
|
if (mnBaseEncoding == RTL_TEXTENCODING_SYMBOL)
|
||||||
return RTL_TEXTENCODING_SYMBOL;
|
return RTL_TEXTENCODING_SYMBOL;
|
||||||
else
|
else
|
||||||
@@ -411,7 +408,7 @@ void
|
|||||||
GlyphSet::PSDefineReencodedFont (osl::File* pOutFile, sal_Int32 nGlyphSetID)
|
GlyphSet::PSDefineReencodedFont (osl::File* pOutFile, sal_Int32 nGlyphSetID)
|
||||||
{
|
{
|
||||||
// only for ps fonts
|
// only for ps fonts
|
||||||
if ((meBaseType != fonttype::Builtin) && (meBaseType != fonttype::Type1))
|
if (meBaseType != fonttype::Type1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sal_Char pEncodingVector [256];
|
sal_Char pEncodingVector [256];
|
||||||
@@ -617,7 +614,7 @@ sal_Bool
|
|||||||
GlyphSet::PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx)
|
GlyphSet::PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx)
|
||||||
{
|
{
|
||||||
// only for ps fonts
|
// only for ps fonts
|
||||||
if ((meBaseType != fonttype::Builtin) && (meBaseType != fonttype::Type1))
|
if (meBaseType != fonttype::Type1)
|
||||||
return sal_False;
|
return sal_False;
|
||||||
if (mnBaseEncoding == RTL_TEXTENCODING_SYMBOL)
|
if (mnBaseEncoding == RTL_TEXTENCODING_SYMBOL)
|
||||||
return sal_False;
|
return sal_False;
|
||||||
|
@@ -718,8 +718,6 @@ PrinterGfx::writeResources( osl::File* pFile, std::list< OString >& rSuppliedFon
|
|||||||
aIter->PSUploadFont (*pFile, *this, mbUploadPS42Fonts ? true : false, rSuppliedFonts );
|
aIter->PSUploadFont (*pFile, *this, mbUploadPS42Fonts ? true : false, rSuppliedFonts );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// ( aIter->GetFontType() == fonttype::Type1
|
|
||||||
// || aIter->GetFontType() == fonttype::Builtin )
|
|
||||||
{
|
{
|
||||||
aIter->PSUploadEncoding (pFile, *this);
|
aIter->PSUploadEncoding (pFile, *this);
|
||||||
}
|
}
|
||||||
|
@@ -269,11 +269,6 @@ void SvpSalGraphics::GetDevFontList( ImplDevFontList* pDevFontList )
|
|||||||
if( !rMgr.getFontFastInfo( *it, aInfo ) )
|
if( !rMgr.getFontFastInfo( *it, aInfo ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// the GlyphCache must not bother with builtin fonts because
|
|
||||||
// it cannot access or use them anyway
|
|
||||||
if( aInfo.m_eType == psp::fonttype::Builtin )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// normalize face number to the GlyphCache
|
// normalize face number to the GlyphCache
|
||||||
int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID );
|
int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID );
|
||||||
|
|
||||||
|
@@ -554,11 +554,6 @@ void X11SalGraphics::GetDevFontList( ImplDevFontList *pList )
|
|||||||
if( !rMgr.getFontFastInfo( *it, aInfo ) )
|
if( !rMgr.getFontFastInfo( *it, aInfo ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// the GlyphCache must not bother with builtin fonts because
|
|
||||||
// it cannot access or use them anyway
|
|
||||||
if( aInfo.m_eType == psp::fonttype::Builtin )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// normalize face number to the GlyphCache
|
// normalize face number to the GlyphCache
|
||||||
int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID );
|
int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user