xref: /aoo42x/main/vcl/source/gdi/pdffontcache.hxx (revision 0d63794c)
1*0d63794cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*0d63794cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*0d63794cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*0d63794cSAndrew Rist  * distributed with this work for additional information
6*0d63794cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*0d63794cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*0d63794cSAndrew Rist  * "License"); you may not use this file except in compliance
9*0d63794cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*0d63794cSAndrew Rist  *
11*0d63794cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*0d63794cSAndrew Rist  *
13*0d63794cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*0d63794cSAndrew Rist  * software distributed under the License is distributed on an
15*0d63794cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*0d63794cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*0d63794cSAndrew Rist  * specific language governing permissions and limitations
18*0d63794cSAndrew Rist  * under the License.
19*0d63794cSAndrew Rist  *
20*0d63794cSAndrew Rist  *************************************************************/
21*0d63794cSAndrew Rist 
22*0d63794cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef VCL_PDFFONTCACHE_HXX
25cdf0e10cSrcweir #define VCL_PDFFONTCACHE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <sal/types.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <sallayout.hxx>
30cdf0e10cSrcweir #include <salgdi.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir namespace vcl
33cdf0e10cSrcweir {
34cdf0e10cSrcweir     class PDFFontCache
35cdf0e10cSrcweir     {
36cdf0e10cSrcweir         struct FontIdentifier
37cdf0e10cSrcweir         {
38cdf0e10cSrcweir             sal_IntPtr      m_nFontId;
39cdf0e10cSrcweir             int             m_nMagic;
40cdf0e10cSrcweir             bool            m_bVertical;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir             FontIdentifier( const ImplFontData*, bool bVertical );
FontIdentifiervcl::PDFFontCache::FontIdentifier43cdf0e10cSrcweir             FontIdentifier() : m_nFontId(0), m_nMagic(0), m_bVertical( false ) {}
44cdf0e10cSrcweir 
operator ==vcl::PDFFontCache::FontIdentifier45cdf0e10cSrcweir             bool operator==( const FontIdentifier& rRight ) const
46cdf0e10cSrcweir             {
47cdf0e10cSrcweir                 return m_nFontId == rRight.m_nFontId &&
48cdf0e10cSrcweir                        m_nMagic == rRight.m_nMagic &&
49cdf0e10cSrcweir                        m_bVertical == rRight.m_bVertical;
50cdf0e10cSrcweir             }
operator <vcl::PDFFontCache::FontIdentifier51cdf0e10cSrcweir             bool operator<( const FontIdentifier& rRight ) const
52cdf0e10cSrcweir             {
53cdf0e10cSrcweir                 return m_nFontId < rRight.m_nFontId ||
54cdf0e10cSrcweir                        m_nMagic < rRight.m_nMagic ||
55cdf0e10cSrcweir                        m_bVertical < rRight.m_bVertical;
56cdf0e10cSrcweir             }
57cdf0e10cSrcweir         };
58cdf0e10cSrcweir         struct FontData
59cdf0e10cSrcweir         {
60cdf0e10cSrcweir             Int32Vector  m_nWidths;
61cdf0e10cSrcweir             Ucs2UIntMap  m_aGlyphIdToIndex;
62cdf0e10cSrcweir         };
63cdf0e10cSrcweir         typedef std::map< FontIdentifier, sal_uInt32 > FontToIndexMap;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir         std::vector< FontData >     m_aFonts;
66cdf0e10cSrcweir         FontToIndexMap              m_aFontToIndex;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir         FontData& getFont( const ImplFontData*, bool bVertical );
69cdf0e10cSrcweir         public:
PDFFontCache()70cdf0e10cSrcweir         PDFFontCache() {}
~PDFFontCache()71cdf0e10cSrcweir         ~PDFFontCache() {}
72cdf0e10cSrcweir 
73cdf0e10cSrcweir         sal_Int32 getGlyphWidth( const ImplFontData*, sal_GlyphId, bool bVertical, SalGraphics* );
74cdf0e10cSrcweir     };
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir #endif
78