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 1486 of file KoSvgTextShape.cpp.

1486 {
1487 for (auto child = KisForestDetail::childBegin(parent); child != KisForestDetail::childEnd(parent); child++) {
1488 if (child->properties.hasProperty(propertyId)) {
1489 return child;
1490 } else if (KisForestDetail::childBegin(child) != KisForestDetail::childEnd(child)) {
1491 auto found = findNodeIndexForPropertyIdImpl(child, propertyId);
1492 if (found != child) {
1493 return found;
1494 }
1495 }
1496 }
1497 return parent;
1498}
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 1431 of file KoSvgTextShape.cpp.

1431 {
1433 info.finalPos = res.finalPosition;
1435 info.visualIndex = res.visualIndex;
1436 info.middle = res.middle;
1437 info.advance = res.advance;
1438 info.logicalIndex = index;
1439 info.rtl = res.cursorInfo.rtl;
1440 info.metrics = res.metrics;
1441 return info;
1442}
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 996 of file KoSvgTextShape.cpp.

996 {
998 for (auto parentIt = KisForestDetail::hierarchyBegin(siblingCurrent(it));
999 parentIt != KisForestDetail::hierarchyEnd(siblingCurrent(it)); parentIt++) {
1000 hierarchy.append(parentIt);
1001 }
1003 while (!hierarchy.isEmpty()) {
1004 auto it = hierarchy.takeLast();
1005 KoSvgTextProperties p = it->properties;
1006 p.inheritFrom(props, true);
1007 props = p;
1008 }
1009 return props;
1010}
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.