Bug 67873 - libcdr missing empty lines
Summary: libcdr missing empty lines
Status: RESOLVED FIXED
Alias: None
Product: Document Liberation Project
Classification: Unclassified
Component: libcdr (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium minor
Assignee: David Tardon
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-07 16:49 UTC by spam
Modified: 2017-10-30 11:23 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
demo of bug (14.53 KB, application/x-coreldraw)
2013-08-07 16:49 UTC, spam
Details
The attachment 83794 exported by CorelDraw (5.81 KB, application/rtf)
2013-08-23 10:12 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
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.