|
Krita Source Code Documentation
|
#include <KoSvgTextShape.h>
Inheritance diagram for KoSvgTextShape:Classes | |
| struct | BulkActionState |
| struct | TextCursorChangeListener |
| ShapeChangeListener so we can inform any text cursors that the cursor needs updating. More... | |
Public Types | |
| enum class | DebugElement { CharBbox = 1 << 0 , LineBox = 1 << 1 } |
| enum | InternalShapeState { Decorative , ShapeInside , ShapeSubtract , TextPath } |
| enum | TextType { PrePositionedText = 0 , PreformattedText , InlineWrap , TextInShape } |
Public Types inherited from KoShape | |
| enum | ChangeType { PositionChanged , RotationChanged , ScaleChanged , ShearChanged , SizeChanged , GenericMatrixChange , KeepAspectRatioChange , ParentChanged , Deleted , StrokeChanged , BackgroundChanged , BorderChanged , ParameterChanged , ContentChanged , TextContourMarginChanged , ChildChanged , ConnectionPointChanged , ClipPathChanged , ClipMaskChanged , TransparencyChanged } |
| Used by shapeChanged() to select which change was made. More... | |
| enum | ChildZOrderPolicy { ChildZDefault , ChildZParentChild = ChildZDefault , ChildZPassThrough } |
| Used by compareShapeZIndex() to order shapes. More... | |
| enum | PaintOrder { Fill , Stroke , Markers } |
Public Member Functions | |
| void | addShapeContours (QList< KoShape * > shapes, const bool inside=true) |
| addShapesContours Add shapes to the contours that make up the wrapping area. | |
| void | addTextPathAtEnd (KoShape *textPath) |
| addTextPathAtEnd add a textpath node at the end of the text. | |
| void | applyTextLength (KisForest< KoSvgTextContentElement >::child_iterator currentTextElement, QVector< CharacterResult > &result, int ¤tIndex, int &resolvedDescendentNodes, bool isHorizontal, const KoSvgTextProperties resolvedProps, const KoSvgText::ResolutionHandler &resHandler) |
| void | applyWhiteSpace (KisForest< KoSvgTextContentElement > &tree, const bool convertToPreWrapped=false) |
| applyWhiteSpace CSS Whitespace processes whitespaces so that duplicate white spaces and unnecessary hard breaks get removed from the text. Within the text layout we avoid removing the white spaces. However, when converting between text types it can be useful to remove these spaces. This function actually applies the white space rule to the active text. | |
| void | applyWhiteSpaceImpl (std::reverse_iterator< KisForest< KoSvgTextContentElement >::child_iterator > current, QVector< bool > &collapsed, QString &allText, const bool convertToPreWrapped) |
| QSharedPointer< KoShapeBackground > | background () const override |
| QRectF | boundingRect () const override |
| Get the bounding box of the shape. | |
| void | cleanUp () |
| Cleans up the internal text data. Used by undo commands. | |
| void | clearAssociatedOutlines () |
| KoShape * | cloneShape () const override |
| creates a deep copy of the shape or shape's subtree | |
| KoShape * | collectPaths (const KoShape *rootShape, QVector< CharacterResult > &result, int ¤tIndex) |
| void | computeTextDecorations (KisForest< KoSvgTextContentElement >::child_iterator currentTextElement, const QVector< CharacterResult > &result, const QMap< int, int > &logicalToVisual, const KoSvgText::ResolutionHandler resHandler, KoPathShape *textPath, qreal textPathoffset, bool side, int ¤tIndex, bool isHorizontal, bool ltr, bool wrapping, const KoSvgTextProperties resolvedProps, QList< KoShape * > textPaths) |
| void | convertCharTransformsToPreformatted (bool makeInlineSize=false) |
| convertCharTransformsToPreformatted Converts the text to a preformatted SVG 2.0 text. This changes the textType(); | |
| std::unique_ptr< KoSvgTextShape > | copyRange (int index, int length) const |
| copyRange Copy the rich text for the given range. | |
| KoSvgTextNodeIndex | createTextNodeIndex (KisForest< KoSvgTextContentElement >::child_iterator textElement) const |
| QPainterPath | cursorForPos (int pos, QLineF &caret, QColor &color, double bidiFlagSize=1.0) |
| cursorForPos returns the QPainterPath associated with this cursorPosition. | |
| void | debugParsing () |
| Outputs debug with the current textData tree. | |
| QRectF | endBulkAction () override |
| void | enterNodeSubtree () |
| Set the current node to its first child, entering the subtree. | |
| KoSvgTextNodeIndex | findNodeIndexForPropertyId (KoSvgTextProperties::PropertyId propertyId) |
| findNodeIndexForPropertyId | |
| QPair< int, int > | findRangeForNodeIndex (const KoSvgTextNodeIndex &node) const |
| findRangeForNodeIndex Find the start and end cursor position for a given nodeIndex. | |
| bool | fontMatchingDisabled () const |
| fontMatchingDisabled | |
| QMap< KoSvgText::TextDecoration, QPainterPath > | generateDecorationPaths (const int &start, const int &end, const KoSvgText::ResolutionHandler resHandler, const QVector< CharacterResult > &result, const bool isHorizontal, const KoSvgText::TextDecorations &decor, const KoSvgText::TextDecorationStyle style=KoSvgText::TextDecorationStyle::Solid, const bool textDecorationSkipInset=false, const KoPathShape *currentTextPath=nullptr, const qreal currentTextPathOffset=0.0, const bool textPathSide=false, const KoSvgText::TextDecorationUnderlinePosition underlinePosH=KoSvgText::TextDecorationUnderlinePosition::UnderlineAuto, const KoSvgText::TextDecorationUnderlinePosition underlinePosV=KoSvgText::TextDecorationUnderlinePosition::UnderlineAuto) |
| KoSvgTextShapeMementoSP | getMemento () |
| Get a memento holding the current textdata and layout info. | |
| QList< KoSvgTextCharacterInfo > | getPositionsAndRotationsForRange (const int startPos, const int endPos) const |
| getPositionsAndRotationsForRange | |
| void | handleShapes (const QList< KoShape * > &sourceShapeList, const QList< KoShape * > referenceList2, const QList< KoShape * > referenceShapeList, QList< KoShape * > &destinationShapeList) |
| int | indexForPos (int pos) const |
| indexForPos get the string index for a given cursor position. | |
| QPointF | initialTextPosition () const |
| initialTextPosition Returns the initial text position as per SVG algorithm. The eventual result of this can include transforms or repositioning due to text shapes. | |
| bool | insertRichText (int pos, const KoSvgTextShape *richText, bool inheritPropertiesIfPossible=false) |
| insertRichText Insert rich text at the given cursor pos. This will first split contents at the given pos before inserting the new rich text. | |
| bool | insertText (int pos, QString text) |
| insertText Insert a text somewhere in the KoTextShape. | |
| KoShapeManager * | internalShapeManager () const |
| internalShapeManager | |
| QList< KoShape * > | internalShapes () const |
| KoSvgTextShape () | |
| KoSvgTextShape (const KoSvgTextShape &rhs) | |
| void | leaveNodeSubtree () |
| Set the current node to its parent, leaving the subtree. | |
| int | lineEnd (int pos) |
| lineEnd return the 'line end' for this pos. This uses anchored chunks, so each absolute x, y posititioning will be considered a line-start. | |
| int | lineStart (int pos) |
| lineStart return the 'line start' for this pos. This uses anchored chunks, so each absolute x, y posititioning will be considered a line-start. | |
| void | mergePropertiesIntoRange (const int startPos, const int endPos, const KoSvgTextProperties properties, const QSet< KoSvgTextProperties::PropertyId > removeProperties=QSet< KoSvgTextProperties::PropertyId >()) |
| mergePropertiesIntoRange Merge given properties into the given range. This will first split the nodes at the two range ends, and then merge in the properties into each leaf node. Won't do anything when startPos == endPos | |
| void | moveShapeInsideToIndex (KoShape *shapeInside, const int index) |
| moveShapeInsideToIndex Because the order of shapes inside shape-inside affects the text layout, it can be useful to be able to reorder them. | |
| int | nextIndex (int pos) |
| nextIndex Return the first cursor position with a higher string index. | |
| int | nextLine (int pos) |
| nextLine get a position on the next line for this position. | |
| KoSvgTextNodeIndex | nodeForTextPath (KoShape *textPath) const |
| nodeForTextPath TextPaths are set on toplevel content elements. This function allows for searching which node has said textPath, which should be less clunky than running topLevelNodeForPos for every pos. | |
| void | notifyCursorPosChanged (int pos, int anchor) |
| Notify that the cursor position has changed. | |
| void | notifyMarkupChanged () |
| Notify that the markup has changed. | |
| QPainterPath | outline () const override |
| QRectF | outlineRect () const override |
| void | paint (QPainter &painter) const override |
Paint the shape fill The class extending this one is responsible for painting itself. painter is expected to be preconfigured to work in "document" pixels. | |
| void | paintDebug (QPainter &painter, const QVector< CharacterResult > &result, int ¤tIndex) |
| void | paintDebug (QPainter &painter, DebugElements elements) const |
| QVector< PaintOrder > | paintOrder () const override |
| paintOrder | |
| void | paintPaths (QPainter &painter, const QPainterPath &outlineRect, const KoShape *rootShape, const QVector< CharacterResult > &result, const KoSvgText::TextRendering rendering, QPainterPath &chunk, int ¤tIndex) |
| void | paintStroke (QPainter &painter) const override |
| paintStroke paints the shape's stroked outline | |
| void | paintTextDecoration (QPainter &painter, const QPainterPath &outlineRect, const KoShape *rootShape, const KoSvgText::TextDecoration type, const KoSvgText::TextRendering rendering) |
| QString | plainText () |
| plainText plain text of all text inside this text shape, without the bidi controls or any transforms. | |
| int | posDown (int pos, bool visual=false) |
| return position below. | |
| int | posForIndex (int index, bool firstIndex=false, bool skipSynthetic=false) const |
| posForIndex Get the cursor position for a given index in a string. | |
| int | posForPoint (QPointF point, int start=-1, int end=-1, bool *overlaps=nullptr) |
| posForPoint Finds the closest cursor position for the given point in shape coordinates. | |
| int | posForPointLineSensitive (QPointF point) |
| posForPointLineSensitive When clicking on an empty space in a wrapped text, it is preferable to have the caret be at the end of the line visually associated with that empty space than the positions above or below that might be closer. | |
| int | posLeft (int pos, bool visual=false) |
| int | posRight (int pos, bool visual=false) |
| int | posUp (int pos, bool visual=false) |
| return position above. | |
| int | previousIndex (int pos) |
| previousIndex Return the first pos which has a lower string index. | |
| int | previousLine (int pos) |
| previousLine get a position on the previous line for this position. | |
| Private () | |
| Private (const Private &rhs) | |
| KoSvgTextProperties | propertiesForPos (const int pos, bool inherited=false) const |
| Return the properties at a given position. | |
| QList< KoSvgTextProperties > | propertiesForRange (const int startPos, const int endPos, bool inherited=false) const |
| propertiesForRange get the properties for a range. | |
| Q_DECLARE_FLAGS (DebugElements, DebugElement) | |
| void | relayout () |
| void | relayout () const |
| bool | relayoutIsBlocked () const |
| relayoutIsBlocked | |
| void | removeShapesFromContours (QList< KoShape * > shapes, bool callUpdate=true, bool cleanup=true) |
| removeShapesFromContours Remove list of shapes from any of the internal lists. | |
| bool | removeText (int &index, int &length) |
| removeText Where insert text explicitly uses a cursorposition, remove text uses a string index. It will modify these values so that... | |
| void | removeTransformsFromRange (const int startPos, const int endPos) |
| bool | saveHtml (HtmlSavingContext &context) |
| bool | saveSvg (SvgSavingContext &context) override |
| Saves SVG data. | |
| QPainterPath | selectionBoxes (int pos, int anchor) |
| selectionBoxes returns all selection boxes for a given range. Range will be normalized internally. | |
| void | setBackground (QSharedPointer< KoShapeBackground > background) override |
| void | setCharacterTransformsFromLayout () |
| setCharacterTransformsFromLayout Converts the text to a prepositioned SVG 1.1 text. This changes the textType(); | |
| bool | setCharacterTransformsOnRange (const int startPos, const int endPos, const QVector< QPointF > positions, const QVector< qreal > rotateDegrees, const bool deltaPosition=true) |
| setCharacterTransformsOnRange Set SVG 1.1 style character transforms on the given range. Will not work when the shape is auto wrapping. | |
| void | setFontMatchingDisabled (const bool disable) |
| setDisableFontMatching | |
| void | setMemento (const KoSvgTextShapeMementoSP memento) |
| Set the text data and layout info, reset listening cursors to 0. | |
| void | setMemento (const KoSvgTextShapeMementoSP memento, int pos, int anchor) |
| Set the text data, layout info and also adjust any listening cursors. | |
| void | setPaintOrder (PaintOrder first, PaintOrder second) override |
| setPaintOrder set the paint order. As there's only three entries in any given paintorder, you only need to have the first and second entry to set it. | |
| void | setPropertiesAtPos (int pos, KoSvgTextProperties properties) |
| setPropertiesAtPos will set the properties at pos. | |
| void | setRelayoutBlocked (const bool disable) |
| void | setResolution (qreal xRes, qreal yRes) override |
| void | setShapesInside (QList< KoShape * > shapesInside) |
| setShapesInside | |
| void | setShapesSubtract (QList< KoShape * > shapesSubtract) |
| setShapesSubtract | |
| void | setSize (const QSizeF &size) override |
| Resize the shape. | |
| void | setStroke (KoShapeStrokeModelSP stroke) override |
| bool | setTextPathOnRange (KoShape *textPath, const int startPos=-1, const int endPos=-1) |
| setTextPathOnRange Set a text path on the specified range. In SVG text paths are always at the first child. | |
| void | setTransformsFromLayout (KisForest< KoSvgTextContentElement > &tree, const QVector< CharacterResult > layout) |
| void | setTransformsFromLayoutImpl (KisForest< KoSvgTextContentElement >::child_iterator current, const KoSvgTextProperties parentProps, const QVector< CharacterResult > layout, int &globalIndex, bool isHorizontal) |
| bool | shapeInContours (KoShape *shape) |
| shapeInContours | |
| QList< KoShape * > | shapesInside () const |
| shapesInside | |
| QList< KoShape * > | shapesSubtract () const |
| shapesSubtract | |
| QMap< QString, QString > | shapeTypeSpecificStyles (SvgSavingContext &context) const |
| bool | singleNode () const |
| singleNode Sometimes it is useful to know whether there's only a single text node for UX purposes. | |
| QSizeF | size () const override |
| Get the size of the shape in pt. | |
| void | startBulkAction () override |
| KoShapeStrokeModelSP | stroke () const override |
| KoShape * | textOutline () const |
| textOutline This turns the text object into non-text KoShape(s) to the best of its abilities. | |
| QList< KoShape * > | textPathsAtRange (const int startPos=-1, const int endPos=-1) |
| textPathsAtRange Get a list of textPaths at the given range. This includes textPaths whose node is only partially overlapped by the range. | |
| KoSvgTextProperties | textProperties () const |
| TextType | textType () const |
| textType This enum gives an indication of what kind of text this shape is. The different text types are a bit blurry as SVG allows a mixutre to provide fallback information. When such fallback is in place, this will only return the primary text type, that is, TextInShape before InlineWrap and InlineWrap before PrePositioned/Preformatted. This primarily exists to give UI feedback. | |
| QList< QPainterPath > | textWrappingAreas () const |
| textWrappingAreas The text wrapping areas are computed from shapesInside() and shapesSubtract(), as well as the text properties ShapeMargin and ShapePadding. This returns the computed wrapping areas, in the local coordinates of the shape. | |
| KoSvgTextNodeIndex | topLevelNodeForPos (int pos) const |
| topLevelNodeForPos Get, if possible, an index for the child element of the root at pos. If not possible, returns an index for the root. This is used primarily for text-on-path. | |
| QPainterPath | underlines (int pos, int anchor, KoSvgText::TextDecorations decor, KoSvgText::TextDecorationStyle style, qreal minimum, bool thick) |
| void | updateInternalShapesList () |
| void | updateShapeGroup () |
| void | updateTextWrappingAreas () |
| updateShapeContours The current shape contours can be slow to compute, so this function calls computing them, and then calls relayout(); | |
| int | wordEnd (int pos) |
| wordEnd return the pos of the first wordbreak. | |
| int | wordLeft (int pos, bool visual=false) |
| wordLeft return the cursorpos for the word left or the extreme of the line. | |
| int | wordRight (int pos, bool visual=false) |
| wordRight return the cursorpos for the word right or the extreme of the line. | |
| int | wordStart (int pos) |
| wordStart return the first pos before a wordbreak in the start direction. | |
| KoSvgText::WritingMode | writingMode () const |
| writingMode There's a number of places we need to check the writing mode to provide proper controls. | |
| ~KoSvgTextShape () override | |
| ~Private () | |
Public Member Functions inherited from KoShape | |
| QRectF | absoluteOutlineRect () const |
| QPointF | absolutePosition (KoFlake::AnchorPosition anchor=KoFlake::Center) const |
| QTransform | absoluteTransformation () const |
| bool | addDependee (KoShape *shape) |
| QString | additionalAttribute (const QString &name) const |
| void | addShapeChangeListener (ShapeChangeListener *listener) |
| KoShapeAnchor * | anchor () const |
| void | applyAbsoluteTransformation (const QTransform &matrix) |
| void | applyTransformation (const QTransform &matrix) |
| virtual ChildZOrderPolicy | childZOrderPolicy () |
| KoClipMask * | clipMask () const |
| Returns the currently set clip mask or 0 if there is no clip mask set. | |
| KoClipPath * | clipPath () const |
| Returns the currently set clip path or 0 if there is no clip path set. | |
| KoShape * | cloneShapeAndBakeAbsoluteTransform () const |
creates a deep copy of the shape/shapes tree and bakes the absolute transform of this into the resulting shape. | |
| void | copySettings (const KoShape *shape) |
| QList< KoShape * > | dependees () const |
| Returns list of shapes depending on this shape. | |
| QPointF | documentToShape (const QPointF &point) const |
| Transforms point from document coordinates to shape coordinates. | |
| QRectF | documentToShape (const QRectF &rect) const |
| Transform rect from document coordinates to shape coordinates. | |
| bool | hasAdditionalAttribute (const QString &name) const |
| bool | hasCommonParent (const KoShape *shape) const |
| bool | hasDependee (KoShape *shape) const |
| Returns if the given shape is dependent on this shape. | |
| virtual bool | hasTransparency () const |
| virtual bool | hitTest (const QPointF &position) const |
| Check if the shape is hit on position. | |
| QString | hyperLink () const |
| bool | inheritBackground () const |
| inheritBackground shows if the shape inherits background from its parent | |
| bool | inheritPaintOrder () const |
| inheritPaintOrder | |
| bool | inheritsTransformFromAny (const QList< KoShape * > ancestorsInQuestion) const |
inheritsTransformFromAny checks if the shape inherits transformation from any of the shapes listed in ancestorsInQuestion. The inheritance is checked in recursive way. | |
| bool | inheritStroke () const |
| inheritStroke shows if the shape inherits the stroke from its parent | |
| bool | isContentProtected () const |
| bool | isGeometryProtected () const |
| bool | isPrintable () const |
| bool | isSelectable () const |
| virtual bool | isShapeEditable (bool recursive=true) const |
| checks recursively if the shape or one of its parents is not visible or locked | |
| bool | isVisible (bool recursive=true) const |
| bool | keepAspectRatio () const |
| KoShape () | |
| Constructor. | |
| qreal | minimumHeight () const |
| QString | name () const |
| void | notifyChanged () |
| virtual void | paintMarkers (QPainter &painter) const |
| paintStroke paints the shape's markers | |
| KoShapeContainer * | parent () const |
| QPointF | position () const |
| Get the position of the shape in pt. | |
| void | removeAdditionalAttribute (const QString &name) |
| void | removeAdditionalStyleAttribute (const char *name) |
| void | removeDependee (KoShape *shape) |
| void | removeShapeChangeListener (ShapeChangeListener *listener) |
| void | rotate (qreal angle) |
| Rotate the shape (relative) | |
| qreal | rotation () const |
| void | scale (qreal sx, qreal sy) |
| Scale the shape using the zero-point which is the top-left corner. | |
| void | setAbsolutePosition (const QPointF &newPosition, KoFlake::AnchorPosition anchor=KoFlake::Center) |
| void | setAdditionalAttribute (const QString &name, const QString &value) |
| void | setAdditionalStyleAttribute (const char *name, const QString &value) |
| void | setAnchor (KoShapeAnchor *anchor) |
| void | setClipMask (KoClipMask *clipMask) |
| Sets a new clip mask, removing the old one. The mask is owned by the shape. | |
| void | setClipPath (KoClipPath *clipPath) |
| Sets a new clip path, removing the old one. | |
| void | setContentProtected (bool protect) |
| void | setGeometryProtected (bool on) |
| void | setHyperLink (const QString &hyperLink) |
| void | setInheritBackground (bool value) |
| setInheritBackground marks a shape as inheriting the background from the parent shape. NOTE: The currently selected background is destroyed. | |
| void | setInheritPaintOrder (bool value) |
| setInheritPaintOrder set inherit paint order. | |
| void | setInheritStroke (bool value) |
| setInheritStroke marks a shape as inheriting the stroke from the parent shape. NOTE: The currently selected stroke is destroyed. | |
| void | setKeepAspectRatio (bool keepAspect) |
| void | setMinimumHeight (qreal height) |
| void | setName (const QString &name) |
| void | setParent (KoShapeContainer *parent) |
| virtual void | setPosition (const QPointF &position) |
| Set the position of the shape in pt. | |
| void | setPrintable (bool on) |
| void | setSelectable (bool selectable) |
| void | setShapeId (const QString &id) |
| void | setToolDelegates (const QSet< KoShape * > &delegates) |
| void | setTransformation (const QTransform &matrix) |
| void | setTransparency (qreal transparency) |
| void | setUserData (KoShapeUserData *userData) |
| void | setVisible (bool on) |
| void | setZIndex (qint16 zIndex) |
| QString | shapeId () const |
| QPointF | shapeToDocument (const QPointF &point) const |
| Transforms point from shape coordinates to document coordinates. | |
| QRectF | shapeToDocument (const QRectF &rect) const |
| Transforms rect from shape coordinates to document coordinates. | |
| void | shear (qreal sx, qreal sy) |
| Shear the shape The shape will be sheared using the zero-point which is the top-left corner. | |
| virtual KoSnapData | snapData () const |
| Returns additional snap data the shape wants to have snapping to. | |
| KoInsets | strokeInsets () const |
| QSet< KoShape * > | toolDelegates () const |
| QTransform | transformation () const |
| Returns the shapes local transformation matrix. | |
| qreal | transparency (bool recursive=false) const |
| virtual void | update () const |
| virtual void | updateAbsolute (const QRectF &rect) const |
| KoShapeUserData * | userData () const |
| virtual void | waitUntilReady (bool asynchronous=true) const |
| qint16 | zIndex () const |
| virtual | ~KoShape () |
| Destructor. | |
Public Member Functions inherited from SvgShape | |
| virtual bool | loadSvg (const QDomElement &element, SvgLoadingContext &context) |
| Loads data from specified svg element. | |
| void | saveMetadata (SvgSavingContext &context) |
| virtual | ~SvgShape () |
Public Member Functions inherited from KoShapeBulkActionInterface | |
| virtual | ~KoShapeBulkActionInterface ()=default |
Static Public Member Functions | |
| static qreal | anchoredChunkShift (const QVector< CharacterResult > &result, const bool isHorizontal, const int start, int &end) |
| static void | applyAnchoring (QVector< CharacterResult > &result, bool isHorizontal, const KoSvgText::ResolutionHandler resHandler) |
| static void | applyTextPath (KisForest< KoSvgTextContentElement >::child_iterator parent, QVector< CharacterResult > &result, bool isHorizontal, QPointF &startPos, const KoSvgTextProperties resolvedProps, QList< KoShape * > textPaths) |
| static qreal | characterResultOnPath (CharacterResult &cr, qreal length, qreal offset, bool isHorizontal, bool isClosed) |
| static int | childCount (KisForest< KoSvgTextContentElement >::child_iterator it) |
| Get the child count of the current node. A node without children is a text node. | |
| static void | cleanUp (KisForest< KoSvgTextContentElement > &tree) |
| cleanUp This cleans up the tree by... | |
| static QVector< bool > | collapsedWhiteSpacesForText (KisForest< KoSvgTextContentElement > &tree, QString &allText, const bool alsoCollapseLowSurrogate=false, bool includeBidiControls=false) |
| collapsedWhiteSpacesForText This returns the collapsed spaces for a given piece of text, without transforms. | |
| static QVector< SubChunk > | collectSubChunks (KisForest< KoSvgTextContentElement >::child_iterator it, KoSvgTextProperties parent, bool textInPath, bool &firstTextInPath) |
| static void | computeFontMetrics (KisForest< KoSvgTextContentElement >::child_iterator parent, const KoSvgTextProperties &parentProps, const KoSvgText::FontMetrics &parentBaselineTable, const KoSvgText::Baseline parentBaseline, QVector< CharacterResult > &result, int ¤tIndex, const KoSvgText::ResolutionHandler resHandler, const bool isHorizontal, const bool disableFontMatching) |
| static const QString & | defaultPlaceholderText () |
| static void | finalizeDecoration (QPainterPath decorationPath, const QPointF offset, const QPainterPathStroker &stroker, const KoSvgText::TextDecoration type, QMap< KoSvgText::TextDecoration, QPainterPath > &decorationPaths, const KoPathShape *currentTextPath, const bool isHorizontal, const qreal currentTextPathOffset, const bool textPathSide) |
| static KisForest< KoSvgTextContentElement >::depth_first_tail_iterator | findTextContentElementForIndex (KisForest< KoSvgTextContentElement > &tree, int ¤tIndex, int sought, bool skipZeroWidth=false) |
| findTextContentElementForIndex Finds the given leaf of the current tree-wide string index. | |
| static KisForest< KoSvgTextContentElement >::child_iterator | findTopLevelParent (KisForest< KoSvgTextContentElement >::child_iterator root, KisForest< KoSvgTextContentElement >::child_iterator child) |
| findTopLevelParent Returns the toplevel parent of child that is not root. | |
| static QList< QPainterPath > | generateShapes (const QList< KoShape * > shapesInside, const QList< KoShape * > shapesSubtract, const KoSvgTextProperties &properties) |
| static QList< QPainterPath > | generateTextAreas (const QList< KoShape * > shapesInside, const QList< KoShape * > shapesSubtract, const KoSvgTextProperties &props) |
| generateTextAreas Generates text areas with the given shapes and properties. This is used to paint previews in the PaddingMargin strategy. | |
| static QVector< QPointF > | getLigatureCarets (const KoSvgText::ResolutionHandler &resHandler, const bool isHorizontal, raqm_glyph_t ¤tGlyph) |
| static void | handleLineBoxAlignment (KisForest< KoSvgTextContentElement >::child_iterator parent, QVector< CharacterResult > &result, const QVector< LineBox > lineBoxes, int ¤tIndex, const bool isHorizontal, const KoSvgTextProperties resolvedProps) |
| static void | insertNewLinesAtAnchors (KisForest< KoSvgTextContentElement > &tree, bool shapesInside=false) |
| insertNewLinesAtAnchors Resolves character transforms and then inserts new lines at each transform that creates a new chunk. | |
| static void | insertNewLinesAtAnchorsImpl (std::reverse_iterator< KisForest< KoSvgTextContentElement >::child_iterator > current, QVector< KoSvgText::CharTransformation > &resolvedTransforms, bool &inTextPath) |
| static void | insertTransforms (KisForest< KoSvgTextContentElement > &tree, const int start, const int length, const bool allowSkipFirst) |
| insertTransforms Inserts empty transforms into tree recursively. | |
| static int | insertTransformsImpl (KisForest< KoSvgTextContentElement >::child_iterator currentTextElement, const int globalIndex, const int start, const int length, const QVector< bool > collapsedCharacters, const bool allowSkipFirst) |
| insertTransformsImpl Recursive function that handles inserting empty transforms into a given range. Used by insertTransforms. | |
| static KisForest< KoSvgTextContentElement >::child_iterator | iteratorForTreeIndex (const QVector< int > treeIndex, KisForest< KoSvgTextContentElement >::child_iterator parent) |
| static bool | loadGlyph (const KoSvgText::ResolutionHandler &resHandler, const FT_Int32 faceLoadFlags, const bool isHorizontal, const char32_t firstCodepoint, const KoSvgText::TextRendering rendering, raqm_glyph_t ¤tGlyph, CharacterResult &charResult, QPointF &totalAdvanceFTFontCoordinates) |
| static std::pair< QTransform, qreal > | loadGlyphOnly (const QTransform &ftTF, FT_Int32 faceLoadFlags, bool isHorizontal, raqm_glyph_t ¤tGlyph, CharacterResult &charResult, const KoSvgText::TextRendering rendering) |
| static void | makeTextPathNameUnique (QList< KoShape * > textPaths, KoShape *textPath) |
| static int | numChars (KisForest< KoSvgTextContentElement >::child_iterator parent, bool withControls=false, KoSvgTextProperties resolvedProps=KoSvgTextProperties::defaultProperties()) |
| Get the number of characters for the whole subtree of this node. | |
| static void | removeTextPathId (KisForest< KoSvgTextContentElement >::child_iterator parent, const QString &name) |
| removeTextPathId Remove the text path id with the given name from the toplevel elements. | |
| static void | removeTransforms (KisForest< KoSvgTextContentElement > &tree, const int start, const int length) |
| removeTransforms Remove all local SVG character transforms in a certain range. Local transforms are influenced by whitespace collapse and whether they are set to unicode codepoints, and they also accumulate from parent to child. This function removes all local transforms in a certain section. | |
| static int | removeTransformsImpl (KisForest< KoSvgTextContentElement >::child_iterator currentTextElement, const int globalIndex, const int start, const int length, const QVector< bool > collapsedCharacters) |
| removeTransformsImpl recursive function that handles removing local transforms in a certain range. Used by removeTransform. | |
| static QVector< KoSvgText::CharTransformation > | resolvedTransformsForTree (KisForest< KoSvgTextContentElement > &tree, bool shapesInside=false, bool includeBidiControls=false) |
| static void | resolveTransforms (KisForest< KoSvgTextContentElement >::child_iterator currentTextElement, QString text, QVector< CharacterResult > &result, int ¤tIndex, bool isHorizontal, bool wrapped, bool textInPath, QVector< KoSvgText::CharTransformation > &resolved, QVector< bool > collapsedChars, const KoSvgTextProperties resolvedProps, bool withControls=true) |
| static bool | splitContentElement (KisForest< KoSvgTextContentElement > &tree, int index, bool allowEmptyText=true) |
| splitContentElement split the contentElement in tree at index into two nodes. | |
| static void | splitTree (KisForest< KoSvgTextContentElement > &tree, int index, bool textPathAfterSplit) |
| splitTree Split the whole hierarchy of nodes at the given index. | |
| static bool | startIndexOfIterator (KisForest< KoSvgTextContentElement >::child_iterator parent, KisForest< KoSvgTextContentElement >::child_iterator target, int ¤tIndex) |
| static QPainterPath | stretchGlyphOnPath (const QPainterPath &glyph, const QPainterPath &path, bool isHorizontal, qreal offset, bool isClosed) |
| static KoShape * | textPathByName (QString name, QList< KoShape * > textPaths) |
Static Public Member Functions inherited from KoShape | |
| static QRectF | absoluteOutlineRect (const QList< KoShape * > &shapes) |
| static QRectF | boundingRect (const QList< KoShape * > &shapes) |
| static bool | compareShapeZIndex (KoShape *s1, KoShape *s2) |
| static KisHandlePainterHelper | createHandlePainterHelperDocument (QPainter *painter, KoShape *shape, qreal handleRadius, int decorationThickness) |
| static KisHandlePainterHelper | createHandlePainterHelperView (QPainter *painter, KoShape *shape, const KoViewConverter &converter, qreal handleRadius=0.0, int decorationThickness=1) |
| static QVector< PaintOrder > | defaultPaintOrder () |
| default paint order as per SVG specification | |
| static QList< KoShape * > | linearizeSubtree (const QList< KoShape * > &shapes) |
| static QList< KoShape * > | linearizeSubtreeSorted (const QList< KoShape * > &shapes) |
Public Attributes | |
| std::optional< BulkActionState > | bulkActionState |
| QList< QPainterPath > | currentTextWrappingAreas |
| QVector< CursorPos > | cursorPos |
| bool | disableFontMatching = false |
| Turn off font matching, which should speed up relayout slightly. | |
| QPointF | initialTextPosition = QPointF() |
| QScopedPointer< KoShapePainter > | internalShapesPainter |
| bool | isBidi = false |
| bool | isLoading = false |
| Turned on when loading in text data, blocks updates to shape listeners. | |
| QVector< LineBox > | lineBoxes |
| QMap< int, int > | logicalToVisualCursorPos |
| QString | plainText |
| QVector< CharacterResult > | result |
| QScopedPointer< KoShapeGroup > | shapeGroup |
| QList< KoShape * > | shapesInside |
| QList< KoShape * > | shapesSubtract |
| KisForest< KoSvgTextContentElement > | textData |
| QList< KoShape * > | textPaths |
| int | xRes = 72 |
| int | yRes = 72 |
Protected Member Functions | |
| void | shapeChanged (ChangeType type, KoShape *shape) override |
Protected Member Functions inherited from KoShape | |
| KoShape (const KoShape &rhs) | |
| QList< ShapeChangeListener * > | listeners () const |
| void | setSizeImpl (const QSizeF &size) const |
| void | shapeChangedPriv (KoShape::ChangeType type) |
| QTransform | transform () const |
| return the current matrix that contains the rotation/scale/position of this shape | |
Private Member Functions | |
| QPainterPath | defaultCursorShape () |
| defaultCursorShape This returns a default cursor shape for when there's no text inside the text shape. | |
| int | nextPos (int pos, bool visual) |
| nextPos get the next position. | |
| int | previousPos (int pos, bool visual) |
| previousPos get the previous position. | |
| void | setMementoImpl (const KoSvgTextShapeMementoSP memento) |
Private Member Functions inherited from KoShape::Private | |
| Private () | |
| Private (const Private &rhs)=delete | |
Private Attributes | |
| QScopedPointer< Private > | d |
Private Attributes inherited from KoShape::Private | |
| QList< KoShape * > | dependees |
| list of shape dependent on this shape | |
| DependeesLifetimeListener | dependeesLifetimeListener |
| QList< KoShape::ShapeChangeListener * > | listeners |
| KoShapeContainer * | parent = nullptr |
| QSet< KoShapeManager * > | shapeManagers |
| QSet< KoShape * > | toolDelegates |
Friends | |
| class | KoSvgTextLoader |
| class | TestSvgText |
Additional Inherited Members | |
Static Public Attributes inherited from KoShape | |
| static const qint16 | maxZIndex = std::numeric_limits<qint16>::max() |
| static const qint16 | minZIndex = std::numeric_limits<qint16>::min() |
KoSvgTextShape is a root chunk of the <text> element subtree.
Definition at line 32 of file KoSvgTextShape.h.
|
strong |
| Enumerator | |
|---|---|
| CharBbox | |
| LineBox | |
Definition at line 53 of file KoSvgTextShape.h.
| Enumerator | |
|---|---|
| Decorative | |
| ShapeInside | |
| ShapeSubtract | |
| TextPath | |
Definition at line 451 of file KoSvgTextShape_p.h.
Definition at line 76 of file KoSvgTextShape.h.
| KoSvgTextShape::KoSvgTextShape | ( | ) |
Definition at line 138 of file KoSvgTextShape.cpp.
References d, KoSvgTextShape_SHAPEID, KoShape::setShapeId(), KoShape::transformation(), and KoShape::updateAbsolute().
| KoSvgTextShape::KoSvgTextShape | ( | const KoSvgTextShape & | rhs | ) |
Definition at line 148 of file KoSvgTextShape.cpp.
References KoShape::addDependee(), d, KoSvgTextShape_SHAPEID, KoShape::setShapeId(), KoShape::transformation(), and KoShape::updateAbsolute().
|
override |
Definition at line 160 of file KoSvgTextShape.cpp.
References internalShapeManager(), and KoShape::removeDependee().
|
inline |
Definition at line 496 of file KoSvgTextShape_p.h.
addShapesContours Add shapes to the contours that make up the wrapping area.
| shapes | – shapes to add. |
| inside | – whether to add to shapesInside or shapesSubtract. If a shape is already in one list, adding them will cause them to be moved to the other list. |
Definition at line 2336 of file KoSvgTextShape.cpp.
References KoShape::addDependee(), KoShape::ContentChanged, d, KoShape::name(), KoShape::notifyChanged(), KoShape::shapeChangedPriv(), and KoShape::update().
addTextPathAtEnd add a textpath node at the end of the text.
| textPath | – text path to add. |
Definition at line 2525 of file KoSvgTextShape.cpp.
References KoShape::addDependee(), d, KoShape::name(), and KoSvgTextContentElement::textPathId.
|
static |
|
static |
| void KoSvgTextShape::applyTextLength | ( | KisForest< KoSvgTextContentElement >::child_iterator | currentTextElement, |
| QVector< CharacterResult > & | result, | ||
| int & | currentIndex, | ||
| int & | resolvedDescendentNodes, | ||
| bool | isHorizontal, | ||
| const KoSvgTextProperties | resolvedProps, | ||
| const KoSvgText::ResolutionHandler & | resHandler ) |
|
static |
|
inline |
applyWhiteSpace CSS Whitespace processes whitespaces so that duplicate white spaces and unnecessary hard breaks get removed from the text. Within the text layout we avoid removing the white spaces. However, when converting between text types it can be useful to remove these spaces. This function actually applies the white space rule to the active text.
| tree | – tree to apply the whitespace rule onto. |
| convertToPreWrapped | – switch all whitespace rules to pre-wrapped. |
Definition at line 1057 of file KoSvgTextShape_p.h.
References KisForestDetail::Forest< T >::childBegin(), KisForestDetail::Forest< T >::childEnd(), KoSvgText::Preserve, KoSvgTextProperties::TextCollapseId, KoSvgTextProperties::TextWrapId, and KoSvgText::Wrap.
|
inline |
Definition at line 1073 of file KoSvgTextShape_p.h.
References KoSvgTextProperties::TextCollapseId, and KoSvgTextProperties::TextWrapId.
|
overridevirtual |
Return the brush used to paint the background of this shape with. A QBrush can have a plain color, be fully transparent or have a complex fill. setting such a brush will allow the shape to fill itself using that brush and will be able to tell if its transparent or not.
Reimplemented from KoShape.
Definition at line 1541 of file KoSvgTextShape.cpp.
References d, KoSvgTextProperties::FillId, KoSvgTextProperties::hasProperty(), KoSvgTextProperties::properties(), KoSvgTextProperties::property(), and KisForestDetail::size().
|
overridevirtual |
Get the bounding box of the shape.
This includes the line width of the shape
Reimplemented from KoShape.
Definition at line 2075 of file KoSvgTextShape.cpp.
References KoShape::absoluteTransformation(), KoInsets::bottom, d, KisForestDetail::Enter, KoInsets::left, result, KoInsets::right, stroke(), KoSvgTextProperties::StrokeId, and KoInsets::top.
|
static |
|
inlinestatic |
Get the child count of the current node. A node without children is a text node.
Definition at line 706 of file KoSvgTextShape_p.h.
References KisForestDetail::childBegin(), and KisForestDetail::childEnd().
| void KoSvgTextShape::cleanUp | ( | ) |
Cleans up the internal text data. Used by undo commands.
Definition at line 1216 of file KoSvgTextShape.cpp.
References KoShape::ContentChanged, d, KoShape::notifyChanged(), and KoShape::shapeChangedPriv().
|
inlinestatic |
cleanUp This cleans up the tree by...
| tree | – tree to clean up |
Definition at line 1266 of file KoSvgTextShape_p.h.
References KoSvgText::BidiIsolate, KoSvgText::BidiIsolateOverride, KoSvgText::BidiNormal, KisForestDetail::Forest< T >::childBegin(), KisForestDetail::Forest< T >::depthFirstTailBegin(), KisForestDetail::Forest< T >::depthFirstTailEnd(), KisForestDetail::Forest< T >::erase(), length(), KisForestDetail::Forest< T >::move(), KoSvgTextProperties::properties(), KoSvgTextProperties::setAllButNonInheritableProperties(), and KoSvgTextProperties::UnicodeBidiId.
| void KoSvgTextShape::clearAssociatedOutlines | ( | ) |
|
overridevirtual |
creates a deep copy of the shape or shape's subtree
Reimplemented from KoShape.
Definition at line 173 of file KoSvgTextShape.cpp.
References KoSvgTextShape().
|
inlinestatic |
collapsedWhiteSpacesForText This returns the collapsed spaces for a given piece of text, without transforms.
| tree | – text data tree. |
| allText | – some collapseMethods modify the text. This is a pointer that sets the modified text. |
| alsoCollapseLowSurrogate | – whether to mark utf16 surrogates as collapsed too. |
Definition at line 884 of file KoSvgTextShape_p.h.
References KoCssTextUtils::collapseSpaces(), KisForestDetail::Forest< T >::compositionBegin(), KisForestDetail::Forest< T >::compositionEnd(), KoSvgTextProperties::defaultProperties(), KoSvgTextProperties::DirectionId, KisForestDetail::Enter, KoCssTextUtils::getBidiClosing(), KoCssTextUtils::getBidiOpening(), KoSvgTextProperties::inheritFrom(), KoSvgTextProperties::properties(), KoSvgTextProperties::TextCollapseId, and KoSvgTextProperties::UnicodeBidiId.
| KoShape * KoSvgTextShape::collectPaths | ( | const KoShape * | rootShape, |
| QVector< CharacterResult > & | result, | ||
| int & | currentIndex ) |
|
static |
Return a linearized representation of a subtree of text "subchunks".
|
static |
| void KoSvgTextShape::computeTextDecorations | ( | KisForest< KoSvgTextContentElement >::child_iterator | currentTextElement, |
| const QVector< CharacterResult > & | result, | ||
| const QMap< int, int > & | logicalToVisual, | ||
| const KoSvgText::ResolutionHandler | resHandler, | ||
| KoPathShape * | textPath, | ||
| qreal | textPathoffset, | ||
| bool | side, | ||
| int & | currentIndex, | ||
| bool | isHorizontal, | ||
| bool | ltr, | ||
| bool | wrapping, | ||
| const KoSvgTextProperties | resolvedProps, | ||
| QList< KoShape * > | textPaths ) |
| void KoSvgTextShape::convertCharTransformsToPreformatted | ( | bool | makeInlineSize = false | ) |
convertCharTransformsToPreformatted Converts the text to a preformatted SVG 2.0 text. This changes the textType();
| makeInlineSize | – whether to have inline size applied. |
Definition at line 1658 of file KoSvgTextShape.cpp.
References KoSvgText::AutoValue::customValue, d, KoSvgTextProperties::hasProperty(), KoSvgText::HorizontalTB, KoSvgTextProperties::InlineSizeId, KoSvgText::AutoValue::isAuto, outlineRect(), propertiesForPos(), KoSvgTextProperties::removeProperty(), setPropertiesAtPos(), KoSvgTextProperties::setProperty(), and writingMode().
| std::unique_ptr< KoSvgTextShape > KoSvgTextShape::copyRange | ( | int | index, |
| int | length ) const |
copyRange Copy the rich text for the given range.
| index | – start string index of the range. |
| length | – length of the range. |
Definition at line 1141 of file KoSvgTextShape.cpp.
References d, KoSvgTextShape(), length(), removeText(), and size().
| KoSvgTextNodeIndex KoSvgTextShape::createTextNodeIndex | ( | KisForest< KoSvgTextContentElement >::child_iterator | textElement | ) | const |
| QPainterPath KoSvgTextShape::cursorForPos | ( | int | pos, |
| QLineF & | caret, | ||
| QColor & | color, | ||
| double | bidiFlagSize = 1.0 ) |
cursorForPos returns the QPainterPath associated with this cursorPosition.
| pos | the cursor Position |
| bidiFlagSize | – size of the bidirectional indicator. |
Definition at line 623 of file KoSvgTextShape.cpp.
References CursorInfo::caret, CursorInfo::color, CharacterResult::cursorInfo, cursorPos, d, defaultCursorShape(), CharacterResult::finalTransform(), KoSvgText::HorizontalTB, CursorInfo::offsets, p, CursorInfo::rtl, sign(), and writingMode().
| void KoSvgTextShape::debugParsing | ( | ) |
Outputs debug with the current textData tree.
Definition at line 1934 of file KoSvgTextShape.cpp.
References d, KisForestDetail::Enter, KoSvgTextProperties::FillId, KoSvgTextProperties::KraTextStyleType, KisForestDetail::Leave, KoSvgTextProperties::Opacity, KoSvgTextProperties::PaintOrder, KisForestDetail::size(), KoSvgTextProperties::StrokeId, and KoSvgTextProperties::Visibility.
|
private |
defaultCursorShape This returns a default cursor shape for when there's no text inside the text shape.
Definition at line 606 of file KoSvgTextShape.cpp.
References d, KoSvgTextProperties::fontSize(), KoSvgText::HorizontalTB, p, textProperties(), KoSvgText::CssLengthPercentage::value, and writingMode().
|
static |
Definition at line 167 of file KoSvgTextShape.cpp.
|
overridevirtual |
Ends bulk action state and performs all calculation-heavy operations over the new state. Returns a rectangle in absolute coordinates that should be updated to make these changes visible to the user.
Implements KoShapeBulkActionInterface.
Definition at line 1991 of file KoSvgTextShape.cpp.
References boundingRect(), d, KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, and relayout().
| void KoSvgTextShape::enterNodeSubtree | ( | ) |
Set the current node to its first child, entering the subtree.
Definition at line 1861 of file KoSvgTextShape.cpp.
|
static |
| KoSvgTextNodeIndex KoSvgTextShape::findNodeIndexForPropertyId | ( | KoSvgTextProperties::PropertyId | propertyId | ) |
findNodeIndexForPropertyId
Definition at line 1473 of file KoSvgTextShape.cpp.
References KisForestDetail::childBegin(), KisForestDetail::childEnd(), d, and findNodeIndexForPropertyIdImpl().
| QPair< int, int > KoSvgTextShape::findRangeForNodeIndex | ( | const KoSvgTextNodeIndex & | node | ) | const |
findRangeForNodeIndex Find the start and end cursor position for a given nodeIndex.
| node | the tree index to find the range for. |
Definition at line 1488 of file KoSvgTextShape.cpp.
References d, KoSvgTextNodeIndex::d, and posForIndex().
|
inlinestatic |
findTextContentElementForIndex Finds the given leaf of the current tree-wide string index.
| tree | – tree to search in. |
| currentIndex | – currentIndex, will always be set to the start index of the found element. |
| sought | – index sought. |
| skipZeroWidth | – whether to explicitly skip zero-width chunks. Remove text may set this to true, while inserting text into empty chunks requires this to be false. |
Definition at line 723 of file KoSvgTextShape_p.h.
References KisForestDetail::Forest< T >::depthFirstTailBegin(), KisForestDetail::Forest< T >::depthFirstTailEnd(), and length().
|
inlinestatic |
findTopLevelParent Returns the toplevel parent of child that is not root.
| root | – root under which the toplevel item is. |
| child | – child for which to search the parent for. |
Definition at line 859 of file KoSvgTextShape_p.h.
References KisForestDetail::BaseIterator< BaseClass, T, Tag, is_const >::node(), KisForestDetail::parent(), KisForestDetail::tailSubtreeBegin(), and KisForestDetail::tailSubtreeEnd().
| bool KoSvgTextShape::fontMatchingDisabled | ( | ) | const |
fontMatchingDisabled
Definition at line 1975 of file KoSvgTextShape.cpp.
References d.
| QMap< KoSvgText::TextDecoration, QPainterPath > KoSvgTextShape::generateDecorationPaths | ( | const int & | start, |
| const int & | end, | ||
| const KoSvgText::ResolutionHandler | resHandler, | ||
| const QVector< CharacterResult > & | result, | ||
| const bool | isHorizontal, | ||
| const KoSvgText::TextDecorations & | decor, | ||
| const KoSvgText::TextDecorationStyle | style = KoSvgText::TextDecorationStyle::Solid, | ||
| const bool | textDecorationSkipInset = false, | ||
| const KoPathShape * | currentTextPath = nullptr, | ||
| const qreal | currentTextPathOffset = 0.0, | ||
| const bool | textPathSide = false, | ||
| const KoSvgText::TextDecorationUnderlinePosition | underlinePosH = KoSvgText::TextDecorationUnderlinePosition::UnderlineAuto, | ||
| const KoSvgText::TextDecorationUnderlinePosition | underlinePosV = KoSvgText::TextDecorationUnderlinePosition::UnderlineAuto ) |
|
static |
|
static |
generateTextAreas Generates text areas with the given shapes and properties. This is used to paint previews in the PaddingMargin strategy.
| shapesInside | – the shapes inside to compute the text areas from. |
| shapesSubtract | – the subtract shapes to remove from the text areas. |
| props | – the properties to use. ShapePadding and ShapeMargin id will be taken from this. |
Definition at line 1980 of file KoSvgTextShape.cpp.
References shapesInside, and shapesSubtract.
|
static |
| KoSvgTextShapeMementoSP KoSvgTextShape::getMemento | ( | ) |
Get a memento holding the current textdata and layout info.
Definition at line 1871 of file KoSvgTextShape.cpp.
References d.
| QList< KoSvgTextCharacterInfo > KoSvgTextShape::getPositionsAndRotationsForRange | ( | const int | startPos, |
| const int | endPos ) const |
getPositionsAndRotationsForRange
| startPos | – start of range. |
| endPos | – end of range, not inclusive. |
| includeLastAdvance | – include a transform at the end that represents the last transform+advance. |
Definition at line 1416 of file KoSvgTextShape.cpp.
References CharacterResult::addressable, d, and infoFromCharacterResult().
|
static |
|
inline |
Definition at line 488 of file KoSvgTextShape_p.h.
| int KoSvgTextShape::indexForPos | ( | int | pos | ) | const |
indexForPos get the string index for a given cursor position.
| pos | the cursor position. |
Definition at line 878 of file KoSvgTextShape.cpp.
References d.
| QPointF KoSvgTextShape::initialTextPosition | ( | ) | const |
initialTextPosition Returns the initial text position as per SVG algorithm. The eventual result of this can include transforms or repositioning due to text shapes.
|
inlinestatic |
insertNewLinesAtAnchors Resolves character transforms and then inserts new lines at each transform that creates a new chunk.
| tree | – tree to apply to. |
| shapesInside | – whether we're wrapping in shape. |
Definition at line 1135 of file KoSvgTextShape_p.h.
References KisForestDetail::Forest< T >::childBegin(), and KisForestDetail::Forest< T >::childEnd().
|
inlinestatic |
Because sometimes we have to deal with multiple transforms on a span we only really want to insert newlines when at a content element start. In theory the other transforms can be tested, but this is hard, and semantically it doesn't make sense if a svg text does this.
Definition at line 1147 of file KoSvgTextShape_p.h.
| bool KoSvgTextShape::insertRichText | ( | int | pos, |
| const KoSvgTextShape * | richText, | ||
| bool | inheritPropertiesIfPossible = false ) |
insertRichText Insert rich text at the given cursor pos. This will first split contents at the given pos before inserting the new rich text.
| pos | – cursor pos to insert at. |
| richText | – KoSvgTextShape with rich text data. |
| inheritPropertiesIfPossible | – toggle whether to inherit rich text if possible. |
Definition at line 1153 of file KoSvgTextShape.cpp.
References KoShape::ContentChanged, cursorPos, d, KisForestDetail::hierarchyBegin(), KisForestDetail::hierarchyEnd(), KoShape::notifyChanged(), p, CharacterResult::plaintTextIndex, KoSvgTextProperties::propertyIsBlockOnly(), and KoShape::shapeChangedPriv().
| bool KoSvgTextShape::insertText | ( | int | pos, |
| QString | text ) |
insertText Insert a text somewhere in the KoTextShape.
| pos | the cursor position. |
| text | the text to insert. |
< Current position of the search.
The distinction between element and insertion index allows us to insert text at the start or end of a content element, without ambiguity on whether we're inserting into the next element.
Definition at line 892 of file KoSvgTextShape.cpp.
References KoShape::ContentChanged, cursorPos, d, KoShape::notifyChanged(), CharacterResult::plaintTextIndex, and KoShape::shapeChangedPriv().
|
inlinestatic |
insertTransforms Inserts empty transforms into tree recursively.
| tree | – tree to insert transforms on. |
| start | – start index. |
| length | – amount of transforms to insert. |
| allowSkipFirst | – whether we're allowed to skip the first transform because it is at the start of a text element. |
Definition at line 994 of file KoSvgTextShape_p.h.
References KisForestDetail::Forest< T >::childBegin(), and length().
|
inlinestatic |
insertTransformsImpl Recursive function that handles inserting empty transforms into a given range. Used by insertTransforms.
Definition at line 1006 of file KoSvgTextShape_p.h.
References length().
| KoShapeManager * KoSvgTextShape::internalShapeManager | ( | ) | const |
internalShapeManager
Definition at line 2562 of file KoSvgTextShape.cpp.
References d.
Definition at line 517 of file KoSvgTextShape_p.h.
|
inlinestatic |
Definition at line 1315 of file KoSvgTextShape_p.h.
References KisForestDetail::childBegin(), and KisForestDetail::childEnd().
| void KoSvgTextShape::leaveNodeSubtree | ( | ) |
Set the current node to its parent, leaving the subtree.
Definition at line 1866 of file KoSvgTextShape.cpp.
| int KoSvgTextShape::lineEnd | ( | int | pos | ) |
lineEnd return the 'line end' for this pos. This uses anchored chunks, so each absolute x, y posititioning will be considered a line-start.
| pos | – the cursor pos for which to find the line end. |
Definition at line 342 of file KoSvgTextShape.cpp.
| int KoSvgTextShape::lineStart | ( | int | pos | ) |
lineStart return the 'line start' for this pos. This uses anchored chunks, so each absolute x, y posititioning will be considered a line-start.
| pos | – the cursor pos for which to find the line start. |
Definition at line 323 of file KoSvgTextShape.cpp.
|
static |
|
static |
|
inlinestatic |
Definition at line 1362 of file KoSvgTextShape_p.h.
References KoShape::name(), and KoShape::setName().
| void KoSvgTextShape::mergePropertiesIntoRange | ( | const int | startPos, |
| const int | endPos, | ||
| const KoSvgTextProperties | properties, | ||
| const QSet< KoSvgTextProperties::PropertyId > | removeProperties = QSet<KoSvgTextProperties::PropertyId>() ) |
mergePropertiesIntoRange Merge given properties into the given range. This will first split the nodes at the two range ends, and then merge in the properties into each leaf node. Won't do anything when startPos == endPos
First, the properties in removeProperties list will be removed, then properties in properties will be applied. If the property is present in both lists, then the value from properties will be used.
| startPos | – cursor pos start. |
| endPos | – cursor pos end. |
| properties | – properties to merge in. |
| removeProperties | – optional list of properties to remove, these will always apply after merging. |
Definition at line 1061 of file KoSvgTextShape.cpp.
References KoShape::BackgroundChanged, KoShape::ContentChanged, d, KoSvgTextProperties::FillId, KoSvgTextProperties::hasProperty(), KoSvgTextProperties::InlineSizeId, KoSvgText::AutoValue::isAuto, KoShape::notifyChanged(), p, KoSvgTextProperties::properties(), KoSvgTextProperties::property(), KoSvgTextProperties::propertyIsBlockOnly(), KoShape::shapeChangedPriv(), KoSvgTextProperties::ShapeMarginId, KoSvgTextProperties::ShapePaddingId, KisForestDetail::size(), KoShape::StrokeChanged, KoSvgTextProperties::StrokeId, KoSvgTextProperties::TextAnchorId, and KoShape::TextContourMarginChanged.
moveShapeInsideToIndex Because the order of shapes inside shape-inside affects the text layout, it can be useful to be able to reorder them.
| shapeInside | – shape from the shapesInside list. This function will do nothing |
| index | – new index to move the shape inside to. Will be bound to the list size. |
@seealso shapesInside();
Definition at line 2405 of file KoSvgTextShape.cpp.
References KoShape::ContentChanged, d, KoShape::shapeChangedPriv(), and KoShape::update().
| int KoSvgTextShape::nextIndex | ( | int | pos | ) |
nextIndex Return the first cursor position with a higher string index.
| pos | the cursor position. |
Definition at line 389 of file KoSvgTextShape.cpp.
References d.
| int KoSvgTextShape::nextLine | ( | int | pos | ) |
nextLine get a position on the next line for this position.
| pos | – cursor position. |
Definition at line 447 of file KoSvgTextShape.cpp.
References CharacterResult::advance, LineChunk::chunkIndices, LineBox::chunks, CharacterResult::cursorInfo, cursorPos, d, CharacterResult::finalPosition, lineEnd(), CursorInfo::offsets, posForIndex(), posForPoint(), and shapesInside.
|
private |
nextPos get the next position.
| pos | – cursor position. |
Definition at line 419 of file KoSvgTextShape.cpp.
References d.
| KoSvgTextNodeIndex KoSvgTextShape::nodeForTextPath | ( | KoShape * | textPath | ) | const |
nodeForTextPath TextPaths are set on toplevel content elements. This function allows for searching which node has said textPath, which should be less clunky than running topLevelNodeForPos for every pos.
| textPath | – the text path to find the node for. |
Definition at line 1523 of file KoSvgTextShape.cpp.
References d, and KoShape::name().
| void KoSvgTextShape::notifyCursorPosChanged | ( | int | pos, |
| int | anchor ) |
Notify that the cursor position has changed.
Definition at line 1632 of file KoSvgTextShape.cpp.
References KoShape::anchor(), d, KoShape::Private::listeners, and KoSvgTextShape::TextCursorChangeListener::notifyCursorPosChanged().
| void KoSvgTextShape::notifyMarkupChanged | ( | ) |
Notify that the markup has changed.
Definition at line 1645 of file KoSvgTextShape.cpp.
References d, KoShape::Private::listeners, and KoSvgTextShape::TextCursorChangeListener::notifyMarkupChanged().
|
inlinestatic |
Get the number of characters for the whole subtree of this node.
Definition at line 695 of file KoSvgTextShape_p.h.
References KisForestDetail::childBegin(), KisForestDetail::childEnd(), and KoSvgTextProperties::inheritFrom().
|
overridevirtual |
returns the outline of the shape in the form of a path. The outline returned will always be relative to the position() of the shape, so moving the shape will not alter the result. The outline is used to draw the stroke on, for example.
Reimplemented from KoShape.
Definition at line 2051 of file KoSvgTextShape.cpp.
References d, KoShape::outline(), result, and KoShape::transformation().
|
overridevirtual |
returns the outline of the shape in the form of a rect. The outlineRect returned will always be relative to the position() of the shape, so moving the shape will not alter the result. The outline is used to calculate the boundingRect.
Reimplemented from KoShape.
Definition at line 2070 of file KoSvgTextShape.cpp.
References outline().
|
overridevirtual |
Paint the shape fill The class extending this one is responsible for painting itself. painter is expected to be preconfigured to work in "document" pixels.
| painter | used for painting the shape |
Implements KoShape.
Definition at line 2012 of file KoSvgTextShape.cpp.
References boundingRect(), d, KoSvgText::DecorationLineThrough, KoSvgText::DecorationOverline, KoSvgText::DecorationUnderline, outline(), KoSvgText::RenderingOptimizeSpeed, textProperties(), and KoSvgTextProperties::TextRenderingId.
| void KoSvgTextShape::paintDebug | ( | QPainter & | painter, |
| const QVector< CharacterResult > & | result, | ||
| int & | currentIndex ) |
| void KoSvgTextShape::paintDebug | ( | QPainter & | painter, |
| DebugElements | elements ) const |
Definition at line 2244 of file KoSvgTextShape.cpp.
References LineBox::baselineBottom, LineBox::baselineTop, LineChunk::boundingBox, boundingRect(), CharBbox, LineBox::chunks, d, LineChunk::length, LineBox, KoShape::outline(), outline(), p, and KoShape::transformation().
|
overridevirtual |
paintOrder
Reimplemented from KoShape.
Definition at line 1579 of file KoSvgTextShape.cpp.
References d, KoSvgTextProperties::hasProperty(), KoShape::paintOrder(), KoSvgTextProperties::PaintOrder, KoSvgTextProperties::properties(), KoSvgTextProperties::property(), and KisForestDetail::size().
| void KoSvgTextShape::paintPaths | ( | QPainter & | painter, |
| const QPainterPath & | outlineRect, | ||
| const KoShape * | rootShape, | ||
| const QVector< CharacterResult > & | result, | ||
| const KoSvgText::TextRendering | rendering, | ||
| QPainterPath & | chunk, | ||
| int & | currentIndex ) |
|
overridevirtual |
paintStroke paints the shape's stroked outline
| painter | used for painting the shape |
Reimplemented from KoShape.
Definition at line 2045 of file KoSvgTextShape.cpp.
| void KoSvgTextShape::paintTextDecoration | ( | QPainter & | painter, |
| const QPainterPath & | outlineRect, | ||
| const KoShape * | rootShape, | ||
| const KoSvgText::TextDecoration | type, | ||
| const KoSvgText::TextRendering | rendering ) |
| QString KoSvgTextShape::plainText | ( | ) |
plainText plain text of all text inside this text shape, without the bidi controls or any transforms.
| int KoSvgTextShape::posDown | ( | int | pos, |
| bool | visual = false ) |
return position below.
Definition at line 308 of file KoSvgTextShape.cpp.
References KoSvgTextProperties::DirectionId, KoSvgText::DirectionRightToLeft, nextLine(), nextPos(), previousPos(), textProperties(), KoSvgText::VerticalLR, KoSvgText::VerticalRL, and writingMode().
| int KoSvgTextShape::posForIndex | ( | int | index, |
| bool | firstIndex = false, | ||
| bool | skipSynthetic = false ) const |
posForIndex Get the cursor position for a given index in a string.
| index | – index in the string. |
| firstIndex | – whether to return for the first instance of the index. |
| skipSynthetic | – whether to skip over synthetic cursorPositions. |
Definition at line 855 of file KoSvgTextShape.cpp.
References d.
| int KoSvgTextShape::posForPoint | ( | QPointF | point, |
| int | start = -1, | ||
| int | end = -1, | ||
| bool * | overlaps = nullptr ) |
posForPoint Finds the closest cursor position for the given point in shape coordinates.
| point | |
| start | – optional start position; |
| end | – optional end position; |
| overlaps | – optional bool that is set if the point overlaps any glyph box. |
Definition at line 784 of file KoSvgTextShape.cpp.
References CharacterResult::advance, CursorPos::cluster, CharacterResult::cursorInfo, d, distance(), CharacterResult::finalPosition, CharacterResult::finalTransform(), kisDistance(), CharacterResult::layoutBox(), CursorPos::offset, and CursorInfo::offsets.
| int KoSvgTextShape::posForPointLineSensitive | ( | QPointF | point | ) |
posForPointLineSensitive When clicking on an empty space in a wrapped text, it is preferable to have the caret be at the end of the line visually associated with that empty space than the positions above or below that might be closer.
Because SVG has several situations where there's no real lines, we first test for the closest cursorpos and also whether there's an actual overlap with a glyph. If there's no such overlap, we test against whether there's an anchored chunk in the inline direction, and if so search the line resulting from that. If not, we return the closest pos.
| point | the point in shape coordinates. |
Definition at line 811 of file KoSvgTextShape.cpp.
References CharacterResult::advance, CharacterResult::anchored_chunk, CursorInfo::caret, CursorPos::cluster, CharacterResult::cursorInfo, d, distance(), CharacterResult::finalPosition, KoSvgText::HorizontalTB, kisDistance(), lineEnd(), CursorPos::offset, CursorInfo::offsets, posForPoint(), and writingMode().
| int KoSvgTextShape::posLeft | ( | int | pos, |
| bool | visual = false ) |
return position to the left; visual indicates whether to use logical ('previous') or visual left (depending on direction).
Definition at line 258 of file KoSvgTextShape.cpp.
References KoSvgTextProperties::DirectionId, KoSvgText::DirectionRightToLeft, nextLine(), nextPos(), previousLine(), previousPos(), textProperties(), KoSvgText::VerticalLR, KoSvgText::VerticalRL, and writingMode().
| int KoSvgTextShape::posRight | ( | int | pos, |
| bool | visual = false ) |
return position to the right; visual indicates whether to use logical ('next') or visual right (depending on direction).
Definition at line 275 of file KoSvgTextShape.cpp.
References KoSvgTextProperties::DirectionId, KoSvgText::DirectionRightToLeft, nextLine(), nextPos(), previousLine(), previousPos(), textProperties(), KoSvgText::VerticalLR, KoSvgText::VerticalRL, and writingMode().
| int KoSvgTextShape::posUp | ( | int | pos, |
| bool | visual = false ) |
return position above.
Definition at line 293 of file KoSvgTextShape.cpp.
References KoSvgTextProperties::DirectionId, KoSvgText::DirectionRightToLeft, nextPos(), previousLine(), previousPos(), textProperties(), KoSvgText::VerticalLR, KoSvgText::VerticalRL, and writingMode().
| int KoSvgTextShape::previousIndex | ( | int | pos | ) |
previousIndex Return the first pos which has a lower string index.
| pos | the cursor position. |
Definition at line 404 of file KoSvgTextShape.cpp.
References d.
| int KoSvgTextShape::previousLine | ( | int | pos | ) |
previousLine get a position on the previous line for this position.
| pos | – cursor position. |
Definition at line 501 of file KoSvgTextShape.cpp.
References CharacterResult::advance, LineChunk::chunkIndices, LineBox::chunks, CharacterResult::cursorInfo, cursorPos, d, CharacterResult::finalPosition, lineStart(), CursorInfo::offsets, posForIndex(), posForPoint(), and shapesInside.
|
private |
previousPos get the previous position.
| pos | – cursor position. |
Definition at line 433 of file KoSvgTextShape.cpp.
References d.
|
inline |
Definition at line 444 of file KoSvgTextShape_p.h.
|
inline |
Definition at line 458 of file KoSvgTextShape_p.h.
References KoShape::setSelectable().
| KoSvgTextProperties KoSvgTextShape::propertiesForPos | ( | const int | pos, |
| bool | inherited = false ) const |
Return the properties at a given position.
Definition at line 961 of file KoSvgTextShape.cpp.
References propertiesForRange().
| QList< KoSvgTextProperties > KoSvgTextShape::propertiesForRange | ( | const int | startPos, |
| const int | endPos, | ||
| bool | inherited = false ) const |
propertiesForRange get the properties for a range.
| startPos | – range start. |
| endPos | – range end. |
Sometimes this gets called when xml data is uploaded into the shape, at which point the tree is empty.
Definition at line 982 of file KoSvgTextShape.cpp.
References d, inheritProperties(), KisForestDetail::siblingCurrent(), and KisForestDetail::size().
| KoSvgTextShape::Q_DECLARE_FLAGS | ( | DebugElements | , |
| DebugElement | ) |
| void KoSvgTextShape::relayout | ( | ) |
| void KoSvgTextShape::relayout | ( | ) | const |
Create a new text layout for the current content of the text shape chunks tree. The user should always call relayout() after every change in the text shapes hierarchy.
Definition at line 2593 of file KoSvgTextShape.cpp.
References d.
| bool KoSvgTextShape::relayoutIsBlocked | ( | ) | const |
relayoutIsBlocked
Definition at line 1965 of file KoSvgTextShape.cpp.
References d.
| void KoSvgTextShape::removeShapesFromContours | ( | QList< KoShape * > | shapes, |
| bool | callUpdate = true, | ||
| bool | cleanup = true ) |
removeShapesFromContours Remove list of shapes from any of the internal lists.
| shapes | – shapes to remove. |
| update | – whether to call an update. |
| cleanup | – whether to cleanup the textdata. |
Definition at line 2378 of file KoSvgTextShape.cpp.
References KoShape::ContentChanged, d, KoShape::name(), KoShape::notifyChanged(), KoShape::removeDependee(), KoShape::shapeChangedPriv(), and KoShape::update().
| bool KoSvgTextShape::removeText | ( | int & | index, |
| int & | length ) |
removeText Where insert text explicitly uses a cursorposition, remove text uses a string index. It will modify these values so that...
| index | - index (not cursorpos!) of the start position. |
| length | - total length of text to remove. |
Definition at line 922 of file KoSvgTextShape.cpp.
References KoShape::ContentChanged, d, length(), KoShape::notifyChanged(), KoShape::shapeChangedPriv(), and size().
|
inlinestatic |
removeTextPathId Remove the text path id with the given name from the toplevel elements.
Definition at line 1353 of file KoSvgTextShape_p.h.
|
inlinestatic |
removeTransforms Remove all local SVG character transforms in a certain range. Local transforms are influenced by whitespace collapse and whether they are set to unicode codepoints, and they also accumulate from parent to child. This function removes all local transforms in a certain section.
| tree | – tree to remove transforms from. |
| start | – start at which to remove transforms. |
| length | – end to remove from. |
Definition at line 936 of file KoSvgTextShape_p.h.
References KisForestDetail::Forest< T >::childBegin(), and length().
| void KoSvgTextShape::removeTransformsFromRange | ( | const int | startPos, |
| const int | endPos ) |
Remove local transforms from the given range.
Definition at line 1443 of file KoSvgTextShape.cpp.
References KoShape::ContentChanged, d, KoShape::notifyChanged(), and KoShape::shapeChangedPriv().
|
inlinestatic |
removeTransformsImpl recursive function that handles removing local transforms in a certain range. Used by removeTransform.
Definition at line 949 of file KoSvgTextShape_p.h.
References length().
|
inlinestatic |
Definition at line 1108 of file KoSvgTextShape_p.h.
References KisForestDetail::Forest< T >::childBegin(), KoSvgTextProperties::defaultProperties(), KoSvgTextProperties::hasProperty(), KoSvgText::HorizontalTB, KoSvgTextProperties::inheritFrom(), KoSvgTextProperties::InlineSizeId, KoSvgTextProperties::propertyOrDefault(), and KoSvgTextProperties::WritingModeId.
|
static |
| bool KoSvgTextShape::saveHtml | ( | HtmlSavingContext & | context | ) |
Definition at line 1781 of file KoSvgTextShape.cpp.
References KoXmlWriter::addAttribute(), KoXmlWriter::addTextNode(), KoSvgTextProperties::convertParagraphProperties(), KoSvgTextProperties::convertToSvgTextAttributes(), d, debugFlake, KoSvgTextProperties::defaultProperties(), KoXmlWriter::endElement(), KisForestDetail::Enter, KoSvgTextProperties::FillId, KoSvgTextProperties::hasProperty(), KoSvgTextProperties::properties(), HtmlSavingContext::shapeWriter(), and KoXmlWriter::startElement().
|
overridevirtual |
Saves SVG data.
Reimplemented from SvgShape.
Definition at line 1698 of file KoSvgTextShape.cpp.
References KoShape::absoluteTransformation(), background(), SvgSavingContext::createUID(), d, KisForestDetail::Enter, SvgSavingContext::getID(), KoShape::inheritPaintOrder(), KoShape::isVisible(), KoSvgTextShape_TEXTCONTOURGROUP, KoSvgTextProperties::Opacity, outlineRect(), KoSvgTextProperties::PaintOrder, paintOrder(), SvgWriter::saveDetached(), SvgStyleWriter::saveMetadata(), SvgStyleWriter::saveSvgBasicStyle(), SvgStyleWriter::saveSvgFill(), SvgStyleWriter::saveSvgStroke(), SvgStyleWriter::saveSvgStyle(), shapeTypeSpecificStyles(), SvgSavingContext::shapeWriter, size(), SvgSavingContext::strippedTextMode, stroke(), KoShape::transformation(), value(), KoSvgTextProperties::Visibility, and SvgUtil::writeTransformAttributeLazy().
| QPainterPath KoSvgTextShape::selectionBoxes | ( | int | pos, |
| int | anchor ) |
selectionBoxes returns all selection boxes for a given range. Range will be normalized internally.
| pos | – the main cursor pos. |
| anchor | – the anchor from which the selection is calculated. |
Definition at line 663 of file KoSvgTextShape.cpp.
References CharacterResult::advance, KoShape::anchor(), CursorInfo::caret, CharacterResult::cursorInfo, cursorPos, d, CharacterResult::finalTransform(), CursorInfo::offsets, p, and CursorInfo::rtl.
|
overridevirtual |
Set the background of the shape. A shape background can be a plain color, a gradient, a pattern, be fully transparent or have a complex fill. Setting such a background will allow the shape to be filled and will be able to tell if it is transparent or not.
If the shape inherited the background from its parent, its stops inheriting it, that is inheritBackground property resets to false.
| background | the new shape background. |
Reimplemented from KoShape.
Definition at line 1550 of file KoSvgTextShape.cpp.
References background(), KoShape::BackgroundChanged, d, KoSvgTextProperties::FillId, KoShape::notifyChanged(), KoShape::shapeChangedPriv(), and KisForestDetail::size().
| void KoSvgTextShape::setCharacterTransformsFromLayout | ( | ) |
setCharacterTransformsFromLayout Converts the text to a prepositioned SVG 1.1 text. This changes the textType();
Definition at line 1682 of file KoSvgTextShape.cpp.
References d, KoSvgTextProperties::InlineSizeId, propertiesForPos(), KoSvgTextProperties::removeProperty(), setPropertiesAtPos(), KoSvgTextProperties::TextCollapseId, and KoSvgTextProperties::TextWrapId.
| bool KoSvgTextShape::setCharacterTransformsOnRange | ( | const int | startPos, |
| const int | endPos, | ||
| const QVector< QPointF > | positions, | ||
| const QVector< qreal > | rotateDegrees, | ||
| const bool | deltaPosition = true ) |
setCharacterTransformsOnRange Set SVG 1.1 style character transforms on the given range. Will not work when the shape is auto wrapping.
| startPos | – start of range |
| endPos | – end of range |
| positions | – positions, in shape coordinates. |
| rotations | – rotations, in degrees. |
| deltaPosition | – whether to calculate and set the delta positions. |
Definition at line 1223 of file KoSvgTextShape.cpp.
References KoSvgText::CharTransformation::absolutePos(), CharacterResult::addressable, CharacterResult::advance, KoShape::anchor(), KoSvgText::AnchorEnd, KoSvgText::AnchorMiddle, KoShape::ContentChanged, CharacterResult::cssPosition, CharacterResult::cursorInfo, d, KoSvgTextProperties::DirectionId, KoSvgText::DirectionRightToLeft, KoSvgText::CharTransformation::dxPos, KoSvgText::CharTransformation::dyPos, CharacterResult::finalPosition, kisDegreesToRadians(), KoShape::notifyChanged(), p, KoSvgText::CharTransformation::relativeOffset(), KoSvgText::CharTransformation::rotate, CursorInfo::rtl, KoShape::shapeChangedPriv(), shapesInside, KoSvgText::CharTransformation::startsNewChunk(), KoSvgTextProperties::TextAnchorId, CharacterResult::textLengthOffset, CharacterResult::textPathAndAnchoringOffset, textProperties(), KoSvgText::CharTransformation::xPos, and KoSvgText::CharTransformation::yPos.
| void KoSvgTextShape::setFontMatchingDisabled | ( | const bool | disable | ) |
setDisableFontMatching
| disable | font matching when retrieving fonts for text layout (if possible). This speeds up text layout, but should only be done if there's only one font necessary and it can be found with the KoFFWWSconverter. |
Definition at line 1970 of file KoSvgTextShape.cpp.
References d.
| void KoSvgTextShape::setMemento | ( | const KoSvgTextShapeMementoSP | memento | ) |
Set the text data and layout info, reset listening cursors to 0.
Definition at line 1913 of file KoSvgTextShape.cpp.
References notifyCursorPosChanged(), notifyMarkupChanged(), and setMementoImpl().
| void KoSvgTextShape::setMemento | ( | const KoSvgTextShapeMementoSP | memento, |
| int | pos, | ||
| int | anchor ) |
Set the text data, layout info and also adjust any listening cursors.
Definition at line 1920 of file KoSvgTextShape.cpp.
References KoShape::anchor(), d, KoSvgTextProperties::hasProperty(), notifyCursorPosChanged(), notifyMarkupChanged(), setMementoImpl(), KoSvgTextProperties::ShapeMarginId, KoSvgTextProperties::ShapePaddingId, and textProperties().
|
private |
Definition at line 1883 of file KoSvgTextShape.cpp.
References KoSvgTextShapeMementoImpl::cursorPos, d, KoSvgTextShapeMementoImpl::initialTextPosition, KoSvgTextShapeMementoImpl::isBidi, KIS_SAFE_ASSERT_RECOVER, KoSvgTextShapeMementoImpl::lineBoxes, KoSvgTextShapeMementoImpl::logicalToVisualCursorPos, KoSvgTextShapeMementoImpl::plainText, KoSvgTextShapeMementoImpl::result, and KoSvgTextShapeMementoImpl::textData.
|
overridevirtual |
setPaintOrder set the paint order. As there's only three entries in any given paintorder, you only need to have the first and second entry to set it.
| first | first thing to paint |
| second | second thing to paint. |
Reimplemented from KoShape.
Definition at line 1588 of file KoSvgTextShape.cpp.
References d, KoShape::defaultPaintOrder(), KoShape::Fill, KIS_SAFE_ASSERT_RECOVER_RETURN, KoSvgTextProperties::PaintOrder, KoShape::setInheritPaintOrder(), and KisForestDetail::size().
| void KoSvgTextShape::setPropertiesAtPos | ( | int | pos, |
| KoSvgTextProperties | properties ) |
setPropertiesAtPos will set the properties at pos.
| pos | |
| properties |
Definition at line 1040 of file KoSvgTextShape.cpp.
References KoShape::ContentChanged, cursorPos, d, KoShape::notifyChanged(), CharacterResult::plaintTextIndex, KoShape::shapeChangedPriv(), and KisForestDetail::size().
| void KoSvgTextShape::setRelayoutBlocked | ( | const bool | disable | ) |
Definition at line 1960 of file KoSvgTextShape.cpp.
References d.
|
overridevirtual |
Update the image resolution in pixels per inch. Shapes should override this if they need to know the image resolution.
| xRes | |
| yRes |
Reimplemented from KoShape.
Definition at line 247 of file KoSvgTextShape.cpp.
References d, relayout(), xRes, and yRes.
setShapesInside
| shapesInside | the list of shapes to make up the content area. |
Definition at line 2330 of file KoSvgTextShape.cpp.
References addShapeContours(), d, removeShapesFromContours(), and shapesInside.
setShapesSubtract
| shapesSubtract | the list of shapes that subtract from the wrapping area. |
Definition at line 2546 of file KoSvgTextShape.cpp.
References addShapeContours(), d, removeShapesFromContours(), and shapesSubtract.
|
overridevirtual |
Resize the shape.
| size | the new size of the shape. This is different from scaling as scaling is a so called secondary operation which is comparable to zooming in instead of changing the size of the basic shape. Easiest example of this difference is that using this method will not distort the size of pattern-fills and strokes. |
We don't have any contours, just scale (and distort) the text, as if "Scale Styles" were activated
We have only one contour that has no transformations, so we can just pass the resize to it and preserve all the contours intact
When resizing the shapes via setSize() we expect the method to scale the shapes bluntly in the parent's coordinate system. So, when resizing embedded shapes we should just anchor them to the origin of the text-shape's coordinate system.
When we have transformed (scaled, rotated and etc.) shapes internally, we cannot pass resize action to them, because it is impossible to mimic the parent resize by mere resizing the child shapes. We would have to add shear to them [1].
That is why we just add a scaling transform to every contour shape while keeping the text unscaled. Keeping the text unscaled covers the case when the user want to simply transform a text balloon without contours.
[1] Proof of the "impossible to pass the resize" claim
That comes from the matrix equation to the child-parent transformation. Here is an example for a rotated child:
Original transformation is:
parentPoint = childPoint * ChildRotate,
now apply Scale to both sides, to simulate scale in the parent's coordinate system:
parentPoint * Scale = childPoint * ChildRotate * Scale,
now we need to preserve the original child's transformation to be intact, which was ChildRotate. To achieve that, add (ChildRotate.inverted() * ChildRotate) at the end of the equation:
parentPoint * Scale = childPoint * ChildRotate * Scale * (ChildRotate.inverted() * ChildRotate),
now regroup the matrices:
parentPoint * Scale = childPoint * (ChildRotate * Scale * ChildRotate.inverted()) * ChildRotate,
notice matrix (ChildRotate * Scale * ChildRotate.inverted()) is the one that we should apply to the child shape in setSize() to preserve its transform. This matrix can not be a scale matrix, it will always recieve shear components for any non-trivial ChildRotate values.
Reimplemented from KoShape.
Definition at line 2124 of file KoSvgTextShape.cpp.
References KoShape::absoluteTransformation(), d, KoShape::notifyChanged(), outlineRect(), KoFlake::resizeShapeCommon(), KoShape::scale(), KoShape::ScaleChanged, KoShape::setSize(), KoShape::setTransformation(), KoShape::shapeChangedPriv(), size(), and KoShape::transformation().
|
overridevirtual |
Set a new stroke, removing the old one. The stroke inheritance becomes disabled.
| stroke | the new stroke, or 0 if there should be no stroke. |
Reimplemented from KoShape.
Definition at line 1568 of file KoSvgTextShape.cpp.
References d, KoShape::notifyChanged(), KoShape::shapeChangedPriv(), KisForestDetail::size(), stroke(), KoShape::StrokeChanged, and KoSvgTextProperties::StrokeId.
| bool KoSvgTextShape::setTextPathOnRange | ( | KoShape * | textPath, |
| const int | startPos = -1, | ||
| const int | endPos = -1 ) |
setTextPathOnRange Set a text path on the specified range. In SVG text paths are always at the first child.
| textPath | – TextPath to set. |
| posStart | – Start of the range, as cursor pos. |
| posEnd | – End of the range, as cursor pos. |
Definition at line 2420 of file KoSvgTextShape.cpp.
References KoShape::addDependee(), KisForestDetail::childBegin(), KisForestDetail::Forest< T >::childEnd(), KoShape::ContentChanged, d, KisForestDetail::depth(), KisForestDetail::Forest< T >::insert(), KisForestDetail::Forest< T >::move(), KoShape::name(), KoShape::notifyChanged(), p, KoSvgTextContentElement::properties, removeShapesFromContours(), KoSvgTextProperties::setProperty(), KoShape::shapeChangedPriv(), KisForestDetail::siblingCurrent(), KoSvgTextContentElement::text, KoSvgTextProperties::TextDecorationColorId, KoSvgTextProperties::TextDecorationLineId, KoSvgTextProperties::TextDecorationStyleId, KoSvgTextContentElement::textPathId, and KoShape::update().
|
inline |
Definition at line 1192 of file KoSvgTextShape_p.h.
References KisForestDetail::Forest< T >::childBegin(), KisForestDetail::Forest< T >::childEnd(), KoSvgTextProperties::defaultProperties(), KoSvgText::HorizontalTB, and KoSvgTextProperties::WritingModeId.
|
inline |
Definition at line 1210 of file KoSvgTextShape_p.h.
References CharacterResult::addressable, CharacterResult::anchored_chunk, CharacterResult::cssPosition, KoSvgText::CharTransformation::dxPos, KoSvgText::CharTransformation::dyPos, CharacterResult::finalPosition, KoSvgTextProperties::inheritFrom(), length(), KoSvgText::CharTransformation::rotate, CharacterResult::rotate, KoSvgText::CharTransformation::xPos, and KoSvgText::CharTransformation::yPos.
|
overrideprotectedvirtual |
A hook that allows inheriting classes to do something after a KoShape property changed This is called whenever the shape, position rotation or scale properties were altered.
| type | an indicator which type was changed. |
| shape | the shape. |
NOTE: we don't need to handle Deleted type for the shapes in d->dependees list here, becasue this function is called on the other side of the relation, i.e. in the actual "dependee". We handle that in Private::DependeesLifetimeListener.
Reimplemented from KoShape.
Definition at line 178 of file KoSvgTextShape.cpp.
References KoShape::absoluteTransformation(), KoShape::ContentChanged, d, KoShape::Deleted, KoShape::GenericMatrixChange, KoShape::notifyChanged(), KoShape::ParameterChanged, KoShape::ParentChanged, KoShape::PositionChanged, relayout(), KoShape::RotationChanged, KoShape::ScaleChanged, KoShape::shapeChanged(), KoShape::ShearChanged, KoShape::SizeChanged, and KoShape::TextContourMarginChanged.
| bool KoSvgTextShape::shapeInContours | ( | KoShape * | shape | ) |
shapeInContours
| shape |
Definition at line 2373 of file KoSvgTextShape.cpp.
References d, and KoShape::parent().
shapesInside
shapesSubtract
| QMap< QString, QString > KoSvgTextShape::shapeTypeSpecificStyles | ( | SvgSavingContext & | context | ) | const |
Right now we don't support showing glyphs outside the shape. Nor does Inkscape. Therefore being excplit about clipping these glyphs is preferable.
Definition at line 2567 of file KoSvgTextShape.cpp.
References KoSvgTextProperties::convertParagraphProperties(), d, SvgStyleWriter::embedShape(), SvgSavingContext::getID(), KoShape::isVisible(), SvgSavingContext::strippedTextMode, and textProperties().
| bool KoSvgTextShape::singleNode | ( | ) | const |
singleNode Sometimes it is useful to know whether there's only a single text node for UX purposes.
Definition at line 1626 of file KoSvgTextShape.cpp.
References d, and KisForestDetail::size().
|
overridevirtual |
Get the size of the shape in pt.
The size is in shape coordinates.
Reimplemented from KoShape.
Definition at line 2118 of file KoSvgTextShape.cpp.
References outlineRect().
|
inlinestatic |
splitContentElement split the contentElement in tree at index into two nodes.
| tree | – tree to work on. |
| index | – index |
| allowEmptyText | – when false, will return true without splitting the text content element, if the split text would be empty. |
Definition at line 755 of file KoSvgTextShape_p.h.
References KisForestDetail::Forest< T >::childBegin(), KisForestDetail::Forest< T >::depthFirstTailBegin(), KisForestDetail::Forest< T >::depthFirstTailEnd(), KisForestDetail::Forest< T >::insert(), length(), KoSvgTextContentElement::properties, KoSvgTextProperties::properties(), KoSvgTextContentElement::removeText(), and KoSvgTextContentElement::text.
|
inlinestatic |
splitTree Split the whole hierarchy of nodes at the given index.
| tree | - tree to split. |
| index | - index to split at. |
| textPathAfterSplit | - whether to put any found textPaths before or after the split. |
Definition at line 806 of file KoSvgTextShape_p.h.
References KisForestDetail::Forest< T >::childBegin(), KisForestDetail::Forest< T >::depthFirstTailBegin(), KisForestDetail::Forest< T >::depthFirstTailEnd(), KisForestDetail::hierarchyBegin(), KisForestDetail::hierarchyEnd(), KisForestDetail::Forest< T >::insert(), KisForestDetail::Forest< T >::move(), KoSvgTextContentElement::properties, KoSvgTextProperties::properties(), KoSvgTextContentElement::textPathId, and KoSvgTextContentElement::textPathInfo.
|
overridevirtual |
Called by the GUI code when it wants to execute some kind of a long action, which will result in multiple shapeChanged() callbacks to be delivered.
When started, the shape enters into an "bulk action" state as described in the class documentation.
Implements KoShapeBulkActionInterface.
Definition at line 1985 of file KoSvgTextShape.cpp.
References boundingRect(), d, and KIS_SAFE_ASSERT_RECOVER_RETURN.
|
inlinestatic |
Definition at line 1332 of file KoSvgTextShape_p.h.
References KisForestDetail::childBegin(), KisForestDetail::childEnd(), and target().
|
static |
|
overridevirtual |
Returns the currently set stroke, or 0 if there is no stroke.
Reimplemented from KoShape.
Definition at line 1562 of file KoSvgTextShape.cpp.
References d, KoSvgTextProperties::properties(), KoSvgTextProperties::property(), KisForestDetail::size(), and KoSvgTextProperties::StrokeId.
| KoShape * KoSvgTextShape::textOutline | ( | ) | const |
textOutline This turns the text object into non-text KoShape(s) to the best of its abilities.
Definition at line 2294 of file KoSvgTextShape.cpp.
References d.
|
inlinestatic |
| QList< KoShape * > KoSvgTextShape::textPathsAtRange | ( | const int | startPos = -1, |
| const int | endPos = -1 ) |
textPathsAtRange Get a list of textPaths at the given range. This includes textPaths whose node is only partially overlapped by the range.
| posStart | – Start of the range, as cursor pos. |
| posEnd | – End of the range, as cursor pos. |
Definition at line 2499 of file KoSvgTextShape.cpp.
References d, KisForestDetail::siblingCurrent(), KisForestDetail::siblingEnd(), and textPaths.
| KoSvgTextProperties KoSvgTextShape::textProperties | ( | ) | const |
Definition at line 1536 of file KoSvgTextShape.cpp.
References d, KoSvgTextProperties::properties(), and KisForestDetail::size().
| KoSvgTextShape::TextType KoSvgTextShape::textType | ( | ) | const |
textType This enum gives an indication of what kind of text this shape is. The different text types are a bit blurry as SVG allows a mixutre to provide fallback information. When such fallback is in place, this will only return the primary text type, that is, TextInShape before InlineWrap and InlineWrap before PrePositioned/Preformatted. This primarily exists to give UI feedback.
Definition at line 2305 of file KoSvgTextShape.cpp.
References KoSvgText::Collapse, d, KoSvgTextProperties::InlineSizeId, InlineWrap, KoSvgText::AutoValue::isAuto, PreformattedText, PrePositionedText, KoSvgText::PreserveSpaces, KoSvgTextProperties::TextCollapseId, and TextInShape.
| QList< QPainterPath > KoSvgTextShape::textWrappingAreas | ( | ) | const |
textWrappingAreas The text wrapping areas are computed from shapesInside() and shapesSubtract(), as well as the text properties ShapeMargin and ShapePadding. This returns the computed wrapping areas, in the local coordinates of the shape.
@seealso outline()
Definition at line 2552 of file KoSvgTextShape.cpp.
References d.
| KoSvgTextNodeIndex KoSvgTextShape::topLevelNodeForPos | ( | int | pos | ) | const |
topLevelNodeForPos Get, if possible, an index for the child element of the root at pos. If not possible, returns an index for the root. This is used primarily for text-on-path.
| pos | – cursor position at which to find the index. |
Definition at line 1500 of file KoSvgTextShape.cpp.
References d, KoShape::Private::parent, and KisForestDetail::siblingCurrent().
| QPainterPath KoSvgTextShape::underlines | ( | int | pos, |
| int | anchor, | ||
| KoSvgText::TextDecorations | decor, | ||
| KoSvgText::TextDecorationStyle | style, | ||
| qreal | minimum, | ||
| bool | thick ) |
Definition at line 696 of file KoSvgTextShape.cpp.
References CharacterResult::advance, KoShape::anchor(), CursorInfo::caret, CursorPos::cluster, CharacterResult::cursorInfo, d, KoSvgText::Dashed, KoSvgText::DecorationLineThrough, KoSvgText::DecorationOverline, KoSvgText::DecorationUnderline, KoSvgText::Dotted, CharacterResult::finalTransform(), KoSvgText::HorizontalTB, CharacterResult::metrics, CursorPos::offset, CursorInfo::offsets, CursorInfo::rtl, KoSvgText::Solid, textProperties(), KoSvgText::FontMetrics::underlineThickness, and KoSvgTextProperties::WritingModeId.
|
inline |
Definition at line 537 of file KoSvgTextShape_p.h.
|
inline |
Definition at line 521 of file KoSvgTextShape_p.h.
| void KoSvgTextShape::updateTextWrappingAreas | ( | ) |
updateShapeContours The current shape contours can be slow to compute, so this function calls computing them, and then calls relayout();
| int KoSvgTextShape::wordEnd | ( | int | pos | ) |
wordEnd return the pos of the first wordbreak.
| pos | – cursor position. |
Definition at line 553 of file KoSvgTextShape.cpp.
References CharacterResult::breakType, CharacterResult::cursorInfo, cursorPos, d, KoCssTextUtils::IsCssWordSeparator(), isWhiteSpace(), NoBreak, CursorInfo::offsets, plainText, CharacterResult::plaintTextIndex, and wordEnd().
| int KoSvgTextShape::wordLeft | ( | int | pos, |
| bool | visual = false ) |
wordLeft return the cursorpos for the word left or the extreme of the line.
| pos | the position. |
| visual | whether to flip for rtl. |
Definition at line 362 of file KoSvgTextShape.cpp.
References d, KoSvgTextProperties::DirectionId, KoSvgText::DirectionRightToLeft, textProperties(), wordEnd(), and wordStart().
| int KoSvgTextShape::wordRight | ( | int | pos, |
| bool | visual = false ) |
wordRight return the cursorpos for the word right or the extreme of the line.
| pos | the position. |
| visual | whether to flip for rtl. |
Definition at line 376 of file KoSvgTextShape.cpp.
References d, KoSvgTextProperties::DirectionId, KoSvgText::DirectionRightToLeft, textProperties(), wordEnd(), and wordStart().
| int KoSvgTextShape::wordStart | ( | int | pos | ) |
wordStart return the first pos before a wordbreak in the start direction.
| pos | – cursor position |
Definition at line 585 of file KoSvgTextShape.cpp.
References CharacterResult::breakType, CharacterResult::cursorInfo, cursorPos, d, NoBreak, CursorInfo::offsets, and wordStart().
| KoSvgText::WritingMode KoSvgTextShape::writingMode | ( | ) | const |
writingMode There's a number of places we need to check the writing mode to provide proper controls.
Definition at line 1621 of file KoSvgTextShape.cpp.
References textProperties(), and KoSvgTextProperties::WritingModeId.
|
friend |
Definition at line 677 of file KoSvgTextShape.h.
|
friend |
Definition at line 676 of file KoSvgTextShape.h.
| std::optional<BulkActionState> KoSvgTextShape::bulkActionState |
Definition at line 555 of file KoSvgTextShape_p.h.
| QList<QPainterPath> KoSvgTextShape::currentTextWrappingAreas |
Definition at line 561 of file KoSvgTextShape_p.h.
Definition at line 584 of file KoSvgTextShape_p.h.
|
private |
Definition at line 704 of file KoSvgTextShape.h.
| bool KoSvgTextShape::disableFontMatching = false |
Turn off font matching, which should speed up relayout slightly.
Definition at line 579 of file KoSvgTextShape_p.h.
| QPointF KoSvgTextShape::initialTextPosition = QPointF() |
Definition at line 589 of file KoSvgTextShape_p.h.
| QScopedPointer<KoShapePainter> KoSvgTextShape::internalShapesPainter |
Definition at line 514 of file KoSvgTextShape_p.h.
| bool KoSvgTextShape::isBidi = false |
Definition at line 588 of file KoSvgTextShape_p.h.
| bool KoSvgTextShape::isLoading = false |
Turned on when loading in text data, blocks updates to shape listeners.
Definition at line 577 of file KoSvgTextShape_p.h.
Definition at line 582 of file KoSvgTextShape_p.h.
| QMap<int, int> KoSvgTextShape::logicalToVisualCursorPos |
Definition at line 585 of file KoSvgTextShape_p.h.
| QString KoSvgTextShape::plainText |
Definition at line 587 of file KoSvgTextShape_p.h.
| QVector<CharacterResult> KoSvgTextShape::result |
Definition at line 581 of file KoSvgTextShape_p.h.
| QScopedPointer<KoShapeGroup> KoSvgTextShape::shapeGroup |
Definition at line 515 of file KoSvgTextShape_p.h.
Definition at line 557 of file KoSvgTextShape_p.h.
Definition at line 558 of file KoSvgTextShape_p.h.
| KisForest<KoSvgTextContentElement> KoSvgTextShape::textData |
Definition at line 576 of file KoSvgTextShape_p.h.
Definition at line 559 of file KoSvgTextShape_p.h.
| int KoSvgTextShape::xRes = 72 |
Definition at line 511 of file KoSvgTextShape_p.h.
| int KoSvgTextShape::yRes = 72 |
Definition at line 512 of file KoSvgTextShape_p.h.