Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qsvgfont_p.h
Go to the documentation of this file.
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
// Qt-Security score:significant reason:default
4
5
6
#
ifndef
QSVGFONT_P_H
7
#
define
QSVGFONT_P_H
8
9
//
10
// W A R N I N G
11
// -------------
12
//
13
// This file is not part of the Qt API. It exists purely as an
14
// implementation detail. This header file may change from version to
15
// version without notice, or even be removed.
16
//
17
// We mean it.
18
//
19
20
#
include
<
QtCore
/
qhash
.
h
>
21
#
include
"qpainterpath.h"
22
#
include
"qlist.h"
23
#
include
"qstring.h"
24
25
#
include
<
QtSvg
/
private
/
qsvgnode_p
.
h
>
26
27
#
include
<
memory
>
28
29
QT_BEGIN_NAMESPACE
30
31
class
Q_SVG_EXPORT
QSvgGlyph
32
{
33
public
:
34
QSvgGlyph(
const
QString &unicode,
const
QPainterPath &path, qreal horizAdvX);
35
QSvgGlyph() =
default
;
36
37
QString m_unicode;
38
QPainterPath m_path;
39
qreal m_horizAdvX{0};
40
};
41
42
43
class
Q_SVG_EXPORT
QSvgFont
:
public
QSvgNode
44
{
45
public
:
46
QSvgFont(qreal horizAdvX);
47
~QSvgFont() override;
48
49
Type type()
const
override {
return
Font; }
50
void
setUnitsPerEm(qreal upem);
51
52
void
addGlyph(
const
QString &unicode,
const
QPainterPath &path, qreal horizAdvX = -1);
53
bool
addMissingGlyph(
const
QPainterPath &path, qreal horizAdvX);
54
55
void
drawCommand(QPainter *, QSvgExtraStates &) override {};
56
void
draw(QPainter *p,
const
QPointF &point,
const
QList<
const
QSvgGlyph *> &glyphs,
57
qreal pixelSize, Qt::Alignment alignment)
const
;
58
QRectF boundingRect(QPainter *p,
const
QPointF &point,
const
QList<
const
QSvgGlyph *> &glyphs,
59
qreal pixelSize, Qt::Alignment alignment)
const
;
60
const
QSvgGlyph *findFirstGlyphFor(QStringView text)
const
;
61
QList<
const
QSvgGlyph *> toGlyphs(QStringView text)
const
;
62
63
public
:
64
qreal m_unitsPerEm{1000};
65
qreal m_horizAdvX{0};
66
67
private
:
68
// not about a missing <glyph> element, but the font's <missing-glyph> element:
69
std::unique_ptr<
const
QSvgGlyph> m_missingGlyph;
70
// The following needs to preserve the order of glyphs because
71
// "17.6 Glyph selection rules" in SVG Tiny 1.2 reads:
72
// "the 'font' element must be searched from its first
73
// 'glyph' element to its last in logical order"
74
QList<QSvgGlyph> m_glyphs;
75
76
// to speed up finding glyphs
77
mutable
QHash<
char32_t
, QList<qsizetype>> m_possibleGlyphIndicesForChar;
78
mutable
qsizetype m_firstUnscannedGlyphIdx{0};
79
80
void
draw_helper(QPainter *p,
const
QPointF &point,
81
const
QList<
const
QSvgGlyph *> &glyphs, qreal pixelSize,
82
Qt::Alignment alignment, QRectF *boundingRect =
nullptr
)
const
;
83
};
84
85
using
QSvgFontPtr = std::unique_ptr<QSvgFont>;
86
87
QT_END_NAMESPACE
88
89
#
endif
// QSVGFONT_P_H
QByteArray::FromBase64Result
\inmodule QtCore
Definition
qbytearray.h:824
QPaintEngine::QPainter
friend class QPainter
Definition
qpaintengine.h:220
QSvgDefs
Definition
qsvgstructure_p.h:67
QSvgDocument
Definition
qsvgdocument_p.h:42
QSvgFilterContainer
Definition
qsvgstructure_p.h:209
QSvgFont
Definition
qsvgfont_p.h:44
QSvgG
Definition
qsvgstructure_p.h:55
QSvgGlyph
Definition
qsvgfont_p.h:32
QSvgMarker
Definition
qsvgstructure_p.h:167
QSvgMask
Definition
qsvgstructure_p.h:252
QSvgPattern
Definition
qsvgstructure_p.h:280
QSvgStructureNode
Definition
qsvgstructure_p.h:35
QSvgSwitch
Definition
qsvgstructure_p.h:235
QSvgSymbolLike
Definition
qsvgstructure_p.h:78
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QtSvg
Definition
qtsvgglobal.h:15
QtSvg::Option
Option
Definition
qtsvgglobal.h:17
QtSvg::AssumeTrustedSource
@ AssumeTrustedSource
Definition
qtsvgglobal.h:20
QtSvg::DisableSMILAnimations
@ DisableSMILAnimations
Definition
qtsvgglobal.h:23
QtSvg::DisableCSSAnimations
@ DisableCSSAnimations
Definition
qtsvgglobal.h:24
QtSvg::Tiny12FeaturesOnly
@ Tiny12FeaturesOnly
Definition
qtsvgglobal.h:19
QtSvg::NoOption
@ NoOption
Definition
qtsvgglobal.h:18
QtSvg::DisableAnimations
@ DisableAnimations
Definition
qtsvgglobal.h:27
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
operator<<
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition
qdir.cpp:2620
qPrintable
#define qPrintable(string)
Definition
qstring.h:1718
qt_inflateSvgzDataFrom
static QByteArray qt_inflateSvgzDataFrom(QIODevice *device, bool doCheckContent=true)
Definition
qsvgdocument.cpp:73
isValidMatrix
static bool isValidMatrix(const QTransform &transform)
Definition
qsvgdocument.cpp:427
hasSvgHeader
static bool hasSvgHeader(const QByteArray &buf)
Definition
qsvgdocument.cpp:51
calculateSizeValue
std::optional< int > calculateSizeValue(bool isPercent, int sizeValue, qreal viewBoxSizeValue)
Definition
qsvgdocument_p.h:130
qtsvg
src
svg
qsvgfont_p.h
Generated on
for Qt by
1.18.0