1 /**
2  * This file is part of OpenOrienteering.
3  *
4  * This is a modified version of a file from the Qt Toolkit.
5  * You can redistribute it and/or modify it under the terms of
6  * the GNU General Public License, version 3, as published by
7  * the Free Software Foundation.
8  *
9  * OpenOrienteering is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with OpenOrienteering.  If not, see <http://www.gnu.org/licenses/>
16  *
17  * Changes:
18  * 2015-10-18 Kai Pastor <dg0yt@darc.de>
19  * - Adjustment of legal information
20  * - Modifications required for separate compilation:
21  *   - Renaming of selected files, classes, members and macros
22  *   - Adjustment of include statements
23  *   - Removal of Q_XXX_EXPORT
24  */
25 /****************************************************************************
26 **
27 ** Copyright (C) 2015 The Qt Company Ltd.
28 ** Contact: http://www.qt.io/licensing/
29 **
30 ****************************************************************************/
31 
32 #ifndef QFONTSUBSET_P_H
33 #define QFONTSUBSET_P_H
34 
35 //
36 //  W A R N I N G
37 //  -------------
38 //
39 // This file is not part of the Qt API.  It exists purely as an
40 // implementation detail.  This header file may change from version to
41 // version without notice, or even be removed.
42 //
43 // We mean it.
44 //
45 
46 #include <private/qfontengine_p.h>
47 
48 QT_BEGIN_NAMESPACE
49 
50 class QFontSubset
51 {
52 public:
53     explicit QFontSubset(QFontEngine *fe, int obj_id = 0)
object_id(obj_id)54         : object_id(obj_id), noEmbed(false), fontEngine(fe), downloaded_glyphs(0), standard_font(false)
55     {
56         fontEngine->ref.ref();
57 #ifndef QT_NO_PDF
58         addGlyph(0);
59 #endif
60     }
~QFontSubset()61     ~QFontSubset() {
62         if (!fontEngine->ref.deref())
63             delete fontEngine;
64     }
65 
66     QByteArray toTruetype() const;
67 #ifndef QT_NO_PDF
68     QByteArray widthArray() const;
69     QByteArray createToUnicodeMap() const;
70     QVector<int> getReverseMap() const;
71     QByteArray glyphName(unsigned int glyph, const QVector<int> &reverseMap) const;
72 
73     static QByteArray glyphName(unsigned short unicode, bool symbol);
74 
75     int addGlyph(int index);
76 #endif
77     const int object_id;
78     bool noEmbed;
79     QFontEngine *fontEngine;
80     QList<int> glyph_indices;
81     mutable int downloaded_glyphs;
82     mutable bool standard_font;
nGlyphs()83     int nGlyphs() const { return glyph_indices.size(); }
84     mutable QFixed emSquare;
85     mutable QVector<QFixed> widths;
86 };
87 
88 QT_END_NAMESPACE
89 
90 #endif // QFONTSUBSET_P_H
91