Krita Source Code Documentation
Loading...
Searching...
No Matches
KoSvgTextContentElement.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KOSVGTEXTCONTENTELEMENT_H
8#define KOSVGTEXTCONTENTELEMENT_H
9
10#include "KoSvgText.h"
11#include "KoSvgTextProperties.h"
12#include "SvgLoadingContext.h"
13#include "SvgSavingContext.h"
14
15#include <kritaflake_export.h>
16#include <QScopedPointer>
17
27struct KRITAFLAKE_EXPORT KoSvgTextContentElement
28{
29public:
32 : properties(rhs.properties)
33 , localTransformations(rhs.localTransformations)
34 , textPathInfo(rhs.textPathInfo)
35 , textPathId(rhs.textPathId)
36 , textLength(rhs.textLength)
37 , lengthAdjust(rhs.lengthAdjust)
38 , textDecorations(rhs.textDecorations)
39 , text(rhs.text)
40 , finalResultIndex(rhs.finalResultIndex)
41 , associatedOutline(rhs.associatedOutline)
42 {
43
44 }
45
47
50
53
56
58 QString textPathId;
59
64
66 QMap<KoSvgText::TextDecoration, QPainterPath> textDecorations;
67
69 QString text;
70
74 int finalResultIndex = -1;
75
77 QPainterPath associatedOutline;
78
90 bool loadSvg(const QDomElement &element, SvgLoadingContext &context, bool rootNode = false);
91
92 bool loadSvgTextNode(const QDomText &text, SvgLoadingContext &context);
93
94 bool saveSvg(SvgSavingContext &context, bool rootText, bool saveText, QMap<QString, QString> shapeSpecificAttributes, KoShape *textPath = nullptr);
95
101 int numChars(bool withControls = false, KoSvgTextProperties resolvedProps = KoSvgTextProperties()) const;
102
107 QString getTransformedString(QVector<QPair<int, int>> &positions, KoSvgTextProperties resolvedProps = KoSvgTextProperties()) const;
108
114 void insertText(int start, QString insertText);
121 void removeText(int &start, int length);
122};
123
124#endif // KOSVGTEXTCONTENTELEMENT_H
qreal length(const QPointF &vec)
Definition Ellipse.cc:82
Contains data used for loading svg.
Context for saving svg files.
@ LengthAdjustSpacing
Only stretch the spaces.
Definition KoSvgText.h:251
The KoSvgTextContentElement struct.
KoSvgText::AutoValue textLength
the value 'textLength' attribute of the associated dom element
~KoSvgTextContentElement()=default
QVector< KoSvgText::CharTransformation > localTransformations
Local SVG char transforms.
QMap< KoSvgText::TextDecoration, QPainterPath > textDecorations
Cached text decorations to be used by the painting function.
KoSvgTextProperties properties
The textProperties. This includes.
QPainterPath associatedOutline
The associated outline. Currently only a bounding box.
QString textPathId
The textpath's name, if any.
QString text
Plain text of the current node. Use insertText and removeText to manipulate it.
KoSvgTextContentElement(const KoSvgTextContentElement &rhs)
KoSvgText::TextOnPathInfo textPathInfo
Text path info for the text-on-path algorithm.