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