From 483eee9d365e6e5da0475db69d3b50269ac7e35d Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Wed, 12 Dec 2007 12:19:39 +0000 Subject: [PATCH] INTEGRATION: CWS gfbfcfg (1.2.154); FILE MERGED 2007/11/20 11:43:06 hdu 1.2.154.6: #i83491# fix crash on optimized unxsols4.pro builds, use string reference to avoid needless refcounting 2007/11/12 10:32:11 hdu 1.2.154.5: #i83491# improve performance of glyph fallback hook by caching results 2007/09/17 14:03:36 hdu 1.2.154.4: #i54603# adjust to recent psprint API changes 2007/09/12 15:23:57 hdu 1.2.154.3: #i54603# add hooks for non-generic font substitutions 2007/09/07 15:06:49 hdu 1.2.154.2: Start to abstract font fallbacks to cleanup the previous patch The patch HAD to be applied though it was not close to ready, sorry When finished font fallback abstraction will solve these regressions - does not even compile on non-UNX platforms - introduces UNX-specific dependencies into platform-independent layers - kills the glyph- and font-fallback features on the non-UNX platforms - kills the features on UNX platforms that don't have up to date fontconfig lib or matching configuration entries - causes regressions for non-baseplane unicodes - kills the japanese EUDC feature 2007/09/05 09:58:33 hdu 1.2.154.1: #i54603# apply Caolan's fontconfig based glyph fallback patch --- vcl/inc/vcl/outfont.hxx | 45 +++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx index f84ada10fb19..ec245de22ffb 100644 --- a/vcl/inc/vcl/outfont.hxx +++ b/vcl/inc/vcl/outfont.hxx @@ -4,9 +4,9 @@ * * $RCSfile: outfont.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: vg $ $Date: 2007-04-11 18:02:27 $ + * last change: $Author: kz $ $Date: 2007-12-12 13:19:39 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -65,7 +65,9 @@ class ImplDevFontListData; class ImplGetDevFontList; class ImplGetDevSizeList; class ImplFontEntry; -struct ImplFontSubstEntry; +class ImplDirectFontSubstitution; +class ImplPreMatchFontSubstitution; +class ImplGlyphFallbackFontSubstitution; class ImplFontSelectData; class Font; class ImplCvtChar; @@ -220,22 +222,32 @@ private: typedef std::hash_map DevFontList; DevFontList maDevFontList; + ImplPreMatchFontSubstitution* mpPreMatchHook; // device specific prematch substitution + ImplGlyphFallbackFontSubstitution* mpFallbackHook; // device specific glyh fallback substitution + public: ImplDevFontList(); ~ImplDevFontList(); + // fill the list with device fonts void Add( ImplFontData* ); void Clear(); int Count() const { return maDevFontList.size(); } + // find the device font ImplDevFontListData* FindFontFamily( const String& rFontName ) const; - ImplDevFontListData* ImplFindByFont( ImplFontSelectData&, bool bPrinter, ImplFontSubstEntry* pDevSpecificSubst ) const; + ImplDevFontListData* ImplFindByFont( ImplFontSelectData&, bool bPrinter, ImplDirectFontSubstitution* ) const; ImplDevFontListData* ImplFindBySearchName( const String& ) const; - bool HasFallbacks() const; - void SetFallbacks( ImplDevFontListData**, int nCount ); - ImplDevFontListData* GetFallback( int nIndex ) const; + // suggest fonts for glyph fallback + ImplDevFontListData* GetGlyphFallbackFont( ImplFontSelectData&, + rtl::OUString& rMissingCodes, int nFallbackLevel ) const; + // prepare platform specific font substitutions + void SetPreMatchHook( ImplPreMatchFontSubstitution* ); + void SetFallbackHook( ImplGlyphFallbackFontSubstitution* ); + + // misc utilities ImplDevFontList* Clone( bool bScalable, bool bEmbeddable ) const; ImplGetDevFontList* GetDevFontList() const; ImplGetDevSizeList* GetDevSizeList( const String& rFontName ) const; @@ -252,11 +264,11 @@ protected: ImplDevFontListData* FindDefaultFont() const; private: - ImplDevFontListData** mpFallbackList; - int mnFallbackCount; + void InitGenericGlyphFallback() const; + mutable ImplDevFontListData** mpFallbackList; + mutable int mnFallbackCount; }; - // -------------------- // - ImplKernPairData - // -------------------- @@ -332,7 +344,7 @@ class VCL_DLLPUBLIC ImplFontEntry { public: ImplFontEntry( const ImplFontSelectData& ); - virtual ~ImplFontEntry() {} + virtual ~ImplFontEntry(); public: // TODO: make data members private ImplFontSelectData maFontSelData; // FontSelectionData @@ -344,6 +356,17 @@ public: // TODO: make data members private short mnOwnOrientation; // text angle if lower layers don't rotate text themselves short mnOrientation; // text angle in 3600 system bool mbInit; // true if maMetric member is valid + + void AddFallbackForUnicode( sal_UCS4, const String& rFontName ); + bool GetFallbackForUnicode( sal_UCS4, String* pFontName ) const; + void IgnoreFallbackForUnicode( sal_UCS4, const String& rFontName ); + +private: + // cache of Unicode characters and replacement font names + // TODO: a fallback map can be shared with many other ImplFontEntries + // TODO: at least the ones which just differ in orientation, stretching or height + typedef ::std::hash_map UnicodeFallbackList; + UnicodeFallbackList* mpUnicodeFallbackList; };