1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QFONTSUBSET_P_H
5#define QFONTSUBSET_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include "private/qfontengine_p.h"
20
21QT_BEGIN_NAMESPACE
22
23class QFontSubset
24{
25public:
26 explicit QFontSubset(QFontEngine *fe, uint obj_id = 0)
27 : object_id(obj_id), noEmbed(false), fontEngine(fe), downloaded_glyphs(0), standard_font(false)
28 {
29 fontEngine->ref.ref();
30#ifndef QT_NO_PDF
31 addGlyph(index: 0);
32#endif
33 }
34 ~QFontSubset() {
35 if (!fontEngine->ref.deref())
36 delete fontEngine;
37 }
38
39 QByteArray toTruetype() const;
40#ifndef QT_NO_PDF
41 QByteArray widthArray() const;
42 QByteArray createToUnicodeMap() const;
43 QList<int> getReverseMap() const;
44
45 static QByteArray glyphName(unsigned short unicode, bool symbol);
46
47 qsizetype addGlyph(uint index);
48#endif
49 const uint object_id;
50 bool noEmbed;
51 QFontEngine *fontEngine;
52 QList<uint> glyph_indices;
53 mutable int downloaded_glyphs;
54 mutable bool standard_font;
55 qsizetype nGlyphs() const { return glyph_indices.size(); }
56 mutable QFixed emSquare;
57 mutable QList<QFixed> widths;
58};
59
60QT_END_NAMESPACE
61
62#endif // QFONTSUBSET_P_H
63

source code of qtbase/src/gui/text/qfontsubset_p.h