|
Krita Source Code Documentation
|
Functions | |
| void | addWordToLine (QVector< CharacterResult > &result, QPointF ¤tPos, QVector< int > &wordIndices, LineBox ¤tLine, bool ltr, bool isHorizontal) |
| addWordToLine Small function used in break lines to quickly add a 'word' to the current line. Returns the last added index. | |
| static void | applyInlineSizeAnchoring (QVector< CharacterResult > &result, LineChunk &chunk, const KoSvgText::TextAnchor anchor, const QPointF anchorPoint, const bool ltr, const bool isHorizontal, const QPointF textIndent, const KoSvgText::ResolutionHandler &resHandler) |
| QVector< LineBox > | breakLines (const KoSvgTextProperties &properties, const QMap< int, int > &logicalToVisual, QVector< CharacterResult > &result, QPointF startPos, const KoSvgText::ResolutionHandler &resHandler) |
| void | calculateLineHeight (CharacterResult cr, double &ascent, double &descent, bool isHorizontal, bool compare) |
| calculateLineHeight calculate the total ascent and descent (including baseline-offset) of a charResult and optionally only return it if it is larger than the provided ascent and descent variable. This is necessary for proper line-height calculation. | |
| void | finalizeLine (QVector< CharacterResult > &result, QPointF ¤tPos, LineBox ¤tLine, QPointF &lineOffset, const KoSvgText::TextAnchor anchor, const KoSvgText::WritingMode writingMode, const bool ltr, const bool inlineSize, const bool textInShape, const KoSvgText::ResolutionHandler &resHandler) |
| static QVector< QLineF > | findLineBoxesForFirstPos (QPainterPath shape, QPointF firstPos, const QRectF wordBox, KoSvgText::WritingMode writingMode) |
| QVector< LineBox > | flowTextInShapes (const KoSvgTextProperties &properties, const QMap< int, int > &logicalToVisual, QVector< CharacterResult > &result, QList< QPainterPath > shapes, QPointF &startPos, const KoSvgText::ResolutionHandler &resHandler) |
| static void | getEstimatedHeight (QVector< CharacterResult > &result, const int index, QRectF &wordBox, const QRectF boundingBox, KoSvgText::WritingMode writingMode) |
| getEstimatedHeight Adjust the wordbox with the estimated height. | |
| static bool | getFirstPosition (QPointF &firstPoint, QPainterPath p, QRectF wordBox, QPointF terminator, KoSvgText::WritingMode writingMode, bool ltr) |
| QList< QPainterPath > | getShapes (QList< KoShape * > shapesInside, QList< KoShape * > shapesSubtract, const KoSvgTextProperties &properties) |
| static void | handleCollapseAndHang (QVector< CharacterResult > &result, LineChunk &chunk, bool ltr, bool isHorizontal) |
| static QPointF | lineHeightOffset (KoSvgText::WritingMode writingMode, QVector< CharacterResult > &result, LineBox ¤tLine, const bool firstLine, const KoSvgText::ResolutionHandler resHandler) |
| static bool | pointLessThan (const QPointF &a, const QPointF &b) |
| static bool | pointLessThanVertical (const QPointF &a, const QPointF &b) |
| static KoSvgText::TextAnchor | textAnchorForTextAlign (KoSvgText::TextAlign align, KoSvgText::TextAlign alignLast, bool ltr) |
| void KoSvgTextShapeLayoutFunc::addWordToLine | ( | QVector< CharacterResult > & | result, |
| QPointF & | currentPos, | ||
| QVector< int > & | wordIndices, | ||
| LineBox & | currentLine, | ||
| bool | ltr, | ||
| bool | isHorizontal ) |
addWordToLine Small function used in break lines to quickly add a 'word' to the current line. Returns the last added index.
Definition at line 54 of file KoSvgTextShapeLayoutFunc_lines.cpp.
References LineBox::actualLineBottom, LineBox::actualLineTop, CharacterResult::advance, CharacterResult::anchored_chunk, LineChunk::boundingBox, CharacterResult::calculateAndApplyTabsize(), calculateLineHeight(), LineBox::chunk(), LineChunk::chunkIndices, Collapse, CharacterResult::cssPosition, LineBox::firstLine, ForceHang, LineBox::isEmpty(), CharacterResult::isHanging, CharacterResult::layoutBox(), LineBox::setCurrentChunk(), and CharacterResult::totalBaselineOffset().
|
static |
Definition at line 248 of file KoSvgTextShapeLayoutFunc_lines.cpp.
References KoSvgText::ResolutionHandler::adjust(), KoSvgText::AnchorEnd, KoSvgText::AnchorStart, LineChunk::boundingBox, LineChunk::chunkIndices, LineChunk::conditionalHangEnd, and p.
| QVector< LineBox > KoSvgTextShapeLayoutFunc::breakLines | ( | const KoSvgTextProperties & | properties, |
| const QMap< int, int > & | logicalToVisual, | ||
| QVector< CharacterResult > & | result, | ||
| QPointF | startPos, | ||
| const KoSvgText::ResolutionHandler & | resHandler ) |
< Used for hanging glyphs at the end of a line.
< 'word' in this case meaning characters inbetween softbreaks.
< Approximated advance of the current wordindices.
< Current position with advances of each character.
< Current line offset.
< Indices of characters in line.
< Whether to do a softbreak;
< Used for hanging glyphs at the end of a line.
< 'word' in this case meaning characters inbetween softbreaks.
< Approximated advance of the current wordindices.
< Current position with advances of each character.
< Current line offset.
< Indices of characters in line.
< Whether to do a softbreak;
Definition at line 442 of file KoSvgTextShapeLayoutFunc_lines.cpp.
References CharacterResult::addressable, addWordToLine(), KoSvgText::ResolutionHandler::adjust(), CharacterResult::advance, CharacterResult::breakType, LineBox::clearAndAdjust(), KoSvgText::AutoValue::customValue, debugFlake, KoSvgTextProperties::DirectionId, KoSvgText::DirectionLeftToRight, KoSvgText::TextIndentInfo::eachLine, finalizeLine(), LineBox::firstLine, KoSvgText::TextIndentInfo::hanging, HardBreak, KoSvgText::HorizontalTB, KoSvgTextProperties::InlineSizeId, KoSvgText::AutoValue::isAuto, LineBox::isEmpty(), LineBox::lastLine, KoSvgText::TextIndentInfo::length, CharacterResult::lineEnd, NoBreak, NoChange, CharacterResult::overflowWrap, KoSvgText::CssLengthPercentage::Percentage, KoSvgTextProperties::propertyOrDefault(), KoSvgTextProperties::TextAnchorId, LineBox::textIndent, KoSvgTextProperties::TextIndentId, KoSvgText::CssLengthPercentage::unit, KoSvgText::CssLengthPercentage::value, and KoSvgTextProperties::WritingModeId.
| void KoSvgTextShapeLayoutFunc::calculateLineHeight | ( | CharacterResult | cr, |
| double & | ascent, | ||
| double & | descent, | ||
| bool | isHorizontal, | ||
| bool | compare ) |
calculateLineHeight calculate the total ascent and descent (including baseline-offset) of a charResult and optionally only return it if it is larger than the provided ascent and descent variable. This is necessary for proper line-height calculation.
| cr | - char result with the data. |
| ascent | - output ascent variable. |
| descent | - output descent variable. |
| isHorizontal | - whether it is horizontal. |
| compare | - whether to only return the value if it is larger than the relative ascent or descent. |
Definition at line 29 of file KoSvgTextShapeLayoutFunc_lines.cpp.
References CharacterResult::lineHeightBox(), and CharacterResult::totalBaselineOffset().
| void KoSvgTextShapeLayoutFunc::finalizeLine | ( | QVector< CharacterResult > & | result, |
| QPointF & | currentPos, | ||
| LineBox & | currentLine, | ||
| QPointF & | lineOffset, | ||
| const KoSvgText::TextAnchor | anchor, | ||
| const KoSvgText::WritingMode | writingMode, | ||
| const bool | ltr, | ||
| const bool | inlineSize, | ||
| const bool | textInShape, | ||
| const KoSvgText::ResolutionHandler & | resHandler ) |
Finalizing the line consists of several steps, like hang/collapse, anchoring into place and offsetting correctly. This can happen several times during a linebreak, hence this convenience function to handle this.
< Because we may have collapsed the last glyph, we'll need to recalculate the total advance;
< Because we may have collapsed the last glyph, we'll need to recalculate the total advance;
Definition at line 321 of file KoSvgTextShapeLayoutFunc_lines.cpp.
References KoSvgText::AnchorEnd, KoSvgText::AnchorMiddle, KoSvgText::AnchorStart, applyInlineSizeAnchoring(), LineBox::chunks, LineBox::firstLine, handleCollapseAndHang(), KoSvgText::HorizontalTB, LineBox::justifyLine, lineHeightOffset(), and LineBox::textIndent.
|
static |
Definition at line 259 of file KoSvgTextShapeLayoutFunc_inShape.cpp.
References KoSvgText::HorizontalTB, pointLessThan(), pointLessThanVertical(), SHAPE_PRECISION, and KoSvgText::VerticalRL.
| QVector< LineBox > KoSvgTextShapeLayoutFunc::flowTextInShapes | ( | const KoSvgTextProperties & | properties, |
| const QMap< int, int > & | logicalToVisual, | ||
| QVector< CharacterResult > & | result, | ||
| QList< QPainterPath > | shapes, | ||
| QPointF & | startPos, | ||
| const KoSvgText::ResolutionHandler & | resHandler ) |
< The textIndent.
< 'word' in this case meaning characters inbetween softbreaks.
< Approximated box of the current word;
< First line will be created proper after we get our first wordbox, this tracks if it's the first.
< Current position with advances of each character.
< Current line offset.
< Whether to break a line.
< The textIndent.
< 'word' in this case meaning characters inbetween softbreaks.
< Approximated box of the current word;
< First line will be created proper after we get our first wordbox, this tracks if it's the first.
< Current position with advances of each character.
< Current line offset.
< Whether to break a line.
Definition at line 441 of file KoSvgTextShapeLayoutFunc_inShape.cpp.
References CharacterResult::addressable, addWordToLine(), KoSvgText::ResolutionHandler::adjust(), CharacterResult::advance, KoSvgText::AlignJustify, CharacterResult::breakType, LineBox::chunk(), LineBox::chunks, LineBox::currentChunk, KoSvgTextProperties::DirectionId, KoSvgText::DirectionLeftToRight, KoSvgText::TextIndentInfo::eachLine, LineBox::expectedLineTop, finalizeLine(), findLineBoxesForFirstPos(), LineBox::firstLine, KoSvgTextProperties::fontSize(), getEstimatedHeight(), getFirstPosition(), KoSvgText::TextIndentInfo::hanging, HardBreak, KoSvgText::HorizontalTB, LineBox::isEmpty(), LineBox::justifyLine, LineBox::lastLine, KoSvgText::TextIndentInfo::length, LineChunk::length, length(), CharacterResult::lineEnd, CharacterResult::lineHeightBox(), NoBreak, NoChange, KoSvgText::CssLengthPercentage::Percentage, KoSvgTextProperties::propertyOrDefault(), LineBox::setCurrentChunkForPos(), SHAPE_PRECISION, KoSvgTextProperties::TextAlignAllId, KoSvgTextProperties::TextAlignLastId, textAnchorForTextAlign(), KoSvgTextProperties::TextIndentId, CharacterResult::totalBaselineOffset(), KoSvgText::CssLengthPercentage::unit, KoSvgText::CssLengthPercentage::value, KoSvgText::VerticalRL, and KoSvgTextProperties::WritingModeId.
|
static |
getEstimatedHeight Adjust the wordbox with the estimated height.
Definition at line 386 of file KoSvgTextShapeLayoutFunc_inShape.cpp.
References calculateLineHeight(), and KoSvgText::HorizontalTB.
|
static |
Precision of fitting the word box into the polygon to account for floating-point precision error.
Definition at line 90 of file KoSvgTextShapeLayoutFunc_inShape.cpp.
References KoSvgText::HorizontalTB, kisDistanceToLine(), p, SHAPE_PRECISION, and KoSvgText::VerticalRL.
| QList< QPainterPath > KoSvgTextShapeLayoutFunc::getShapes | ( | QList< KoShape * > | shapesInside, |
| QList< KoShape * > | shapesSubtract, | ||
| const KoSvgTextProperties & | properties ) |
Definition at line 26 of file KoSvgTextShapeLayoutFunc_inShape.cpp.
References KoPolygonUtils::offsetPolygons(), p, p2, KoSvgTextProperties::propertyOrDefault(), KoSvgTextProperties::ShapeMarginId, KoSvgTextProperties::ShapePaddingId, and KoShape::transformation().
|
static |
Definition at line 194 of file KoSvgTextShapeLayoutFunc_lines.cpp.
References LineChunk::chunkIndices, Collapse, LineChunk::conditionalHangEnd, ConditionallyHang, ForceHang, and LineChunk::length.
|
static |
This offsets the last line by it's ascent, and then returns the last line's descent.
< This is for determining the difference between a predicted line-height (for text-in-shape) and the actual line-height. Note: this is required to be positive.
When the line is empty, but caused by a hardbreak, we will need to use that hardbreak to space the line. This can only be done at this point as it would otherwise need to use visible characters.
Definition at line 103 of file KoSvgTextShapeLayoutFunc_lines.cpp.
References LineBox::actualLineBottom, LineBox::actualLineTop, KoSvgText::ResolutionHandler::adjust(), LineBox::baselineBottom, LineBox::baselineTop, calculateLineHeight(), LineBox::chunks, LineBox::expectedLineTop, KoSvgText::HorizontalTB, KoSvgText::ResolutionHandler::roundToPixelHorizontal, KoSvgText::ResolutionHandler::roundToPixelVertical, and KoSvgText::VerticalLR.
|
static |
Definition at line 248 of file KoSvgTextShapeLayoutFunc_inShape.cpp.
|
static |
Definition at line 253 of file KoSvgTextShapeLayoutFunc_inShape.cpp.
|
static |
Definition at line 419 of file KoSvgTextShapeLayoutFunc_inShape.cpp.
References KoSvgText::AlignCenter, KoSvgText::AlignEnd, KoSvgText::AlignJustify, KoSvgText::AlignLeft, KoSvgText::AlignRight, KoSvgText::AlignStart, KoSvgText::AnchorEnd, KoSvgText::AnchorMiddle, and KoSvgText::AnchorStart.