diff options
author | Philipp Lohmann <pl@openoffice.org> | 2002-02-28 10:53:08 +0000 |
---|---|---|
committer | Philipp Lohmann <pl@openoffice.org> | 2002-02-28 10:53:08 +0000 |
commit | 14f4a49266f5206260b5e9f0780913c56dd8d5a0 (patch) | |
tree | d7826f40446aaca5e75fe89657bc2bd2ec857ca7 /psprint/inc | |
parent | fd03488af96dd9234adbefad62e60bdb69511894 (diff) |
#97829# #i1991# add font aliases
Diffstat (limited to 'psprint/inc')
-rw-r--r-- | psprint/inc/psprint/fontcache.hxx | 99 | ||||
-rw-r--r-- | psprint/inc/psprint/fontmanager.hxx | 46 |
2 files changed, 129 insertions, 16 deletions
diff --git a/psprint/inc/psprint/fontcache.hxx b/psprint/inc/psprint/fontcache.hxx new file mode 100644 index 000000000000..9edc21527bc5 --- /dev/null +++ b/psprint/inc/psprint/fontcache.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * $RCSfile: fontcache.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: pl $ $Date: 2002-02-28 11:49:51 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _PSPRINT_FONTCACHE_HXX +#define _PSPRINT_FONTCACHE_HXX + +#ifndef _PSPRINT_FONTMANAGER_HXX_ +#include <psprint/fontmanager.hxx> +#endif + +#include <hash_map> + +namespace psp +{ + +class FontCache +{ + typedef ::std::list< PrintFontManager::PrintFont* > FontCacheEntry; + typedef ::std::hash_map< ::rtl::OString, FontCacheEntry, ::rtl::OStringHash > FontDirMap; + typedef ::std::hash_map< int, FontDirMap > FontCacheData; + FontCacheData m_aCache; + bool m_bDoFlush; + + void read( const ::rtl::OString& rPath ); + void clearCache(); + + void copyPrintFont( const PrintFontManager::PrintFont* pFrom, PrintFontManager::PrintFont* pTo ) const; + PrintFontManager::PrintFont* clonePrintFont( const PrintFontManager::PrintFont* pFont ) const; +public: + FontCache(); + ~FontCache(); + + bool getFontCacheFile( int nDirID, const ::rtl::OString& rDir, const ::rtl::OString& rFile, ::std::list< PrintFontManager::PrintFont* >& rNewFonts ); + void updateFontCacheEntry( const PrintFontManager::PrintFont*, bool bFlush ); + + void flush(); +}; + +} // namespace psp + +#endif // _PSPRINT_FONTCACHE_HXX diff --git a/psprint/inc/psprint/fontmanager.hxx b/psprint/inc/psprint/fontmanager.hxx index 1c36bb04bfe6..4987ae1ea98d 100644 --- a/psprint/inc/psprint/fontmanager.hxx +++ b/psprint/inc/psprint/fontmanager.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fontmanager.hxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: hdu $ $Date: 2001-12-21 16:31:36 $ + * last change: $Author: pl $ $Date: 2002-02-28 11:49:51 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,9 @@ #ifndef __SGI_STL_LIST #include <list> #endif +#ifndef __SGI_STL_SET +#include <set> +#endif #ifndef _PSPRINT_HELPER_HXX_ #include <psprint/helper.hxx> #endif @@ -173,25 +176,26 @@ enum type { struct FastPrintFontInfo { - fontID m_nID; // FontID - fonttype::type m_eType; + fontID m_nID; // FontID + fonttype::type m_eType; // font attributes - ::rtl::OUString m_aFamilyName; - family::type m_eFamilyStyle; - italic::type m_eItalic; - width::type m_eWidth; - weight::type m_eWeight; - pitch::type m_ePitch; - rtl_TextEncoding m_aEncoding; + ::rtl::OUString m_aFamilyName; + ::std::list< ::rtl::OUString > m_aAliases; + family::type m_eFamilyStyle; + italic::type m_eItalic; + width::type m_eWidth; + weight::type m_eWeight; + pitch::type m_ePitch; + rtl_TextEncoding m_aEncoding; }; struct PrintFontInfo : public FastPrintFontInfo { - int m_nAscend; - int m_nDescend; - int m_nLeading; - int m_nWidth; + int m_nAscend; + int m_nDescend; + int m_nLeading; + int m_nWidth; }; // the values are per thousand of the font size @@ -224,6 +228,7 @@ class PrintFontManager friend class TrueTypeFontFile; friend class Type1FontFile; friend class BuiltinFont; + friend class FontCache; struct PrintFontMetrics { @@ -258,6 +263,7 @@ class PrintFontManager // font attributes int m_nFamilyName; // atom + ::std::list< int > m_aAliases; int m_nPSName; // atom italic::type m_eItalic; width::type m_eWidth; @@ -326,6 +332,9 @@ class PrintFontManager ::std::list< ::rtl::OString > m_aFontDirectories; ::std::list< int > m_aPrivateFontDirectories; ::utl::MultiAtomProvider* m_pAtoms; + // for speeding up findFontFileID + ::std::hash_map< ::rtl::OString, ::std::set< fontID >, ::rtl::OStringHash > + m_aFontFileToFontID; ::std::hash_map< ::rtl::OString, int, ::rtl::OStringHash > m_aDirToAtom; @@ -339,6 +348,8 @@ class PrintFontManager ::std::hash_multimap< sal_Unicode, sal_uInt8 > m_aUnicodeToAdobecode; ::std::hash_multimap< sal_uInt8, sal_Unicode > m_aAdobecodeToUnicode; + mutable FontCache* m_pFontCache; + mutable bool m_bFlushFontCache; ::rtl::OString getAfmFile( PrintFont* pFont ) const; ::rtl::OString getFontFile( PrintFont* pFont ) const; @@ -347,7 +358,7 @@ class PrintFontManager bool analyzeFontFile( int nDirID, const ::rtl::OString& rFileName, bool bReadFile, const ::std::list< ::rtl::OString >& rXLFDs, ::std::list< PrintFont* >& rNewFonts ) const; ::rtl::OUString convertTrueTypeName( void* pNameRecord ) const; // actually a NameRecord* formt font subsetting code - ::rtl::OUString analyzeTrueTypeFamilyName( void* pTTFont ) const; // actually a TrueTypeFont* from font subsetting code + void analyzeTrueTypeFamilyName( void* pTTFont, ::std::list< ::rtl::OUString >& rnames ) const; // actually a TrueTypeFont* from font subsetting code bool analyzeTrueTypeFile( PrintFont* pFont ) const; // finds the FIRST id for this font file; there may be more // for TrueType collections @@ -409,6 +420,9 @@ public: // get a specific fonts style family family::type PrintFontManager::getFontFamilyType( fontID nFontID ) const; + // get a specific fonts family name aliases + void PrintFontManager::getFontFamilyAliases( fontID nFontID ) const; + // get a specific fonts type fonttype::type getFontType( fontID nFontID ) const { |