Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/legal
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Digia. For licensing terms and
14** conditions see http://qt.digia.com/licensing. For further information
15** use the contact form at http://qt.digia.com/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 2.1 requirements
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24**
25** In addition, as a special exception, Digia gives you certain additional
26** rights. These rights are described in the Digia Qt LGPL Exception
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28**
29** GNU General Public License Usage
30** Alternatively, this file may be used under the terms of the GNU
31** General Public License version 3.0 as published by the Free Software
32** Foundation and appearing in the file LICENSE.GPL included in the
33** packaging of this file. Please review the following information to
34** ensure the GNU General Public License version 3.0 requirements will be
35** met: http://www.gnu.org/copyleft/gpl.html.
36**
37**
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QPF2_H
43#define QPF2_H
44
45#include <private/qfontengine_qpf_p.h>
46#include <qmetatype.h>
47
48QT_BEGIN_NAMESPACE
49
50class QFontEngine;
51
52class QPF
53{
54public:
55 static int debugVerbosity;
56
57 enum GenerationOption {
58 IncludeCMap = 0x1,
59 RenderGlyphs = 0x2
60 };
61
62 struct CharacterRange
63 {
64 inline CharacterRange() : start(0), end(0xffff) {}
65 uint start;
66 uint end;
67 };
68
69 static QString fileNameForFont(const QFont &f);
70
71 static QByteArray generate(const QFont &font, int options,
72 const QList<CharacterRange> &ranges,
73 QString *originalFontFile = 0);
74 static QByteArray generate(QFontEngine *fontEngine, int options, const QList<CharacterRange> &ranges);
75 void addHeader(QFontEngine *fontEngine);
76 void addCMap(QFontEngine *fontEngine);
77 void addGlyphs(QFontEngine *fontEngine, const QList<CharacterRange> &ranges);
78 void addBlock(QFontEngineQPF::BlockTag tag, const QByteArray &data);
79
80 void addTaggedString(QFontEngineQPF::HeaderTag tag, const QByteArray &string);
81 void addTaggedQFixed(QFontEngineQPF::HeaderTag tag, QFixed value);
82 void addTaggedUInt8(QFontEngineQPF::HeaderTag tag, quint8 value);
83 void addTaggedInt8(QFontEngineQPF::HeaderTag tag, qint8 value);
84 void addTaggedUInt16(QFontEngineQPF::HeaderTag tag, quint16 value);
85 void addTaggedUInt32(QFontEngineQPF::HeaderTag tag, quint32 value);
86
87 static void dump(const QByteArray &qpf);
88 const uchar *dumpHeader(const uchar *data);
89 const uchar *dumpHeaderTag(const uchar *data);
90 void dumpGMapBlock(const quint32 *gmap, int glyphCount);
91 void dumpGlyphBlock(const quint32 *gmap, int glyphCount, const uchar *data, const uchar *endPtr);
92 void dumpGlyph(const uchar *data, const QFontEngineQPF::Glyph *glyph);
93
94 void addUInt16(quint16 value) { qToBigEndian(value, addBytes(sizeof(value))); }
95 void addUInt32(quint32 value) { qToBigEndian(value, addBytes(sizeof(value))); }
96 void addUInt8(quint8 value) { *addBytes(sizeof(value)) = value; }
97 void addInt8(qint8 value) { *addBytes(sizeof(value)) = quint8(value); }
98 void addByteArray(const QByteArray &string) {
99 uchar *data = addBytes(string.length());
100 qMemCopy(data, string.constData(), string.length());
101 }
102
103 void align4() { while (qpf.size() & 3) { addUInt8('\0'); } }
104
105 uchar *addBytes(int size) {
106 const int oldSize = qpf.size();
107 qpf.resize(qpf.size() + size);
108 return reinterpret_cast<uchar *>(qpf.data() + oldSize);
109 }
110
111 QByteArray qpf;
112 int options;
113};
114
115QT_END_NAMESPACE
116
117Q_DECLARE_METATYPE(QPF::CharacterRange)
118
119#endif // QPF2_H
120

Warning: That file was not part of the compilation database. It may have many parsing errors.