Bug 67873

Summary: libcdr missing empty lines
Product: LibreOffice Reporter: spam
Component: filters and storageAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact:
Severity: minor    
Priority: medium CC: dtardon, fridrich.strba
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: demo of bug
The attachment 83794 exported by CorelDraw

Description spam 2013-08-07 16:49:39 UTC
Created attachment 83794 [details]
demo of bug

Hi there, I just git cloned the latest master of libcdr and used cdr2text (& the various other tools) to reproduce. If I have a text box with text containing any blank lines, the code strips these blank lines out. Attached is a sample file demonstrating the issue. Below is a hack patch to libcdr which produces the correct output by inserting a line with a single space.

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index ec76a21..08f5e44 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -3032,6 +3032,10 @@ void libcdr::CDRParser::readTxsm(WPXInputStream *input, unsigned length)
         memcpy(&textData[0], buffer, numBytesRead);
       input->seek(1, WPX_SEEK_CUR); //skip the 0 ending character
 
+  if (textData.empty()) {
+    textData.push_back(' ');
+    charDescriptions.push_back(0);
+  }
       if (!textData.empty())
         m_collector->collectText(textId, stlId, textData, charDescriptions, charStyles);
     }
Comment 1 Mike Kaganski 2013-08-07 23:20:24 UTC
Fridrich, this is a libcdr issue with a patch, I cannot confirm it, could you please take a look?
Comment 2 Mike Kaganski 2013-08-07 23:29:06 UTC
@OP: it would be helpful for confirmation if you provided a PDF of the testcase made with Corel Draw (to compare with LO import), and maybe a text file with the text that must be there in the box (including all the empty lines).

Thank you.
Comment 3 spam 2013-08-15 11:53:16 UTC
Hi there, the page is just one text box with some boundrary markers. The text should read as below; however in cdr git it was not including any of the blank lines:

Ek 4                                              Söz: Efesliler 5:1
                                                     Cathryn Hoard
                                        Müzik: Cathryn Hoard

C                         F             C  F
Tanrı sizi Mesih'te bağışladı,
C                   F                  C  F
İsa sizin için çarmıha gerildi.
                F               C          F          C         G
KORO:   |: Bunun için sevgili cocukları olarak 
                          F G             C
Tanrı'yı   örnek alın! :|

C                        F                              C    F
Mesih bizi nasıl sevdiyse biz de sevelim.
C                F                        C   F
Efesliler beşinci bölüm ayet bir.
        KORO

             F G             C
|: Tanrı'yı   örnek alın! :|
Comment 4 Mike Kaganski 2013-08-23 10:08:47 UTC
Reproducible with 4.1.0.4 under Win7x64.
Comment 5 Mike Kaganski 2013-08-23 10:12:45 UTC
Created attachment 84511 [details]
The attachment 83794 [details] exported by CorelDraw

In this file, the original characters of the testcase from comment 0 (including correct whitespace characters and empty lines), that should be imported by Draw, are easily available.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.