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++

Try to save text with inline-size better to PSD.

Wolthera van Hövell tot Westerflier23899b58a646
diff --git a/libs/psd/psd_layer_section.cpp b/libs/psd/psd_layer_section.cpp
index 2dbf920e5f..c799ecde2a 100644
--- a/libs/psd/psd_layer_section.cpp
+++ b/libs/psd/psd_layer_section.cpp
@@ -745,6 +745,18 @@ void PSDLayerMaskSection::writePsdImpl(QIODevice &io, KisNodeSP rootLayer, psd_c
svgConverter.convertToSvg(&svgtext, &styles);
// unsure about the boundingBox, needs more research.
textData.boundingBox = text->boundingRect().normalized();
+ if (text->shapesInside().isEmpty()) {
+ // Scale bbox to inline
+ const KoSvgText::AutoValue inlineSizeProp =
+ text->textProperties().property(KoSvgTextProperties::InlineSizeId).value<KoSvgText::AutoValue>();
+ if (!inlineSizeProp.isAuto) {
+ if (text->writingMode() == KoSvgText::HorizontalTB) {
+ textData.boundingBox.setWidth(inlineSizeProp.customValue);
+ } else {
+ textData.boundingBox.setHeight(inlineSizeProp.customValue);
+ }
+ }
+ }
textData.bounds = text->outlineRect().normalized();
bool res = convert.convertToPSDTextEngineData(svgtext, textData.bounds, text->shapesInside(), globalInfoSection.txt2Data, textData.textIndex, textData.text, textData.isHorizontal, FlaketoPixels);