Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_SOURCE_GDI_PDFFONTCACHE_HXX
21 : #define INCLUDED_VCL_SOURCE_GDI_PDFFONTCACHE_HXX
22 :
23 : #include <sal/types.h>
24 :
25 : #include <sallayout.hxx>
26 : #include <salgdi.hxx>
27 :
28 : namespace vcl
29 : {
30 : class PDFFontCache
31 : {
32 : struct FontIdentifier
33 : {
34 : sal_IntPtr m_nFontId;
35 : int m_nMagic;
36 : bool m_bVertical;
37 :
38 : FontIdentifier( const PhysicalFontFace*, bool bVertical );
39 : FontIdentifier() : m_nFontId(0), m_nMagic(0), m_bVertical( false ) {}
40 :
41 : bool operator==( const FontIdentifier& rRight ) const
42 : {
43 : return m_nFontId == rRight.m_nFontId &&
44 : m_nMagic == rRight.m_nMagic &&
45 : m_bVertical == rRight.m_bVertical;
46 : }
47 0 : bool operator<( const FontIdentifier& rRight ) const
48 : {
49 0 : return m_nFontId < rRight.m_nFontId ||
50 0 : m_nMagic < rRight.m_nMagic ||
51 0 : m_bVertical < rRight.m_bVertical;
52 : }
53 : };
54 0 : struct FontData
55 : {
56 : Int32Vector m_nWidths;
57 : Ucs2UIntMap m_aGlyphIdToIndex;
58 : };
59 : typedef std::map< FontIdentifier, sal_uInt32 > FontToIndexMap;
60 :
61 : std::vector< FontData > m_aFonts;
62 : FontToIndexMap m_aFontToIndex;
63 :
64 : FontData& getFont( const PhysicalFontFace*, bool bVertical );
65 : public:
66 0 : PDFFontCache() {}
67 0 : ~PDFFontCache() {}
68 :
69 : sal_Int32 getGlyphWidth( const PhysicalFontFace*, sal_GlyphId, bool bVertical, SalGraphics* );
70 : };
71 : }
72 :
73 : #endif
74 :
75 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|