Krita Source Code Documentation
Loading...
Searching...
No Matches
KoSvgTextShape.cpp File Reference
#include "KoSvgTextShape.h"
#include "KoSvgTextShape_p.h"
#include <QTextLayout>
#include <klocalizedstring.h>
#include "KoSvgTextProperties.h"
#include <KoDocumentResourceManager.h>
#include <KoShapeContainer_p.h>
#include <KoShapeController.h>
#include <text/KoCssTextUtils.h>
#include <text/KoFontRegistry.h>
#include <text/KoSvgTextShapeMarkupConverter.h>
#include <text/KoPolygonUtils.h>
#include <kis_global.h>
#include <KoClipMaskPainter.h>
#include <KoColorBackground.h>
#include <KoIcon.h>
#include <KoPathShape.h>
#include <KoProperties.h>
#include <KoShapeLoadingContext.h>
#include <KoXmlNS.h>
#include <KoInsets.h>
#include <SvgLoadingContext.h>
#include <SvgGraphicContext.h>
#include <SvgUtil.h>
#include <SvgStyleWriter.h>
#include <QPainter>
#include <QPainterPath>
#include <QtMath>
#include <FlakeDebug.h>
#include <functional>
#include "KoXmlWriter.h"
#include "SvgWriter.h"

Go to the source code of this file.

Classes

class  KoSvgTextShapeMementoImpl
 
struct  KoSvgTextNodeIndex::Private
 

Functions

KisForest< KoSvgTextContentElement >::child_iterator findNodeIndexForPropertyIdImpl (KisForest< KoSvgTextContentElement >::child_iterator parent, KoSvgTextProperties::PropertyId propertyId)
 
KoSvgTextCharacterInfo infoFromCharacterResult (const CharacterResult &res, const int index)
 
KoSvgTextProperties inheritProperties (KisForest< KoSvgTextContentElement >::depth_first_tail_iterator it)
 

Function Documentation

◆ findNodeIndexForPropertyIdImpl()

KisForest< KoSvgTextContentElement >::child_iterator findNodeIndexForPropertyIdImpl ( KisForest< KoSvgTextContentElement >::child_iterator parent,
KoSvgTextProperties::PropertyId propertyId )

Definition at line 1459 of file KoSvgTextShape.cpp.

1459 {
1460 for (auto child = KisForestDetail::childBegin(parent); child != KisForestDetail::childEnd(parent); child++) {
1461 if (child->properties.hasProperty(propertyId)) {
1462 return child;
1463 } else if (KisForestDetail::childBegin(child) != KisForestDetail::childEnd(child)) {
1464 auto found = findNodeIndexForPropertyIdImpl(child, propertyId);
1465 if (found != child) {
1466 return found;
1467 }
1468 }
1469 }
1470 return parent;
1471}
KisForest< KoSvgTextContentElement >::child_iterator findNodeIndexForPropertyIdImpl(KisForest< KoSvgTextContentElement >::child_iterator parent, KoSvgTextProperties::PropertyId propertyId)
ChildIterator< value_type, is_const > childBegin(const ChildIterator< value_type, is_const > &it)
Definition KisForest.h:290
ChildIterator< value_type, is_const > parent(const ChildIterator< value_type, is_const > &it)
Definition KisForest.h:327
ChildIterator< value_type, is_const > childEnd(const ChildIterator< value_type, is_const > &it)
Definition KisForest.h:300

References KisForestDetail::childBegin(), KisForestDetail::childEnd(), and findNodeIndexForPropertyIdImpl().

◆ infoFromCharacterResult()

KoSvgTextCharacterInfo infoFromCharacterResult ( const CharacterResult & res,
const int index )

Definition at line 1403 of file KoSvgTextShape.cpp.

1403 {
1405 info.finalPos = res.finalPosition;
1407 info.visualIndex = res.visualIndex;
1408 info.middle = res.middle;
1409 info.advance = res.advance;
1410 info.logicalIndex = index;
1411 info.rtl = res.cursorInfo.rtl;
1412 info.metrics = res.metrics;
1413 return info;
1414}
T kisRadiansToDegrees(T radians)
Definition kis_global.h:181
QPointF finalPosition
the final position, taking into account both CSS and SVG positioning considerations.
KoSvgText::FontMetrics metrics
Fontmetrics for current font, in Freetype scanline coordinates.
bool rtl
Whether the current glyph is right-to-left, as opposed to the markup.
The KoSvgTextCharacterInfo class This is a small struct to convey information about character positio...
KoSvgText::FontMetrics metrics
<Whether the character is in the middle of a cluster.

References KoSvgTextCharacterInfo::advance, CharacterResult::advance, CharacterResult::cursorInfo, KoSvgTextCharacterInfo::finalPos, CharacterResult::finalPosition, kisRadiansToDegrees(), KoSvgTextCharacterInfo::logicalIndex, KoSvgTextCharacterInfo::metrics, CharacterResult::metrics, KoSvgTextCharacterInfo::middle, CharacterResult::middle, CharacterResult::rotate, KoSvgTextCharacterInfo::rotateDeg, KoSvgTextCharacterInfo::rtl, CursorInfo::rtl, KoSvgTextCharacterInfo::visualIndex, and CharacterResult::visualIndex.

◆ inheritProperties()

KoSvgTextProperties inheritProperties ( KisForest< KoSvgTextContentElement >::depth_first_tail_iterator it)

Definition at line 966 of file KoSvgTextShape.cpp.

966 {
968 for (auto parentIt = KisForestDetail::hierarchyBegin(siblingCurrent(it));
969 parentIt != KisForestDetail::hierarchyEnd(siblingCurrent(it)); parentIt++) {
970 hierarchy.append(parentIt);
971 }
973 while (!hierarchy.isEmpty()) {
974 auto it = hierarchy.takeLast();
975 KoSvgTextProperties p = it->properties;
976 p.inheritFrom(props, true);
977 props = p;
978 }
979 return props;
980}
const Params2D p
static const KoSvgTextProperties & defaultProperties()
ResultIterator hierarchyBegin(Iterator it)
Definition KisForest.h:419
ResultIterator hierarchyEnd(Iterator it)
Definition KisForest.h:427
ChildIterator< value_type, is_const > siblingCurrent(ChildIterator< value_type, is_const > it)
Definition KisForest.h:240

References KoSvgTextProperties::defaultProperties(), KisForestDetail::hierarchyBegin(), KisForestDetail::hierarchyEnd(), and p.