Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Also take baseline offset into account when splitting up line-throughs.

Wolthera van Hövell tot Westerflierb350e5b74df2
diff --git a/libs/flake/text/KoSvgTextShape_p_layout.cpp b/libs/flake/text/KoSvgTextShape_p_layout.cpp
index e074e4cb18..be2a0c9b92 100644
--- a/libs/flake/text/KoSvgTextShape_p_layout.cpp
+++ b/libs/flake/text/KoSvgTextShape_p_layout.cpp
@@ -1447,6 +1447,7 @@ KoSvgTextShape::Private::generateDecorationPaths(const int &start, const int &en
LineThrough currentLineThrough;
qint32 lastFontSize = 0;
+ QPointF lastBaselineOffset;
QPointF lastLineThroughPoint;
for (int k = start; k < end; k++) {
@@ -1467,16 +1468,19 @@ KoSvgTextShape::Private::generateDecorationPaths(const int &start, const int &en
decorationBoxes.append(currentBox);
currentBox = DecorationBox();
}
- if (charResult.metrics.fontSize != lastFontSize && !currentLineThrough.line.isEmpty()) {
+ // Adjustments to "vertical align" will not affect the baseline offset, so no new stroke needs to be created.
+ const bool newLineThrough = charResult.metrics.fontSize != lastFontSize && charResult.totalBaselineOffset() == lastBaselineOffset;
+ if (newLineThrough && !currentLineThrough.line.isEmpty()) {
if (currentLineThrough.line.last() != lastLineThroughPoint) {
currentLineThrough.line.append(lastLineThroughPoint);
}
}
- if (charResult.metrics.fontSize != lastFontSize || charResult.anchored_chunk) {
+ if (newLineThrough || charResult.anchored_chunk) {
lineThroughLines.append(currentLineThrough);
currentLineThrough = LineThrough();
lastFontSize = charResult.metrics.fontSize;
+ lastBaselineOffset = charResult.totalBaselineOffset();
}
currentBox.underlineOffsets.append((-charResult.metrics.underlineOffset)*freetypePixelsToPt);