LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/vcl - fontmanager.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 30 36.7 %
Date: 2012-12-27 Functions: 5 13 38.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef _PSPRINT_FONTMANAGER_HXX_
      21             : #define _PSPRINT_FONTMANAGER_HXX_
      22             : 
      23             : #include <boost/unordered_map.hpp>
      24             : #include <map>
      25             : #include <list>
      26             : #include <set>
      27             : 
      28             : #include "vcl/dllapi.h"
      29             : #include "vcl/helper.hxx"
      30             : #include "vcl/timer.hxx"
      31             : #include "vcl/vclenum.hxx"
      32             : #include "com/sun/star/lang/Locale.hpp"
      33             : 
      34             : #include <vector>
      35             : 
      36             : #define ATOM_FAMILYNAME                     2
      37             : #define ATOM_PSNAME                         3
      38             : 
      39             : /*
      40             :  *  some words on metrics: every length returned by PrintFontManager and
      41             :  *  friends are PostScript afm style, that is they are 1/1000 font height
      42             :  */
      43             : 
      44             : // forward declarations
      45             : namespace utl { class MultiAtomProvider; } // see unotools/atom.hxx
      46             : class FontSubsetInfo;
      47             : class ImplFontOptions;
      48             : class FontSelectPattern;
      49             : 
      50             : namespace psp {
      51             : class PPDParser; // see ppdparser.hxx
      52             : 
      53             : namespace fonttype
      54             : {
      55             : enum type {
      56             :     Unknown = 0,
      57             :     Type1 = 1,
      58             :     TrueType = 2,
      59             :     Builtin = 3
      60             : };
      61             : }
      62             : 
      63             : /*
      64             :  *  the difference between FastPrintFontInfo and PrintFontInfo
      65             :  *  is that the information in FastPrintFontInfo can usually
      66             :  *  be gathered without openening either the font file or
      67             :  *  an afm metric file. they are gathered from fonts.dir alone.
      68             :  *  if only FastPrintFontInfo is gathered and PrintFontInfo
      69             :  *  on demand and for less fonts, then performance in startup
      70             :  *  increases considerably
      71             :  */
      72             : 
      73        3875 : struct FastPrintFontInfo
      74             : {
      75             :     fontID                              m_nID; // FontID
      76             :     fonttype::type                      m_eType;
      77             : 
      78             :     // font attributes
      79             :     rtl::OUString                       m_aFamilyName;
      80             :     rtl::OUString                       m_aStyleName;
      81             :     std::list< rtl::OUString >          m_aAliases;
      82             :     FontFamily                          m_eFamilyStyle;
      83             :     FontItalic                          m_eItalic;
      84             :     FontWidth                           m_eWidth;
      85             :     FontWeight                          m_eWeight;
      86             :     FontPitch                           m_ePitch;
      87             :     rtl_TextEncoding                    m_aEncoding;
      88             :     bool                                m_bSubsettable;
      89             :     bool                                m_bEmbeddable;
      90             : 
      91        3875 :     FastPrintFontInfo() :
      92             :             m_nID( 0 ),
      93             :             m_eType( fonttype::Unknown ),
      94             :             m_eFamilyStyle( FAMILY_DONTKNOW ),
      95             :             m_eItalic( ITALIC_DONTKNOW ),
      96             :             m_eWidth( WIDTH_DONTKNOW ),
      97             :             m_eWeight( WEIGHT_DONTKNOW ),
      98             :             m_ePitch( PITCH_DONTKNOW ),
      99        3875 :             m_aEncoding( RTL_TEXTENCODING_DONTKNOW )
     100        3875 :     {}
     101             : };
     102             : 
     103           0 : struct PrintFontInfo : public FastPrintFontInfo
     104             : {
     105             :     int                                     m_nAscend;
     106             :     int                                     m_nDescend;
     107             :     int                                     m_nLeading;
     108             :     int                                     m_nWidth;
     109             : 
     110           0 :     PrintFontInfo() :
     111             :             FastPrintFontInfo(),
     112             :             m_nAscend( 0 ),
     113             :             m_nDescend( 0 ),
     114             :             m_nLeading( 0 ),
     115           0 :             m_nWidth( 0 )
     116           0 :     {}
     117             : };
     118             : 
     119             : // the values are per thousand of the font size
     120             : // note: width, height contain advances, not bounding box
     121             : struct CharacterMetric
     122             : {
     123             :     short int width, height;
     124             : 
     125        9840 :     CharacterMetric() : width( 0 ), height( 0 ) {}
     126             :     bool operator==( const CharacterMetric& rOther ) const
     127             :     { return rOther.width == width && rOther.height == height; }
     128             :     bool operator!=( const CharacterMetric& rOther ) const
     129             :     { return rOther.width != width || rOther.height != height; }
     130             : };
     131             : 
     132             : struct KernPair
     133             : {
     134             :     sal_Unicode first, second;
     135             :     short int kern_x, kern_y;
     136             : 
     137             :     KernPair() : first( 0 ), second( 0 ), kern_x( 0 ), kern_y( 0 ) {}
     138             : };
     139             : 
     140             : class FontCache;
     141             : 
     142             : // a class to manage printable fonts
     143             : // aims are type1 and truetype fonts
     144             : 
     145             : class FontCache;
     146             : 
     147             : class VCL_PLUGIN_PUBLIC PrintFontManager
     148             : {
     149             :     struct PrintFont;
     150             :     struct TrueTypeFontFile;
     151             :     struct Type1FontFile;
     152             :     struct BuiltinFont;
     153             :     friend struct PrintFont;
     154             :     friend struct TrueTypeFontFile;
     155             :     friend struct Type1FontFile;
     156             :     friend struct BuiltinFont;
     157             :     friend class FontCache;
     158             : 
     159             :     struct PrintFontMetrics
     160             :     {
     161             :         // character metrics are stored by the following keys:
     162             :         // lower two bytes contain a sal_Unicode (a UCS2 character)
     163             :         // upper byte contains: 0 for horizontal metric
     164             :         //                      1 for vertical metric
     165             :         // highest byte: 0 for now
     166             :         boost::unordered_map< int, CharacterMetric >     m_aMetrics;
     167             :         // contains the unicode blocks for which metrics were queried
     168             :         // this implies that metrics should be queried in terms of
     169             :         // unicode blocks. here a unicode block is identified
     170             :         // by the upper byte of the UCS2 encoding.
     171             :         // note that the corresponding bit should be set even
     172             :         // if the font does not support a single character of that page
     173             :         // this map shows, which pages were queried already
     174             :         // if (like in AFM metrics) all metrics are queried in
     175             :         // a single pass, then all bits should be set
     176             :         char                                        m_aPages[32];
     177             : 
     178             :         bool                                        m_bKernPairsQueried;
     179             :         std::list< KernPair >                     m_aXKernPairs;
     180             :         std::list< KernPair >                     m_aYKernPairs;
     181             :         boost::unordered_map< sal_Unicode, bool >       m_bVerticalSubstitutions;
     182             : 
     183             :         PrintFontMetrics() : m_bKernPairsQueried( false ) {}
     184             : 
     185             :         bool isEmpty() const { return m_aMetrics.empty(); }
     186             :     };
     187             : 
     188             :     struct PrintFont
     189             :     {
     190             :         fonttype::type                              m_eType;
     191             : 
     192             :         // font attributes
     193             :         int                                         m_nFamilyName;  // atom
     194             :         std::list< int >                            m_aAliases;
     195             :         int                                         m_nPSName;      // atom
     196             :         rtl::OUString                               m_aStyleName;
     197             :         FontItalic                                  m_eItalic;
     198             :         FontWidth                                   m_eWidth;
     199             :         FontWeight                                  m_eWeight;
     200             :         FontPitch                                   m_ePitch;
     201             :         rtl_TextEncoding                            m_aEncoding;
     202             :         bool                                        m_bFontEncodingOnly; // set if font should be only accessed by builtin encoding
     203             :         CharacterMetric                             m_aGlobalMetricX;
     204             :         CharacterMetric                             m_aGlobalMetricY;
     205             :         PrintFontMetrics*                           m_pMetrics;
     206             :         int                                         m_nAscend;
     207             :         int                                         m_nDescend;
     208             :         int                                         m_nLeading;
     209             :         int                                         m_nXMin; // font bounding box
     210             :         int                                         m_nYMin;
     211             :         int                                         m_nXMax;
     212             :         int                                         m_nYMax;
     213             :         bool                                        m_bHaveVerticalSubstitutedGlyphs;
     214             :         bool                                        m_bUserOverride;
     215             : 
     216             :         std::map< sal_Unicode, sal_Int32 >          m_aEncodingVector;
     217             :         std::map< sal_Unicode, rtl::OString >       m_aNonEncoded;
     218             : 
     219             :         PrintFont( fonttype::type eType );
     220             :         virtual ~PrintFont();
     221             :         virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider ) = 0;
     222             : 
     223             :         bool readAfmMetrics( const rtl::OString& rFileName, utl::MultiAtomProvider* pProvider, bool bFillEncodingvector, bool bOnlyGlobalAttributes );
     224             :     };
     225             : 
     226             :     struct Type1FontFile : public PrintFont
     227             :     {
     228             :         int                 m_nDirectory;       // atom containing system dependent path
     229             :         rtl::OString      m_aFontFile;        // relative to directory
     230             :         rtl::OString      m_aMetricFile;      // dito
     231             : 
     232             :         /* note: m_aFontFile and Metric file are not atoms
     233             :            because they should be fairly unique */
     234             : 
     235             :         Type1FontFile() : PrintFont( fonttype::Type1 ), m_nDirectory( 0 ) {}
     236             :         virtual ~Type1FontFile();
     237             :         virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider );
     238             :     };
     239             : 
     240             :     struct TrueTypeFontFile : public PrintFont
     241             :     {
     242             :         int           m_nDirectory;       // atom containing system dependent path
     243             :         rtl::OString  m_aFontFile;        // relative to directory
     244             :         int           m_nCollectionEntry; // 0 for regular fonts, 0 to ... for fonts stemming from collections
     245             :         unsigned int  m_nTypeFlags;       // copyright bits and PS-OpenType flag
     246             : 
     247             :         TrueTypeFontFile();
     248             :         virtual ~TrueTypeFontFile();
     249             :         virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider );
     250             :     };
     251             : 
     252             :     struct BuiltinFont : public PrintFont
     253             :     {
     254             :         int                 m_nDirectory;       // atom containing system dependent path
     255             :         rtl::OString      m_aMetricFile;
     256             : 
     257             :         BuiltinFont() : PrintFont( fonttype::Builtin ) {}
     258             :         virtual ~BuiltinFont();
     259             :         virtual bool queryMetricPage( int nPage, utl::MultiAtomProvider* pProvider );
     260             :     };
     261             : 
     262             :     fontID                                      m_nNextFontID;
     263             :     boost::unordered_map< fontID, PrintFont* >       m_aFonts;
     264             :     boost::unordered_map< int, FontFamily >        m_aFamilyTypes;
     265             :     std::list< rtl::OUString >              m_aPrinterDrivers;
     266             :     std::list< rtl::OString >               m_aFontDirectories;
     267             :     std::list< int >                            m_aPrivateFontDirectories;
     268             :     utl::MultiAtomProvider*                   m_pAtoms;
     269             :     // for speeding up findFontFileID
     270             :     boost::unordered_map< rtl::OString, std::set< fontID >, rtl::OStringHash >
     271             :                                                 m_aFontFileToFontID;
     272             : 
     273             :     boost::unordered_map< rtl::OString, int, rtl::OStringHash >
     274             :     m_aDirToAtom;
     275             :     boost::unordered_map< int, rtl::OString >     m_aAtomToDir;
     276             :     int                                        m_nNextDirAtom;
     277             : 
     278             :     boost::unordered_multimap< rtl::OString, sal_Unicode, rtl::OStringHash >
     279             :         m_aAdobenameToUnicode;
     280             :     boost::unordered_multimap< sal_Unicode, rtl::OString >
     281             :         m_aUnicodeToAdobename;
     282             :     boost::unordered_multimap< sal_Unicode, sal_uInt8 > m_aUnicodeToAdobecode;
     283             :     boost::unordered_multimap< sal_uInt8, sal_Unicode > m_aAdobecodeToUnicode;
     284             : 
     285             :     mutable FontCache*                                                        m_pFontCache;
     286             : 
     287             :     mutable std::vector< fontID >               m_aOverrideFonts;
     288             : 
     289             :     rtl::OString getAfmFile( PrintFont* pFont ) const;
     290             :     rtl::OString getFontFile( PrintFont* pFont ) const;
     291             : 
     292             :     bool analyzeFontFile( int nDirID, const rtl::OString& rFileName, std::list< PrintFont* >& rNewFonts, const char *pFormat=NULL ) const;
     293             :     rtl::OUString convertTrueTypeName( void* pNameRecord ) const; // actually a NameRecord* formt font subsetting code
     294             :     void analyzeTrueTypeFamilyName( void* pTTFont, std::list< rtl::OUString >& rnames ) const; // actually a TrueTypeFont* from font subsetting code
     295             :     bool analyzeTrueTypeFile( PrintFont* pFont ) const;
     296             :     // finds the font id for the nFaceIndex face in this font file
     297             :     // There may be multiple font ids for TrueType collections
     298             :     fontID findFontFileID( int nDirID, const rtl::OString& rFile, int nFaceIndex ) const;
     299             : 
     300             :     // There may be multiple font ids for TrueType collections
     301             :     std::vector<fontID> findFontFileIDs( int nDirID, const rtl::OString& rFile ) const;
     302             : 
     303             :     bool knownFontFile( int nDirID, const rtl::OString& rFile ) const
     304             :     {
     305             :         return findFontFileID(nDirID, rFile, 0) != 0;
     306             :     }
     307             : 
     308             :     fontID findFontBuiltinID( int nPSNameAtom ) const;
     309             : 
     310             :     FontFamily matchFamilyName( const rtl::OUString& rFamily ) const;
     311             : 
     312       11718 :     PrintFont* getFont( fontID nID ) const
     313             :     {
     314       11718 :         boost::unordered_map< fontID, PrintFont* >::const_iterator it;
     315       11718 :         it = m_aFonts.find( nID );
     316       11718 :         return it == m_aFonts.end() ? NULL : it->second;
     317             :     }
     318             :     void fillPrintFontInfo( PrintFont* pFont, FastPrintFontInfo& rInfo ) const;
     319             :     void fillPrintFontInfo( PrintFont* pFont, PrintFontInfo& rInfo ) const;
     320             : 
     321             :     rtl::OString getDirectory( int nAtom ) const;
     322             :     int getDirectoryAtom( const rtl::OString& rDirectory, bool bCreate = false );
     323             : 
     324             :     /* try to initialize fonts from libfontconfig
     325             : 
     326             :     called from <code>initialize()</code>
     327             :     */
     328             :     void initFontconfig();
     329             :     void countFontconfigFonts( boost::unordered_map<rtl::OString, int, rtl::OStringHash>& o_rVisitedPaths );
     330             :     /* deinitialize fontconfig
     331             :      */
     332             :     void deinitFontconfig();
     333             : 
     334             :     /* register an application specific font directory for libfontconfig
     335             : 
     336             :     since fontconfig is asked for font substitutes before OOo will check for font availability
     337             :     and fontconfig will happily substitute fonts it doesn't know (e.g. "Arial Narrow" -> "DejaVu Sans Book"!)
     338             :     it becomes necessary to tell the library about all the hidden font treasures
     339             : 
     340             :     @returns
     341             :     true if libfontconfig accepted the directory
     342             :     false else (e.g. no libfontconfig found)
     343             :     */
     344             :     bool addFontconfigDir(const rtl::OString& rDirectory);
     345             : 
     346             :     bool readOverrideMetrics();
     347             : 
     348             :     std::set<OString> m_aPreviousLangSupportRequests;
     349             :     std::vector<OString> m_aCurrentRequests;
     350             :     Timer m_aFontInstallerTimer;
     351             : 
     352             :     DECL_LINK( autoInstallFontLangSupport, void* );
     353             : 
     354             :     PrintFontManager();
     355             :     ~PrintFontManager();
     356             : public:
     357             :     static PrintFontManager& get(); // one instance only
     358             : 
     359             :     // There may be multiple font ids for TrueType collections
     360             :     std::vector<fontID> addFontFile( const rtl::OString& rFileName );
     361             : 
     362             :     void initialize();
     363             : 
     364             :     // returns the number of managed fonts
     365             :     int getFontCount() const { return m_aFonts.size(); }
     366             : 
     367             :     // caution: the getFontList* methods can change the font list on demand
     368             :     // depending on the pParser argument. That is getFontCount() may
     369             :     // return a larger value after getFontList()
     370             : 
     371             :     // returns the ids of all managed fonts. on pParser != NULL
     372             :     // all fonttype::Builtin type fonts are not listed
     373             :     // which do not occur in the PPD of pParser
     374             :     void getFontList( std::list< fontID >& rFontIDs, const PPDParser* pParser = NULL, bool bUseOverrideMetrics = false );
     375             :     // get the font list and fast font info. see getFontList for pParser
     376             :     void getFontListWithFastInfo( std::list< FastPrintFontInfo >& rFonts, const PPDParser* pParser = NULL, bool bUseOverrideMetrics = false );
     377             : 
     378             :     // get font info for a specific font
     379             :     bool getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const;
     380             :     // get fast font info for a specific font
     381             :     bool getFontFastInfo( fontID nFontID, FastPrintFontInfo& rInfo ) const;
     382             : 
     383             :     // routines to get font info in small pieces
     384             : 
     385             :     // get a specific fonts PSName name
     386             :     const rtl::OUString& getPSName( fontID nFontID ) const;
     387             : 
     388             :     // get a specific fonts family name aliases
     389             :     void getFontFamilyAliases( fontID nFontID ) const;
     390             : 
     391             :     // get a specific fonts type
     392           0 :     fonttype::type getFontType( fontID nFontID ) const
     393             :     {
     394           0 :         PrintFont* pFont = getFont( nFontID );
     395           0 :         return pFont ? pFont->m_eType : fonttype::Unknown;
     396             :     }
     397             : 
     398             :     // get a specific fonts italic type
     399           0 :     FontItalic getFontItalic( fontID nFontID ) const
     400             :     {
     401           0 :         PrintFont* pFont = getFont( nFontID );
     402           0 :         return pFont ? pFont->m_eItalic : ITALIC_DONTKNOW;
     403             :     }
     404             : 
     405             :     // get a specific fonts width type
     406             :     FontWidth getFontWidth( fontID nFontID ) const
     407             :     {
     408             :         PrintFont* pFont = getFont( nFontID );
     409             :         return pFont ? pFont->m_eWidth : WIDTH_DONTKNOW;
     410             :     }
     411             : 
     412             :     // get a specific fonts weight type
     413           0 :     FontWeight getFontWeight( fontID nFontID ) const
     414             :     {
     415           0 :         PrintFont* pFont = getFont( nFontID );
     416           0 :         return pFont ? pFont->m_eWeight : WEIGHT_DONTKNOW;
     417             :     }
     418             : 
     419             :     // get a specific fonts pitch type
     420             :     FontPitch getFontPitch( fontID nFontID ) const
     421             :     {
     422             :         PrintFont* pFont = getFont( nFontID );
     423             :         return pFont ? pFont->m_ePitch : PITCH_DONTKNOW;
     424             :     }
     425             : 
     426             :     // get a specific fonts encoding
     427           0 :     rtl_TextEncoding getFontEncoding( fontID nFontID ) const
     428             :     {
     429           0 :         PrintFont* pFont = getFont( nFontID );
     430           0 :         return pFont ? pFont->m_aEncoding : RTL_TEXTENCODING_DONTKNOW;
     431             :     }
     432             : 
     433             :     // should i only use font's builtin encoding ?
     434           0 :     bool getUseOnlyFontEncoding( fontID nFontID ) const
     435             :     {
     436           0 :         PrintFont* pFont = getFont( nFontID );
     437           0 :         return pFont ? pFont->m_bFontEncodingOnly : false;
     438             :     }
     439             : 
     440             :     // get a specific fonts system dependent filename
     441        2622 :     rtl::OString getFontFileSysPath( fontID nFontID ) const
     442             :     {
     443        2622 :         return getFontFile( getFont( nFontID ) );
     444             :     }
     445             : 
     446             :     // get the ttc face number
     447             :     int getFontFaceNumber( fontID nFontID ) const;
     448             : 
     449             :     // get a specific fonts ascend
     450             :     int getFontAscend( fontID nFontID ) const;
     451             : 
     452             :     // get a specific fonts descent
     453             :     int getFontDescend( fontID nFontID ) const;
     454             : 
     455             :     // get a fonts glyph bounding box
     456             :     bool getFontBoundingBox( fontID nFont, int& xMin, int& yMin, int& xMax, int& yMax );
     457             : 
     458             :     // info whether an array of glyphs has vertical substitutions
     459             :     void hasVerticalSubstitutions( fontID nFontID, const sal_Unicode* pCharacters,
     460             :         int nCharacters, bool* pHasSubst ) const;
     461             : 
     462             :     // get a specific fonts metrics
     463             : 
     464             :     // get metrics for a sal_Unicode range
     465             :     // the user is responsible to allocate pArray large enough
     466             :     bool getMetrics( fontID nFontID, sal_Unicode minCharacter, sal_Unicode maxCharacter, CharacterMetric* pArray, bool bVertical = false ) const;
     467             :     // get metrics for an array of sal_Unicode characters
     468             :     // the user is responsible to allocate pArray large enough
     469             :     bool getMetrics( fontID nFontID, const sal_Unicode* pString, int nLen, CharacterMetric* pArray, bool bVertical = false ) const;
     470             : 
     471             :     // get encoding vector of font, currently only for Type1 and Builtin fonts
     472             :     // returns NULL if encoding vector is empty or font is neither type1 or
     473             :     // builtin; if ppNonEncoded is set and non encoded type1 glyphs exist
     474             :     // then *ppNonEncoded is set to the mapping for nonencoded glyphs.
     475             :     // the encoding vector contains -1 for non encoded glyphs
     476             :     const std::map< sal_Unicode, sal_Int32 >* getEncodingMap( fontID nFontID, const std::map< sal_Unicode, rtl::OString >** ppNonEncoded ) const;
     477             : 
     478             :     // to get font substitution transparently use the
     479             :     // getKernPairs method of PrinterGfx
     480             :     const std::list< KernPair >& getKernPairs( fontID nFontID, bool bVertical = false ) const;
     481             : 
     482             :     // evaluates copyright flags for TrueType fonts
     483             :     // type1 fonts do not have such a feature, so return for them is true
     484             :     // returns true for builtin fonts (surprise!)
     485             :     bool isFontDownloadingAllowed( fontID nFont ) const;
     486             : 
     487             :     // helper for type 1 fonts
     488             :     std::list< rtl::OString > getAdobeNameFromUnicode( sal_Unicode aChar ) const;
     489             : 
     490             :     std::pair< boost::unordered_multimap< sal_Unicode, sal_uInt8 >::const_iterator,
     491             :                boost::unordered_multimap< sal_Unicode, sal_uInt8 >::const_iterator >
     492             :     getAdobeCodeFromUnicode( sal_Unicode aChar ) const
     493             :     {
     494             :         return m_aUnicodeToAdobecode.equal_range( aChar );
     495             :     }
     496             :     std::list< sal_Unicode >  getUnicodeFromAdobeName( const rtl::OString& rName ) const;
     497             :     std::pair< boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator,
     498             :                  boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator >
     499             :     getUnicodeFromAdobeCode( sal_uInt8 aChar ) const
     500             :     {
     501             :         return m_aAdobecodeToUnicode.equal_range( aChar );
     502             :     }
     503             : 
     504             :     // creates a new font subset of an existing TrueType font
     505             :     // returns true in case of success, else false
     506             :     // nFont: the font to be subsetted
     507             :     // rOutFile: the file to put the new subset into;
     508             :     //           must be a valid osl file URL
     509             :     // pGlyphIDs: input array of glyph ids for new font
     510             :     // pNewEncoding: the corresponding encoding in the new font
     511             :     // pWidths: output array of widths of requested glyphs
     512             :     // nGlyphs: number of glyphs in arrays
     513             :     // pCapHeight:: capital height of the produced font
     514             :     // pXMin, pYMin, pXMax, pYMax: outgoing font bounding box
     515             :     // TODO: callers of this method should use its FontSubsetInfo counterpart directly
     516             :     bool createFontSubset( FontSubsetInfo&,
     517             :                            fontID nFont,
     518             :                            const rtl::OUString& rOutFile,
     519             :                            sal_Int32* pGlyphIDs,
     520             :                            sal_uInt8* pNewEncoding,
     521             :                            sal_Int32* pWidths,
     522             :                            int nGlyphs,
     523             :                            bool bVertical = false
     524             :                            );
     525             :     void getGlyphWidths( fontID nFont,
     526             :                          bool bVertical,
     527             :                          std::vector< sal_Int32 >& rWidths,
     528             :                          std::map< sal_Unicode, sal_uInt32 >& rUnicodeEnc );
     529             : 
     530             : 
     531             :     // font administration functions
     532             : 
     533             :     // for importFonts to provide the user feedback
     534             :     class ImportFontCallback
     535             :     {
     536             :     public:
     537             :         enum FailCondition { NoWritableDirectory, NoAfmMetric, AfmCopyFailed, FontCopyFailed };
     538             :         virtual void importFontsFailed( FailCondition eReason ) = 0;
     539             :         virtual void progress( const rtl::OUString& rFile ) = 0;
     540             :         virtual bool queryOverwriteFile( const rtl::OUString& rFile ) = 0;
     541             :         virtual void importFontFailed( const rtl::OUString& rFile, FailCondition ) = 0;
     542             :         virtual bool isCanceled() = 0;
     543             : 
     544             :     protected:
     545             :         ~ImportFontCallback() {}
     546             :     };
     547             : 
     548             :     /*  system dependendent font matching
     549             : 
     550             :     <p>
     551             :     <code>matchFont</code> matches a pattern of font characteristics
     552             :     and returns the closest match if possibe. If a match was found
     553             :     the <code>FastPrintFontInfo</code> passed in as parameter
     554             :     will be update to the found matching font.
     555             :     </p>
     556             :     <p>
     557             :     implementation note: currently the function is only implemented
     558             :     for fontconfig.
     559             :     </p>
     560             : 
     561             :     @param rInfo
     562             :     out of the FastPrintFontInfo structure the following
     563             :     fields will be used for the match:
     564             :     <ul>
     565             :     <li>family name</li>
     566             :     <li>italic</li>
     567             :     <li>width</li>
     568             :     <li>weight</li>
     569             :     <li>pitch</li>
     570             :     </ul>
     571             : 
     572             :     @param rLocale
     573             :     if <code>rLocal</code> contains non empty strings the corresponding
     574             :     locale will be used for font matching also; e.g. "Sans" can result
     575             :     in different fonts in e.g. english and japanese
     576             : 
     577             :     @returns
     578             :     true if a match was found
     579             :     false else
     580             :      */
     581             :     bool matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale );
     582             :     ImplFontOptions* getFontOptions( const FastPrintFontInfo&, int nSize, void (*subcallback)(void*)) const;
     583             : 
     584             :     bool Substitute( FontSelectPattern &rPattern, rtl::OUString& rMissingCodes );
     585             : 
     586             :     int FreeTypeCharIndex( void *pFace, sal_uInt32 aChar );
     587             : };
     588             : 
     589             : } // namespace
     590             : 
     591             : #endif // _PSPRINT_FONTMANAGER_HXX_
     592             : 
     593             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10