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 QSVGFONT_P_H
5#define QSVGFONT_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 "qpainterpath.h"
19#include "qhash.h"
20#include "qstring.h"
21#include "qsvgstyle_p.h"
22#include "qtsvgglobal_p.h"
23
24QT_BEGIN_NAMESPACE
25
26class Q_SVG_PRIVATE_EXPORT QSvgGlyph
27{
28public:
29 QSvgGlyph(QChar unicode, const QPainterPath &path, qreal horizAdvX);
30 QSvgGlyph() : m_unicode(0), m_horizAdvX(0) {}
31
32 QChar m_unicode;
33 QPainterPath m_path;
34 qreal m_horizAdvX;
35};
36
37
38class Q_SVG_PRIVATE_EXPORT QSvgFont : public QSvgRefCounted
39{
40public:
41 static constexpr qreal DEFAULT_UNITS_PER_EM = 1000;
42 QSvgFont(qreal horizAdvX);
43
44 void setFamilyName(const QString &name);
45 QString familyName() const;
46
47 void setUnitsPerEm(qreal upem);
48
49 void addGlyph(QChar unicode, const QPainterPath &path, qreal horizAdvX = -1);
50
51 void draw(QPainter *p, const QPointF &point, const QString &str, qreal pixelSize, Qt::Alignment alignment) const;
52public:
53 QString m_familyName;
54 qreal m_unitsPerEm = DEFAULT_UNITS_PER_EM;
55 qreal m_horizAdvX;
56 QHash<QChar, QSvgGlyph> m_glyphs;
57};
58
59QT_END_NAMESPACE
60
61#endif // QSVGFONT_P_H
62

source code of qtsvg/src/svg/qsvgfont_p.h