Created attachment 142479 [details] ^ comparison of line spacing with canvas/text-editor and Inkscape Hi, Creating new text-boxes multiline in Krita5.0appimagebeta2 reveal a lot of line-spacing. (see attachement) STEPS TO REPRODUCE 1. Create a text with multiple lines. OBSERVED RESULT 2. The setting for 100% line-spacing has like 30% more as necessary to get a real 100%. It forces user to set 70% manually on all text boxes. EXPECTED RESULT Getting an accurate 100% Line spacing. SOFTWARE/OS VERSIONS Kubuntu 20.04LTS/Appimage5.0beta2
Honestly, I suspect what's going on is that the offset-calculation is still using the QFont dpi, and not the 'fixed DPI'.
Yes, I am 100% sure that the problem is caused by the QFont workaround: The problem is that the "line-height" is set inside KoSvgTextShapeMarkupConverter::convertDocumentToSvg, where the font-size is still 'Qt-like', but then in the text-chunk shapes the font-size changes as per the DPI workaround. The problem is that we cannot change these values randomly in the place where we know about the workaround, as then we cannot load outside SVG correctly. I have no idea how we're supposed to fix this.
*** Bug 441850 has been marked as a duplicate of this bug. ***
Git commit f0f55bea8e06c74b3a1b499d6c4cd84a29576753 by Dmitry Kazakov. Committed on 02/12/2021 at 14:02. Pushed by dkazakov into branch 'master'. Fix line height being too huge in Krita 5.0 All the internals of QTextDocument work with the primary screen's DPI. That is, when we ask Qt about font metrics, it returns values scaled to the pixels in the current screen, that is, ptValue * qt_defaultDpi() / 72.0. We need to convert this value back into points before writing as SVG. Therefore, all the metrics returned by the document are scaled with `fixQtDpi()`. Official Qt's way to workaround this problem is to set logicalDpiX/Y() values on the paint device's associated with the document. But it seems like in our version of Qt (5.12.12, which is rather old) it doesn't work properly. M +28 -5 libs/flake/text/KoSvgTextShapeMarkupConverter.cpp https://invent.kde.org/graphics/krita/commit/f0f55bea8e06c74b3a1b499d6c4cd84a29576753
Git commit b655bfe1463234178775d530311286bcc2ae7f0b by Dmitry Kazakov. Committed on 02/12/2021 at 14:17. Pushed by dkazakov into branch 'krita/5.0'. Fix line height being too huge in Krita 5.0 All the internals of QTextDocument work with the primary screen's DPI. That is, when we ask Qt about font metrics, it returns values scaled to the pixels in the current screen, that is, ptValue * qt_defaultDpi() / 72.0. We need to convert this value back into points before writing as SVG. Therefore, all the metrics returned by the document are scaled with `fixQtDpi()`. Official Qt's way to workaround this problem is to set logicalDpiX/Y() values on the paint device's associated with the document. But it seems like in our version of Qt (5.12.12, which is rather old) it doesn't work properly. M +28 -5 libs/flake/text/KoSvgTextShapeMarkupConverter.cpp https://invent.kde.org/graphics/krita/commit/b655bfe1463234178775d530311286bcc2ae7f0b