|
Krita Source Code Documentation
|
The KoSvgTextContentElement struct. More...
#include <KoSvgTextContentElement.h>
Public Member Functions | |
| QString | getTransformedString (QVector< QPair< int, int > > &positions, KoSvgTextProperties resolvedProps=KoSvgTextProperties()) const |
| void | insertText (int start, QString insertText) |
| insertText | |
| KoSvgTextContentElement () | |
| KoSvgTextContentElement (const KoSvgTextContentElement &rhs) | |
| bool | loadSvg (const QDomElement &element, SvgLoadingContext &context, bool rootNode=false) |
| loadSvg load SVG style data into the current content element. | |
| bool | loadSvgTextNode (const QDomText &text, SvgLoadingContext &context) |
| int | numChars (bool withControls=false, KoSvgTextProperties resolvedProps=KoSvgTextProperties()) const |
| void | removeText (int &start, int length) |
| removeText removes text, | |
| bool | saveSvg (SvgSavingContext &context, bool rootText, bool saveText, QMap< QString, QString > shapeSpecificAttributes) |
| ~KoSvgTextContentElement ()=default | |
Public Attributes | |
| QPainterPath | associatedOutline |
| The associated outline. Currently only a bounding box. | |
| int | finalResultIndex = -1 |
| KoSvgText::LengthAdjust | lengthAdjust = KoSvgText::LengthAdjustSpacing |
| the value 'lengthAdjust' attribute of the associated dom element | |
| QVector< KoSvgText::CharTransformation > | localTransformations |
| Local SVG char transforms. | |
| KoSvgTextProperties | properties |
| The textProperties. This includes. | |
| QString | text |
| Plain text of the current node. Use insertText and removeText to manipulate it. | |
| QMap< KoSvgText::TextDecoration, QPainterPath > | textDecorations |
| Cached text decorations to be used by the painting function. | |
| KoSvgText::AutoValue | textLength |
| the value 'textLength' attribute of the associated dom element | |
| QScopedPointer< KoShape > | textPath {nullptr} |
| The textpath, if any. Defaults to null. | |
| KoSvgText::TextOnPathInfo | textPathInfo |
| Text path info for the text-on-path algorithm. | |
The KoSvgTextContentElement struct.
Replacing KoSvgTextChunkShape, KoSvgTextContentElement represents a formatted span of text. This can be a SVG <text >, <tspan > or <textPath > node. This struct is used to represent the internal data of KoSvgTextShape.
Definition at line 27 of file KoSvgTextContentElement.h.
| KoSvgTextContentElement::KoSvgTextContentElement | ( | ) |
Definition at line 20 of file KoSvgTextContentElement.cpp.
|
inline |
Definition at line 31 of file KoSvgTextContentElement.h.
References textPath.
|
default |
| QString KoSvgTextContentElement::getTransformedString | ( | QVector< QPair< int, int > > & | positions, |
| KoSvgTextProperties | resolvedProps = KoSvgTextProperties() ) const |
Get the text with transformations applied.
| positions | the text positions which may have changed due the uppercase transform. |
Definition at line 435 of file KoSvgTextContentElement.cpp.
References KoSvgTextProperties::property(), KoSvgTextProperties::propertyOrDefault(), text, KoSvgTextProperties::TextLanguage, KoSvgTextProperties::TextTransformId, and transformText().
| void KoSvgTextContentElement::insertText | ( | int | start, |
| QString | insertText ) |
insertText
| start | – start index. |
| insertText | – text to insert. |
Definition at line 425 of file KoSvgTextContentElement.cpp.
References insertText(), and text.
| bool KoSvgTextContentElement::loadSvg | ( | const QDomElement & | element, |
| SvgLoadingContext & | context, | ||
| bool | rootNode = false ) |
loadSvg load SVG style data into the current content element.
| element | – xml element to load the data from. |
| context | – loading context. |
| rootNode | – whether this content element is a <text > node. During text layout, text properties are inherited dynamically. However, we can only start at the root text node, while SVG can have properties that are set on the document root and inherit. Therefore, when loading we inherit and resolve those properties dynamically for the root node only. |
Definition at line 163 of file KoSvgTextContentElement.cpp.
References SvgLoadingContext::currentGC(), KoSvgTextProperties::FillId, KoSvgTextProperties::hasProperty(), KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, KoSvgTextProperties::KraTextStyleResolution, KoSvgTextProperties::KraTextStyleType, lengthAdjust, localTransformations, KoSvgText::TextOnPathInfo::method, KoSvgTextProperties::Opacity, KoSvgTextProperties::PaintOrder, KoSvgText::parseAutoValueXY(), KoSvgText::parseLengthAdjust(), SvgUtil::parseNumber(), KoSvgText::parseTextPathMethod(), KoSvgText::parseTextPathSide(), KoSvgText::parseTextPathSpacing(), SvgUtil::parseUnit(), properties, KoSvgTextProperties::property(), SvgLoadingContext::resolvedProperties(), KoSvgTextProperties::setProperty(), KoSvgText::TextOnPathInfo::side, KoSvgText::TextOnPathInfo::spacing, KoSvgText::TextOnPathInfo::startOffset, KoSvgText::TextOnPathInfo::startOffsetIsPercentage, KoSvgTextProperties::StrokeId, TEXT_STYLE_RES, TEXT_STYLE_TYPE, textLength, textPathInfo, SvgGraphicsContext::textProperties, KisDomUtils::toInt(), and KoSvgTextProperties::Visiblity.
| bool KoSvgTextContentElement::loadSvgTextNode | ( | const QDomText & | text, |
| SvgLoadingContext & | context ) |
Definition at line 249 of file KoSvgTextContentElement.cpp.
References SvgLoadingContext::currentGC(), KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, and text.
| int KoSvgTextContentElement::numChars | ( | bool | withControls = false, |
| KoSvgTextProperties | resolvedProps = KoSvgTextProperties() ) const |
The number of characters contained in the currentChunk.
| withControls | this will enable the bidi controls to be counted as well. |
Definition at line 405 of file KoSvgTextContentElement.cpp.
References KoSvgTextProperties::DirectionId, KoSvgText::DirectionLeftToRight, KoCssTextUtils::getBidiClosing(), KoCssTextUtils::getBidiOpening(), KoSvgTextProperties::property(), KoSvgTextProperties::propertyOrDefault(), text, KoSvgTextProperties::TextLanguage, KoSvgTextProperties::TextTransformId, transformText(), and KoSvgTextProperties::UnicodeBidiId.
| void KoSvgTextContentElement::removeText | ( | int & | start, |
| int | length ) |
removeText removes text,
| start | – start index, may be modified. |
| length | – length of text to remove. |
Definition at line 443 of file KoSvgTextContentElement.cpp.
References length(), KoCssTextUtils::removeText(), and text.
| bool KoSvgTextContentElement::saveSvg | ( | SvgSavingContext & | context, |
| bool | rootText, | ||
| bool | saveText, | ||
| QMap< QString, QString > | shapeSpecificAttributes ) |
Definition at line 268 of file KoSvgTextContentElement.cpp.
References associatedOutline, KoSvgTextProperties::background(), KoSvgTextProperties::convertToSvgTextAttributes(), KoSvgText::AutoValue::customValue, KoSvgTextProperties::defaultProperties(), SvgStyleWriter::embedShape(), KoSvgTextProperties::FillId, KoSvgTextProperties::hasProperty(), KoSvgText::AutoValue::isAuto, kisRadiansToDegrees(), KoSvgTextProperties::KraTextStyleResolution, KoSvgTextProperties::KraTextStyleType, lengthAdjust, KoSvgText::LengthAdjustSpacingAndGlyphs, localTransformations, KoSvgText::TextOnPathInfo::method, KoSvgTextProperties::ownProperties(), properties, KoSvgTextProperties::property(), SvgStyleWriter::saveSvgFill(), SvgStyleWriter::saveSvgStroke(), SvgSavingContext::shapeWriter, KoSvgText::TextOnPathInfo::side, KoSvgText::TextOnPathInfo::spacing, KoSvgText::TextOnPathInfo::startOffset, KoSvgText::TextOnPathInfo::startOffsetIsPercentage, KoSvgTextProperties::stroke(), KoSvgTextProperties::StrokeId, KoSvgTextProperties::supportedXmlAttributes(), text, TEXT_STYLE_RES, TEXT_STYLE_TYPE, textLength, textPath, KoSvgText::TextPathAlign, KoSvgText::TextPathAuto, textPathInfo, KoSvgText::TextPathSideLeft, KisDomUtils::toString(), KoSvgText::writeTextPathMethod(), KoSvgText::writeTextPathSide(), and KoSvgText::writeTextPathSpacing().
| QPainterPath KoSvgTextContentElement::associatedOutline |
The associated outline. Currently only a bounding box.
Definition at line 78 of file KoSvgTextContentElement.h.
| int KoSvgTextContentElement::finalResultIndex = -1 |
Set during layout, finalResultIndex determines the size of the iterator on result after going over this contentElement. Once layout has been set this is less fiddly than using numChars which requires resolving properties.
Definition at line 75 of file KoSvgTextContentElement.h.
| KoSvgText::LengthAdjust KoSvgTextContentElement::lengthAdjust = KoSvgText::LengthAdjustSpacing |
the value 'lengthAdjust' attribute of the associated dom element
Definition at line 64 of file KoSvgTextContentElement.h.
| QVector<KoSvgText::CharTransformation> KoSvgTextContentElement::localTransformations |
Local SVG char transforms.
Definition at line 53 of file KoSvgTextContentElement.h.
| KoSvgTextProperties KoSvgTextContentElement::properties |
The textProperties. This includes.
Definition at line 50 of file KoSvgTextContentElement.h.
| QString KoSvgTextContentElement::text |
Plain text of the current node. Use insertText and removeText to manipulate it.
Definition at line 70 of file KoSvgTextContentElement.h.
| QMap<KoSvgText::TextDecoration, QPainterPath> KoSvgTextContentElement::textDecorations |
Cached text decorations to be used by the painting function.
Definition at line 67 of file KoSvgTextContentElement.h.
| KoSvgText::AutoValue KoSvgTextContentElement::textLength |
the value 'textLength' attribute of the associated dom element
Definition at line 62 of file KoSvgTextContentElement.h.
| QScopedPointer<KoShape> KoSvgTextContentElement::textPath {nullptr} |
The textpath, if any. Defaults to null.
Definition at line 59 of file KoSvgTextContentElement.h.
| KoSvgText::TextOnPathInfo KoSvgTextContentElement::textPathInfo |
Text path info for the text-on-path algorithm.
Definition at line 56 of file KoSvgTextContentElement.h.