xref: /aoo41x/main/vcl/inc/glyphcache.hxx (revision 248a599f)
1161f4cd1SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3161f4cd1SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4161f4cd1SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5161f4cd1SAndrew Rist  * distributed with this work for additional information
6161f4cd1SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7161f4cd1SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8161f4cd1SAndrew Rist  * "License"); you may not use this file except in compliance
9161f4cd1SAndrew Rist  * with the License.  You may obtain a copy of the License at
10161f4cd1SAndrew Rist  *
11161f4cd1SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12161f4cd1SAndrew Rist  *
13161f4cd1SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14161f4cd1SAndrew Rist  * software distributed under the License is distributed on an
15161f4cd1SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16161f4cd1SAndrew Rist  * KIND, either express or implied.  See the License for the
17161f4cd1SAndrew Rist  * specific language governing permissions and limitations
18161f4cd1SAndrew Rist  * under the License.
19161f4cd1SAndrew Rist  *
20161f4cd1SAndrew Rist  *************************************************************/
21161f4cd1SAndrew Rist 
22161f4cd1SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_GLYPHCACHE_HXX
25cdf0e10cSrcweir #define _SV_GLYPHCACHE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/dllapi.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir class GlyphCache;
30cdf0e10cSrcweir class GlyphMetric;
31cdf0e10cSrcweir class GlyphData;
32cdf0e10cSrcweir class ServerFont;
33cdf0e10cSrcweir class GlyphCachePeer;
34cdf0e10cSrcweir class ServerFontLayoutEngine;
35cdf0e10cSrcweir class ServerFontLayout;
36cdf0e10cSrcweir class ExtraKernInfo;
37cdf0e10cSrcweir struct ImplKernPairData;
38cdf0e10cSrcweir class ImplFontOptions;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <tools/gen.hxx>
41cdf0e10cSrcweir #include <hash_map>
42cdf0e10cSrcweir #include <hash_set>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir namespace basegfx { class B2DPolyPolygon; }
45cdf0e10cSrcweir 
46cdf0e10cSrcweir class RawBitmap;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #include <outfont.hxx>
49cdf0e10cSrcweir #include <impfont.hxx>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir class ServerFontLayout;
52cdf0e10cSrcweir #include <sallayout.hxx>
53cdf0e10cSrcweir 
54cdf0e10cSrcweir // =======================================================================
55cdf0e10cSrcweir 
56cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC GlyphCache
57cdf0e10cSrcweir {
58cdf0e10cSrcweir public:
59cdf0e10cSrcweir     explicit                    GlyphCache( GlyphCachePeer& );
60cdf0e10cSrcweir     /*virtual*/                 ~GlyphCache();
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     static GlyphCache&		GetInstance();
63cdf0e10cSrcweir     void                        LoadFonts();
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     void                        ClearFontPath();
66cdf0e10cSrcweir     void                        AddFontPath( const String& rFontPath );
67cdf0e10cSrcweir     void                        AddFontFile( const rtl::OString& rNormalizedName,
68cdf0e10cSrcweir                                     int nFaceNum, sal_IntPtr nFontId, const ImplDevFontAttributes&,
69cdf0e10cSrcweir                                     const ExtraKernInfo* = NULL );
70cdf0e10cSrcweir     void                        AnnounceFonts( ImplDevFontList* ) const;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     ServerFont*                 CacheFont( const ImplFontSelectData& );
73cdf0e10cSrcweir     void                        UncacheFont( ServerFont& );
74cdf0e10cSrcweir     void                        InvalidateAllGlyphs();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir protected:
77cdf0e10cSrcweir     GlyphCachePeer&             mrPeer;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir private:
80cdf0e10cSrcweir     friend class ServerFont;
81cdf0e10cSrcweir     // used by ServerFont class only
82cdf0e10cSrcweir     void                        AddedGlyph( ServerFont&, GlyphData& );
83*248a599fSHerbert Dürr     void                        RemovingGlyph( ServerFont&, GlyphData&, sal_GlyphId );
84cdf0e10cSrcweir     void                        UsingGlyph( ServerFont&, GlyphData& );
85cdf0e10cSrcweir     void                        GrowNotify();
86cdf0e10cSrcweir 
87cdf0e10cSrcweir private:
88cdf0e10cSrcweir     sal_uLong                       CalcByteCount() const;
89cdf0e10cSrcweir     void                        GarbageCollect();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     // the GlyphCache's FontList matches a font request to a serverfont instance
92cdf0e10cSrcweir     // the FontList key's mpFontData member is reinterpreted as integer font id
93cdf0e10cSrcweir     struct IFSD_Equal{  bool operator()( const ImplFontSelectData&, const ImplFontSelectData& ) const; };
94cdf0e10cSrcweir     struct IFSD_Hash{ size_t operator()( const ImplFontSelectData& ) const; };
95cdf0e10cSrcweir     typedef ::std::hash_map<ImplFontSelectData,ServerFont*,IFSD_Hash,IFSD_Equal > FontList;
96cdf0e10cSrcweir     FontList                    maFontList;
97cdf0e10cSrcweir     sal_uLong                       mnMaxSize;      // max overall cache size in bytes
98cdf0e10cSrcweir     mutable sal_uLong               mnBytesUsed;
99cdf0e10cSrcweir     mutable long                mnLruIndex;
100cdf0e10cSrcweir     mutable int                 mnGlyphCount;
101cdf0e10cSrcweir     ServerFont*                 mpCurrentGCFont;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     class FreetypeManager*      mpFtManager;
104cdf0e10cSrcweir };
105cdf0e10cSrcweir 
106cdf0e10cSrcweir // =======================================================================
107cdf0e10cSrcweir 
108cdf0e10cSrcweir class GlyphMetric
109cdf0e10cSrcweir {
110cdf0e10cSrcweir public:
GetOffset() const111cdf0e10cSrcweir     Point                   GetOffset() const   { return maOffset; }
GetDelta() const112cdf0e10cSrcweir     Point                   GetDelta() const    { return maDelta; }
GetSize() const113cdf0e10cSrcweir     Size                    GetSize() const     { return maSize; }
GetCharWidth() const114cdf0e10cSrcweir     long                    GetCharWidth() const { return mnAdvanceWidth; }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir protected:
117cdf0e10cSrcweir     friend class GlyphData;
SetOffset(int nX,int nY)118cdf0e10cSrcweir     void                    SetOffset( int nX, int nY ) { maOffset = Point( nX, nY); }
SetDelta(int nX,int nY)119cdf0e10cSrcweir     void                    SetDelta( int nX, int nY )  { maDelta = Point( nX, nY); }
SetSize(const Size & s)120cdf0e10cSrcweir     void                    SetSize( const Size& s )    { maSize = s; }
SetCharWidth(long nW)121cdf0e10cSrcweir     void                    SetCharWidth( long nW )     { mnAdvanceWidth = nW; }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir private:
124cdf0e10cSrcweir     long                    mnAdvanceWidth;
125cdf0e10cSrcweir     Point                   maDelta;
126cdf0e10cSrcweir     Point                   maOffset;
127cdf0e10cSrcweir     Size                    maSize;
128cdf0e10cSrcweir };
129cdf0e10cSrcweir 
130cdf0e10cSrcweir // -----------------------------------------------------------------------
131cdf0e10cSrcweir 
132cdf0e10cSrcweir // the glyph specific data needed by a GlyphCachePeer is usually trivial,
133cdf0e10cSrcweir // not attaching it to the corresponding GlyphData would be overkill
134cdf0e10cSrcweir struct ExtGlyphData
135cdf0e10cSrcweir {
136cdf0e10cSrcweir     int     meInfo;
137cdf0e10cSrcweir     void*   mpData;
138cdf0e10cSrcweir 
ExtGlyphDataExtGlyphData139cdf0e10cSrcweir     ExtGlyphData() : meInfo(0), mpData(NULL) {}
140cdf0e10cSrcweir };
141cdf0e10cSrcweir 
142cdf0e10cSrcweir // -----------------------------------------------------------------------
143cdf0e10cSrcweir 
144cdf0e10cSrcweir class GlyphData
145cdf0e10cSrcweir {
146cdf0e10cSrcweir public:
GetMetric() const147cdf0e10cSrcweir     const GlyphMetric&      GetMetric() const           { return maMetric; }
GetSize() const148cdf0e10cSrcweir     Size                    GetSize() const             { return maMetric.GetSize(); }
149cdf0e10cSrcweir 
SetSize(const Size & s)150cdf0e10cSrcweir     void                    SetSize( const Size& s)     { maMetric.SetSize( s ); }
SetOffset(int nX,int nY)151cdf0e10cSrcweir     void                    SetOffset( int nX, int nY ) { maMetric.SetOffset( nX, nY ); }
SetDelta(int nX,int nY)152cdf0e10cSrcweir     void                    SetDelta( int nX, int nY )  { maMetric.SetDelta( nX, nY ); }
SetCharWidth(long nW)153cdf0e10cSrcweir     void                    SetCharWidth( long nW )     { maMetric.SetCharWidth( nW ); }
154cdf0e10cSrcweir 
SetLruValue(int n) const155cdf0e10cSrcweir     void                    SetLruValue( int n ) const  { mnLruValue = n; }
GetLruValue() const156cdf0e10cSrcweir     long                    GetLruValue() const         { return mnLruValue;}
157cdf0e10cSrcweir 
ExtDataRef()158cdf0e10cSrcweir     ExtGlyphData&           ExtDataRef()                { return maExtData; }
ExtDataRef() const159cdf0e10cSrcweir     const ExtGlyphData&     ExtDataRef() const          { return maExtData; }
160cdf0e10cSrcweir 
161cdf0e10cSrcweir private:
162cdf0e10cSrcweir     GlyphMetric             maMetric;
163cdf0e10cSrcweir     ExtGlyphData            maExtData;
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     // used by GlyphCache for cache LRU algorithm
166cdf0e10cSrcweir     mutable long            mnLruValue;
167cdf0e10cSrcweir };
168cdf0e10cSrcweir 
169cdf0e10cSrcweir // =======================================================================
170cdf0e10cSrcweir 
171cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC ServerFont
172cdf0e10cSrcweir {
173cdf0e10cSrcweir public:
GetFontFileName() const174cdf0e10cSrcweir     virtual const ::rtl::OString*   GetFontFileName() const { return NULL; }
GetFontFaceNumber() const175cdf0e10cSrcweir     virtual int                 GetFontFaceNumber() const   { return 0; }
TestFont() const176cdf0e10cSrcweir     virtual bool                TestFont() const            { return true; }
GetFtFace() const177cdf0e10cSrcweir     virtual void*               GetFtFace() const { return 0; }
GetLoadFlags() const178cdf0e10cSrcweir     virtual int                 GetLoadFlags() const { return 0; }
SetFontOptions(const ImplFontOptions &)179cdf0e10cSrcweir     virtual void                SetFontOptions( const ImplFontOptions&) {}
NeedsArtificialBold() const180cdf0e10cSrcweir     virtual bool                NeedsArtificialBold() const { return false; }
NeedsArtificialItalic() const181cdf0e10cSrcweir     virtual bool                NeedsArtificialItalic() const { return false; }
182cdf0e10cSrcweir 
GetFontSelData() const183cdf0e10cSrcweir     const ImplFontSelectData&   GetFontSelData() const      { return maFontSelData; }
184cdf0e10cSrcweir 
185cdf0e10cSrcweir     virtual void                FetchFontMetric( ImplFontMetricData&, long& rFactor ) const = 0;
GetKernPairs(ImplKernPairData **) const186cdf0e10cSrcweir     virtual sal_uLong               GetKernPairs( ImplKernPairData** ) const      { return 0; }
GetGlyphKernValue(int,int) const187cdf0e10cSrcweir     virtual int                 GetGlyphKernValue( int, int ) const           { return 0; }
188cdf0e10cSrcweir     virtual const ImplFontCharMap* GetImplFontCharMap() const = 0;
189cdf0e10cSrcweir     Point                       TransformPoint( const Point& ) const;
190cdf0e10cSrcweir 
191*248a599fSHerbert Dürr     GlyphData&                  GetGlyphData( sal_GlyphId );
GetGlyphMetric(sal_GlyphId aGlyphId)192*248a599fSHerbert Dürr     const GlyphMetric&          GetGlyphMetric( sal_GlyphId aGlyphId )
193*248a599fSHerbert Dürr                                 { return GetGlyphData( aGlyphId ).GetMetric(); }
194cdf0e10cSrcweir 
195*248a599fSHerbert Dürr     virtual sal_GlyphId         GetGlyphIndex( sal_UCS4 ) const = 0;
196*248a599fSHerbert Dürr     virtual bool                GetGlyphOutline( sal_GlyphId, ::basegfx::B2DPolyPolygon& ) const = 0;
197cdf0e10cSrcweir     virtual bool                GetAntialiasAdvice( void ) const = 0;
198*248a599fSHerbert Dürr     bool                        IsGlyphInvisible( sal_GlyphId );
199*248a599fSHerbert Dürr     virtual bool                GetGlyphBitmap1( sal_GlyphId, RawBitmap& ) const = 0;
200*248a599fSHerbert Dürr     virtual bool                GetGlyphBitmap8( sal_GlyphId, RawBitmap& ) const = 0;
201cdf0e10cSrcweir 
202cdf0e10cSrcweir     void                        SetExtended( int nInfo, void* ppVoid );
GetExtInfo()203cdf0e10cSrcweir     int                         GetExtInfo() { return mnExtInfo; }
GetExtPointer()204cdf0e10cSrcweir     void*                       GetExtPointer() { return mpExtData; }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir protected:
207cdf0e10cSrcweir     friend class GlyphCache;
208cdf0e10cSrcweir     friend class ServerFontLayout;
209cdf0e10cSrcweir     explicit                    ServerFont( const ImplFontSelectData& );
210cdf0e10cSrcweir     virtual                     ~ServerFont();
211cdf0e10cSrcweir 
AddRef() const212cdf0e10cSrcweir     void                        AddRef() const      { ++mnRefCount; }
GetRefCount() const213cdf0e10cSrcweir     long                        GetRefCount() const { return mnRefCount; }
214cdf0e10cSrcweir     long                        Release() const;
GetByteCount() const215cdf0e10cSrcweir     sal_uLong                       GetByteCount() const { return mnBytesUsed; }
216cdf0e10cSrcweir 
217*248a599fSHerbert Dürr     virtual void                InitGlyphData( sal_GlyphId, GlyphData& ) const = 0;
218cdf0e10cSrcweir     virtual void                GarbageCollect( long );
219cdf0e10cSrcweir     void                        ReleaseFromGarbageCollect();
220cdf0e10cSrcweir 
GetLayoutEngine()221cdf0e10cSrcweir     virtual ServerFontLayoutEngine* GetLayoutEngine() { return NULL; }
222cdf0e10cSrcweir 
223cdf0e10cSrcweir private:
224cdf0e10cSrcweir     typedef ::std::hash_map<int,GlyphData> GlyphList;
225cdf0e10cSrcweir     mutable GlyphList           maGlyphList;
226cdf0e10cSrcweir 
227cdf0e10cSrcweir     const ImplFontSelectData    maFontSelData;
228cdf0e10cSrcweir 
229cdf0e10cSrcweir     // info for GlyphcachePeer
230cdf0e10cSrcweir     int                         mnExtInfo;
231cdf0e10cSrcweir     void*                       mpExtData;
232cdf0e10cSrcweir 
233cdf0e10cSrcweir     // used by GlyphCache for cache LRU algorithm
234cdf0e10cSrcweir     mutable long                mnRefCount;
235cdf0e10cSrcweir     mutable sal_uLong               mnBytesUsed;
236cdf0e10cSrcweir 
237cdf0e10cSrcweir     ServerFont*                 mpPrevGCFont;
238cdf0e10cSrcweir     ServerFont*                 mpNextGCFont;
239cdf0e10cSrcweir 
240cdf0e10cSrcweir protected:
241cdf0e10cSrcweir     // 16.16 fixed point values used for a rotated font
242cdf0e10cSrcweir     long                        mnCos;
243cdf0e10cSrcweir     long                        mnSin;
244cdf0e10cSrcweir private:
245cdf0e10cSrcweir     int                         mnZWJ;
246cdf0e10cSrcweir     int                         mnZWNJ;
247cdf0e10cSrcweir     bool                        mbCollectedZW;
248cdf0e10cSrcweir };
249cdf0e10cSrcweir 
250cdf0e10cSrcweir // =======================================================================
251cdf0e10cSrcweir 
252cdf0e10cSrcweir // a class for cache entries for physical font instances that are based on serverfonts
253cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC ImplServerFontEntry : public ImplFontEntry
254cdf0e10cSrcweir {
255cdf0e10cSrcweir private:
256cdf0e10cSrcweir     ServerFont*    mpServerFont;
257cdf0e10cSrcweir     ImplFontOptions maFontOptions;
258cdf0e10cSrcweir     bool           mbGotFontOptions;
259cdf0e10cSrcweir     bool           mbValidFontOptions;
260cdf0e10cSrcweir 
261cdf0e10cSrcweir public:
262cdf0e10cSrcweir                    ImplServerFontEntry( ImplFontSelectData& );
263cdf0e10cSrcweir     virtual        ~ImplServerFontEntry();
SetServerFont(ServerFont * p)264cdf0e10cSrcweir     void           SetServerFont( ServerFont* p) { mpServerFont = p; }
265cdf0e10cSrcweir     void           HandleFontOptions();
266cdf0e10cSrcweir };
267cdf0e10cSrcweir 
268cdf0e10cSrcweir // =======================================================================
269cdf0e10cSrcweir 
270cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC ServerFontLayout : public GenericSalLayout
271cdf0e10cSrcweir {
272cdf0e10cSrcweir private:
273cdf0e10cSrcweir     ServerFont&     mrServerFont;
274cdf0e10cSrcweir 
275cdf0e10cSrcweir     // enforce proper copy semantic
276cdf0e10cSrcweir     SAL_DLLPRIVATE  ServerFontLayout( const ServerFontLayout& );
277cdf0e10cSrcweir     SAL_DLLPRIVATE  ServerFontLayout& operator=( const ServerFontLayout& );
278cdf0e10cSrcweir 
279cdf0e10cSrcweir public:
280cdf0e10cSrcweir                     ServerFontLayout( ServerFont& );
281cdf0e10cSrcweir     virtual bool    LayoutText( ImplLayoutArgs& );
282cdf0e10cSrcweir     virtual void    AdjustLayout( ImplLayoutArgs& );
283cdf0e10cSrcweir     virtual void    DrawText( SalGraphics& ) const;
GetServerFont() const284cdf0e10cSrcweir     ServerFont&     GetServerFont() const   { return mrServerFont; }
285cdf0e10cSrcweir };
286cdf0e10cSrcweir 
287cdf0e10cSrcweir // =======================================================================
288cdf0e10cSrcweir 
289cdf0e10cSrcweir class ServerFontLayoutEngine
290cdf0e10cSrcweir {
291cdf0e10cSrcweir public:
~ServerFontLayoutEngine()292cdf0e10cSrcweir     virtual         ~ServerFontLayoutEngine() {}
293cdf0e10cSrcweir     virtual bool    operator()( ServerFontLayout&, ImplLayoutArgs& );
294cdf0e10cSrcweir };
295cdf0e10cSrcweir 
296cdf0e10cSrcweir // =======================================================================
297cdf0e10cSrcweir 
298cdf0e10cSrcweir class GlyphCachePeer
299cdf0e10cSrcweir {
300cdf0e10cSrcweir protected:
GlyphCachePeer()301cdf0e10cSrcweir                     GlyphCachePeer() : mnBytesUsed(0) {}
~GlyphCachePeer()302cdf0e10cSrcweir     virtual         ~GlyphCachePeer() {}
303cdf0e10cSrcweir 
304cdf0e10cSrcweir public:
GetByteCount() const305cdf0e10cSrcweir     sal_Int32       GetByteCount() const { return mnBytesUsed; }
RemovingFont(ServerFont &)306cdf0e10cSrcweir     virtual void    RemovingFont( ServerFont& ) {}
RemovingGlyph(ServerFont &,GlyphData &,int)307cdf0e10cSrcweir     virtual void    RemovingGlyph( ServerFont&, GlyphData&, int ) {}
308cdf0e10cSrcweir 
309cdf0e10cSrcweir protected:
310cdf0e10cSrcweir     sal_Int32       mnBytesUsed;
311cdf0e10cSrcweir };
312cdf0e10cSrcweir 
313cdf0e10cSrcweir // =======================================================================
314cdf0e10cSrcweir 
315cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC RawBitmap
316cdf0e10cSrcweir {
317cdf0e10cSrcweir public:
318cdf0e10cSrcweir                     RawBitmap();
319cdf0e10cSrcweir                     ~RawBitmap();
320cdf0e10cSrcweir     bool            Rotate( int nAngle );
321cdf0e10cSrcweir 
322cdf0e10cSrcweir public:
323cdf0e10cSrcweir     unsigned char*  mpBits;
324cdf0e10cSrcweir     sal_uLong           mnAllocated;
325cdf0e10cSrcweir 
326cdf0e10cSrcweir     sal_uLong           mnWidth;
327cdf0e10cSrcweir     sal_uLong           mnHeight;
328cdf0e10cSrcweir 
329cdf0e10cSrcweir     sal_uLong           mnScanlineSize;
330cdf0e10cSrcweir     sal_uLong           mnBitCount;
331cdf0e10cSrcweir 
332cdf0e10cSrcweir     int             mnXOffset;
333cdf0e10cSrcweir     int             mnYOffset;
334cdf0e10cSrcweir };
335cdf0e10cSrcweir 
336cdf0e10cSrcweir // =======================================================================
337cdf0e10cSrcweir 
SetExtended(int nInfo,void * pVoid)338cdf0e10cSrcweir inline void ServerFont::SetExtended( int nInfo, void* pVoid )
339cdf0e10cSrcweir {
340cdf0e10cSrcweir     mnExtInfo = nInfo;
341cdf0e10cSrcweir     mpExtData = pVoid;
342cdf0e10cSrcweir }
343cdf0e10cSrcweir 
344cdf0e10cSrcweir // =======================================================================
345cdf0e10cSrcweir 
346cdf0e10cSrcweir // ExtraKernInfo allows an on-demand query of extra kerning info #i29881#
347cdf0e10cSrcweir // The kerning values have to be scaled to match the font size before use
348cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC ExtraKernInfo
349cdf0e10cSrcweir {
350cdf0e10cSrcweir public:
351cdf0e10cSrcweir     ExtraKernInfo( sal_IntPtr nFontId );
~ExtraKernInfo()352cdf0e10cSrcweir     virtual ~ExtraKernInfo() {}
353cdf0e10cSrcweir 
354cdf0e10cSrcweir     bool    HasKernPairs() const;
355cdf0e10cSrcweir     int     GetUnscaledKernPairs( ImplKernPairData** ) const;
356cdf0e10cSrcweir     int     GetUnscaledKernValue( sal_Unicode cLeft, sal_Unicode cRight ) const;
357cdf0e10cSrcweir 
358cdf0e10cSrcweir protected:
359cdf0e10cSrcweir     mutable bool mbInitialized;
360cdf0e10cSrcweir     virtual void Initialize() const = 0;
361cdf0e10cSrcweir 
362cdf0e10cSrcweir protected:
363cdf0e10cSrcweir     sal_IntPtr     mnFontId;
364cdf0e10cSrcweir 
365cdf0e10cSrcweir     // container to map a unicode pair to an unscaled kerning value
operator ()ExtraKernInfo::PairEqual366cdf0e10cSrcweir     struct PairEqual{ int operator()(const ImplKernPairData& rA, const ImplKernPairData& rB) const
367cdf0e10cSrcweir                           { return (rA.mnChar1 == rB.mnChar1) && (rA.mnChar2 == rB.mnChar2); } };
operator ()ExtraKernInfo::PairHash368cdf0e10cSrcweir     struct PairHash{ int operator()(const ImplKernPairData& rA) const
369cdf0e10cSrcweir                          { return (rA.mnChar1) * 256 ^ rA.mnChar2; } };
370cdf0e10cSrcweir     typedef std::hash_set< ImplKernPairData, PairHash, PairEqual > UnicodeKernPairs;
371cdf0e10cSrcweir     mutable UnicodeKernPairs maUnicodeKernPairs;
372cdf0e10cSrcweir };
373cdf0e10cSrcweir 
374cdf0e10cSrcweir // =======================================================================
375cdf0e10cSrcweir 
376cdf0e10cSrcweir #endif // _SV_GLYPHCACHE_HXX
377