View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0015099 | Scribus | Import / Export | public | 2018-01-15 23:43 | 2018-02-05 18:42 |
Reporter | christoph_s | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | x86_64 | OS | Windows | OS Version | 10 |
Product Version | 1.5.4.svn | ||||
Summary | 0015099: ZonerDraw import much worse than in LibreOffice | ||||
Description | I've attached a few ZMF sample files, the import result of which in Scribus is much worse than in LibreOffice, despite using the same import library. | ||||
Additional Information | Most problems seem to be related to the postioning and size of text frames and the scaling of bitmap images. | ||||
Tags | No tags attached. | ||||
Patch | No | ||||
|
|
|
Actually I don't even need to look at the attached samples--all I need is to check a few files from various DLP regression test suites :-) Scribus doesn't handle many of the properties the libraries emit. I'm starting working on improving that. |
|
0012-read-more-paragraph-props.patch (1,664 bytes)
From 427412448cfa80df7546bf684ce891751204e28a Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Sun, 28 Jan 2018 18:59:18 +0100 Subject: [PATCH 12/12] read more paragraph props --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index 11fc76ce2..88acb1042 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -1598,6 +1598,19 @@ void RawPainter::openParagraph(const librevenge::RVNGPropertyList &propList) lineSpIsPT = lsp.endsWith("pt"); lineSpSet = true; } + if (propList["fo:keep-together"]) + textStyle.setKeepTogether(propList["fo:keep-together"]->getStr() == "always"); + if (propList["fo:keep-with-next"]) + textStyle.setKeepWithNext(propList["fo:keep-with-next"]->getStr() == "always"); + if (propList["fo:orphans"]) + textStyle.setKeepLinesEnd(propList["fo:orphans"]->getInt()); + if (propList["fo:widows"]) + textStyle.setKeepLinesStart(propList["fo:widows"]->getInt()); + if (propList["fo:hyphenate"]) + textStyle.setHyphenationMode(propList["fo:hyphenate"]->getInt() ? ParagraphStyle::AutomaticHyphenation : ParagraphStyle::NoHyphenation); + if (propList["fo:hyphenation-ladder-count"] && propList["fo:hyphenation-ladder-count"]->getStr() != "no-limit") + // TODO: how to specify no-limit? 0? + textStyle.setHyphenConsecutiveLines(propList["fo:hyphenation-ladder-count"]->getInt()); } void RawPainter::closeParagraph() -- 2.14.3 0011-disable-text-flow-by-default.patch (1,002 bytes)
From 5363a0dc21cd03252f60502f3a686db88eec31d5 Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Sun, 28 Jan 2018 18:11:45 +0100 Subject: [PATCH 11/12] disable text flow by default --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index 46249df9d..11fc76ce2 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -3807,7 +3807,7 @@ void RawPainter::finishItem(PageItem* ite) } FPoint wh = getMaxClipF(&ite->PoLine); ite->setWidthHeight(wh.x(),wh.y(), true); - ite->setTextFlowMode(PageItem::TextFlowUsesBoundingBox); + ite->setTextFlowMode(PageItem::TextFlowDisabled); // TODO: get this from shape props m_Doc->adjustItemSize(ite); ite->OldB2 = ite->width(); ite->OldH2 = ite->height(); -- 2.14.3 0010-handle-text-language.patch (1,224 bytes)
From fbe00146da89af48f2c157b5ccb65d78821d7821 Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Sun, 28 Jan 2018 16:23:08 +0100 Subject: [PATCH 10/12] handle text language --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index 3fa4a8cf5..46249df9d 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -1697,6 +1697,16 @@ void RawPainter::openSpan(const librevenge::RVNGPropertyList &propList) if (propList["fo:hyphenate"]) styleEffects |= ScStyle_HyphenationPossible; // TODO: handle drop caps + if (propList["fo:language"]) + { + QStringList locale; + locale.append(propList["fo:language"]->getStr().cstr()); + if (propList["fo:script"]) + locale.append(propList["fo:script"]->getStr().cstr()); + if (propList["fo:country"]) + locale.append(propList["fo:country"]->getStr().cstr()); + textCharStyle.setLanguage(locale.join('_')); + } textCharStyle.setFeatures(styleEffects.featureList()); } -- 2.14.3 0009-handle-italic-style.patch (1,650 bytes)
From 025902959a3e95304fe5d421210bfb5e8f524ae8 Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Sun, 28 Jan 2018 16:14:44 +0100 Subject: [PATCH 09/12] handle italic style --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index 4cb0d52e7..3fa4a8cf5 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -1640,11 +1640,13 @@ void RawPainter::openSpan(const librevenge::RVNGPropertyList &propList) const librevenge::RVNGProperty *fontNameProp = propList["style:font-name"] ? propList["style:font-name"] : propList["fo:font-name"]; if (fontNameProp) { - QString fontVari; - if (propList["fo:font-weight"]) - fontVari = QString(propList["fo:font-weight"]->getStr().cstr()); + QStringList fontVari; + if (propList["fo:font-weight"] && propList["fo:font-weight"]->getStr() != "normal") + fontVari.append(propList["fo:font-weight"]->getStr().cstr()); + if (propList["fo:font-style"] && propList["fo:font-style"]->getStr() != "normal") + fontVari.append(propList["fo:font-style"]->getStr().cstr()); QString fontName = QString(fontNameProp->getStr().cstr()); - QString realFontName = constructFontName(fontName, fontVari); + QString realFontName = constructFontName(fontName, fontVari.join(' ')); textCharStyle.setFont((*m_Doc->AllFonts)[realFontName]); } StyleFlag styleEffects = textCharStyle.effects(); -- 2.14.3 0008-reduce-the-amount-of-copypasta.patch (1,960 bytes)
From 9b244ef94739301a198212b906cc8a661ace3abe Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Sun, 28 Jan 2018 13:28:03 +0100 Subject: [PATCH 08/12] reduce the amount of copypasta --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index 6b958390a..4cb0d52e7 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -1636,21 +1636,14 @@ void RawPainter::openSpan(const librevenge::RVNGPropertyList &propList) } if (propList["style:text-scale"] && propList["style:text-scale"]->getUnit() == librevenge::RVNG_PERCENT) textCharStyle.setScaleH(propList["style:text-scale"]->getDouble() * 1000); - if (propList["style:font-name"]) - { - QString fontVari; - if (propList["fo:font-weight"]) - fontVari = QString(propList["fo:font-weight"]->getStr().cstr()); - QString fontName = QString(propList["style:font-name"]->getStr().cstr()); - QString realFontName = constructFontName(fontName, fontVari); - textCharStyle.setFont((*m_Doc->AllFonts)[realFontName]); - } - if (propList["fo:font-name"]) + // NOTE: fo:font-name was only ever emitted by libfreehand, by a mistake + const librevenge::RVNGProperty *fontNameProp = propList["style:font-name"] ? propList["style:font-name"] : propList["fo:font-name"]; + if (fontNameProp) { QString fontVari; if (propList["fo:font-weight"]) fontVari = QString(propList["fo:font-weight"]->getStr().cstr()); - QString fontName = QString(propList["fo:font-name"]->getStr().cstr()); + QString fontName = QString(fontNameProp->getStr().cstr()); QString realFontName = constructFontName(fontName, fontVari); textCharStyle.setFont((*m_Doc->AllFonts)[realFontName]); } -- 2.14.3 0007-fix-meaning-of-style-text-scale.patch (1,287 bytes)
From 75c1f9823ca7bf9e69d479f701a3f1b470dd05ac Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Sun, 28 Jan 2018 13:13:19 +0100 Subject: [PATCH 07/12] fix meaning of style:text-scale --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index ca82c4adb..6b958390a 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -1634,8 +1634,8 @@ void RawPainter::openSpan(const librevenge::RVNGPropertyList &propList) textCharStyle.setFontSize(valueAsPoint(propList["fo:font-size"]) * 10.0); m_maxFontSize = qMax(m_maxFontSize, valueAsPoint(propList["fo:font-size"])); } - if (propList["style:text-scale"]) - textCharStyle.setFontSize(textCharStyle.fontSize() * fromPercentage(QString(propList["style:text-scale"]->getStr().cstr()))); + if (propList["style:text-scale"] && propList["style:text-scale"]->getUnit() == librevenge::RVNG_PERCENT) + textCharStyle.setScaleH(propList["style:text-scale"]->getDouble() * 1000); if (propList["style:font-name"]) { QString fontVari; -- 2.14.3 0006-improve-handling-of-sub-superscript.patch (1,745 bytes)
From b52b395ffd5bcf296fadfb0ea38053a13feacf5d Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Sat, 27 Jan 2018 20:10:45 +0100 Subject: [PATCH 06/12] improve handling of sub-/superscript --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index 273fe8738..ca82c4adb 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -1663,10 +1663,20 @@ void RawPainter::openSpan(const librevenge::RVNGPropertyList &propList) } if (propList["style:text-position"]) { - if (propList["style:text-position"]->getStr() == "50% 67%") - styleEffects |= ScStyle_Superscript; - else - styleEffects |= ScStyle_Subscript; + QStringList pos = QString(propList["style:text-position"]->getStr().cstr()).split(' ', QString::SkipEmptyParts); + if (pos.size() > 0) + { + if (pos[0] == "super") + styleEffects |= ScStyle_Superscript; + else if (pos[0] == "sub") + styleEffects |= ScStyle_Subscript; + else + textCharStyle.setBaselineOffset(textCharStyle.fontSize() * fromPercentage(pos[0]) * 10); + } + if (pos.size() > 1) + // TODO: Scribus makes font size for sub-/superscript smaller, so this doesn't match well. + // Multiply? Or use baseline offset instead of sub-/superscript? + textCharStyle.setFontSize(textCharStyle.fontSize() * fromPercentage(pos[1])); } if (propList["fo:font-variant"] && propList["fo:font-variant"]->getStr() == "small-caps") styleEffects |= ScStyle_SmallCaps; -- 2.14.3 0005-fix-outline-text-color.patch (1,810 bytes)
From 6cb460aa7997a4f5f57af8d7ba7202e837a424ce Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Wed, 24 Jan 2018 23:01:38 +0100 Subject: [PATCH 05/12] fix outline text color --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index 912b74f63..273fe8738 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -1636,8 +1636,6 @@ void RawPainter::openSpan(const librevenge::RVNGPropertyList &propList) } if (propList["style:text-scale"]) textCharStyle.setFontSize(textCharStyle.fontSize() * fromPercentage(QString(propList["style:text-scale"]->getStr().cstr()))); - if (propList["fo:color"]) - textCharStyle.setFillColor(parseColor(QString(propList["fo:color"]->getStr().cstr()))); if (propList["style:font-name"]) { QString fontVari; @@ -1677,7 +1675,18 @@ void RawPainter::openSpan(const librevenge::RVNGPropertyList &propList) if (propList["style:text-line-through-style"]) styleEffects |= ScStyle_Strikethrough; if (propList["style:text-outline"] && propList["style:text-outline"]->getInt()) + { styleEffects |= ScStyle_Outline; + textCharStyle.setFillColor("None"); + } + if (propList["fo:color"]) + { + const QString color = parseColor(QString(propList["fo:color"]->getStr().cstr())); + if (styleEffects & ScStyle_Outline) + textCharStyle.setStrokeColor(color); + else + textCharStyle.setFillColor(color); + } if (propList["style:text-shadow"]) // TODO: parse offsets styleEffects |= ScStyle_Shadowed; if (propList["fo:hyphenate"]) -- 2.14.3 0004-drop-unnecessary-copy.patch (975 bytes)
From a0bd06787b430cfd30ff6e20f3ba6af4171bee77 Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Wed, 24 Jan 2018 21:51:19 +0100 Subject: [PATCH 04/12] drop unnecessary copy --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index 0c44821f3..912b74f63 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -1742,8 +1742,7 @@ void RawPainter::insertText(const librevenge::RVNGString &text) } else textStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing); - librevenge::RVNGString tempUTF8(text); - QString actText = QString(tempUTF8.cstr()); + QString actText = QString(text.cstr()); if (actTextItem) { int posC = actTextItem->itemText.length(); -- 2.14.3 0003-do-not-trim-texts.patch (1,029 bytes)
From 45c5b7a2ed1f64f4d3b67f0ffec66b0d6d68c5cd Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Wed, 24 Jan 2018 21:50:09 +0100 Subject: [PATCH 03/12] do not trim texts This causes joined words on span boundaries. --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index d4a8d4077..0c44821f3 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -1756,7 +1756,6 @@ void RawPainter::insertText(const librevenge::RVNGString &text) QTextDocument texDoc; texDoc.setHtml(actText); actText = texDoc.toPlainText(); - actText = actText.trimmed(); actTextItem->itemText.insertChars(posC, actText); actTextItem->itemText.applyStyle(posC, textStyle); actTextItem->itemText.applyCharStyle(posC, actText.length(), textCharStyle); -- 2.14.3 |
|
Okay, here's the first batch of patches, improving text and paragraph formatting. Pending are lists (not implemented at all), tables (ditto), ellipses (implemented, but nothing is drawn for some reason), dashes, gradients, arrows and bitmaps. |
|
... and two more patches that were silently dropped before. 0002-handle-more-style-effects.patch (2,029 bytes)
From 24af24d367956a5c05a65bf0443bf5512e4ac0eb Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Wed, 24 Jan 2018 21:25:55 +0100 Subject: [PATCH 02/12] handle more style effects --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index 06e4c3d27..d4a8d4077 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -1658,7 +1658,11 @@ void RawPainter::openSpan(const librevenge::RVNGPropertyList &propList) } StyleFlag styleEffects = textCharStyle.effects(); if (propList["style:text-underline-type"]) + { styleEffects |= ScStyle_Underline; + if (propList["style:text-underline-mode"] && propList["style:text-underline-mode"]->getStr() == "skip-white-space") + styleEffects |= ScStyle_UnderlineWords; + } if (propList["style:text-position"]) { if (propList["style:text-position"]->getStr() == "50% 67%") @@ -1666,6 +1670,19 @@ void RawPainter::openSpan(const librevenge::RVNGPropertyList &propList) else styleEffects |= ScStyle_Subscript; } + if (propList["fo:font-variant"] && propList["fo:font-variant"]->getStr() == "small-caps") + styleEffects |= ScStyle_SmallCaps; + if (propList["fo:text-transform"] && propList["fo:text-transform"]->getStr() == "uppercase") + styleEffects |= ScStyle_AllCaps; + if (propList["style:text-line-through-style"]) + styleEffects |= ScStyle_Strikethrough; + if (propList["style:text-outline"] && propList["style:text-outline"]->getInt()) + styleEffects |= ScStyle_Outline; + if (propList["style:text-shadow"]) // TODO: parse offsets + styleEffects |= ScStyle_Shadowed; + if (propList["fo:hyphenate"]) + styleEffects |= ScStyle_HyphenationPossible; + // TODO: handle drop caps textCharStyle.setFeatures(styleEffects.featureList()); } -- 2.14.3 0001-better-way-to-handle-unit-conversion.patch (1,284 bytes)
From ed4efa5d22803e21881839a9f46492e15eae6962 Mon Sep 17 00:00:00 2001 From: David Tardon <dtardon@redhat.com> Date: Wed, 24 Jan 2018 21:02:39 +0100 Subject: [PATCH 01/12] better way to handle unit conversion --- Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp index 6bebb3bd0..06e4c3d27 100644 --- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp +++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp @@ -1767,13 +1767,15 @@ void RawPainter::insertField(const librevenge::RVNGPropertyList &propList) double RawPainter::valueAsPoint(const librevenge::RVNGProperty *prop) { - double value = 0.0; - QString str = QString(prop->getStr().cstr()).toLower(); - if (str.endsWith("in")) - value = prop->getDouble() * 72.0; - else - value = prop->getDouble(); - return value; + switch (prop->getUnit()) + { + case librevenge::RVNG_INCH: + return prop->getDouble() * 72.0; + case librevenge::RVNG_TWIP: + return prop->getDouble() / 20.0; + default: + return prop->getDouble(); + } } void RawPainter::applyFill(PageItem* ite) -- 2.14.3 |
|
Thanks, I've applied all of your patches. |
Date Modified | Username | Field | Change |
---|---|---|---|
2018-01-15 23:43 | christoph_s | New Issue | |
2018-01-15 23:43 | christoph_s | File Added: ZD-Test1.7z | |
2018-01-23 20:56 | dtardon | Note Added: 0044865 | |
2018-01-28 19:14 | dtardon | File Added: 0012-read-more-paragraph-props.patch | |
2018-01-28 19:14 | dtardon | File Added: 0011-disable-text-flow-by-default.patch | |
2018-01-28 19:14 | dtardon | File Added: 0010-handle-text-language.patch | |
2018-01-28 19:14 | dtardon | File Added: 0009-handle-italic-style.patch | |
2018-01-28 19:14 | dtardon | File Added: 0008-reduce-the-amount-of-copypasta.patch | |
2018-01-28 19:14 | dtardon | File Added: 0007-fix-meaning-of-style-text-scale.patch | |
2018-01-28 19:14 | dtardon | File Added: 0006-improve-handling-of-sub-superscript.patch | |
2018-01-28 19:14 | dtardon | File Added: 0005-fix-outline-text-color.patch | |
2018-01-28 19:14 | dtardon | File Added: 0004-drop-unnecessary-copy.patch | |
2018-01-28 19:14 | dtardon | File Added: 0003-do-not-trim-texts.patch | |
2018-01-28 21:08 | dtardon | Note Added: 0044884 | |
2018-01-28 21:09 | dtardon | File Added: 0002-handle-more-style-effects.patch | |
2018-01-28 21:09 | dtardon | File Added: 0001-better-way-to-handle-unit-conversion.patch | |
2018-01-28 21:09 | dtardon | Note Added: 0044885 | |
2018-02-05 18:42 | jghali | Note Added: 0044919 |