Bug 237202

Summary: paps incorrectly breaks lines at 17cpi
Product: [Fedora] Fedora Reporter: Joe Julian <joe>
Component: papsAssignee: Akira TAGOH <tagoh>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6CC: eng-i18n-bugs, iav, triage, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: bzcl34nup
Fixed In Version: 0.6.8-1.fc6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-04-07 11:11:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joe Julian 2007-04-19 23:16:41 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.9) Gecko/20070131 Fedora/1.5.0.9-2.fc6 Firefox/1.5.0.9 pango-text

Description of problem:
I have a text document I was trying to print at 17cpi. The document was regularly having it's lines broken at 80 columns, even with wrapping turned off. I tracked the problem to paps.

The lines are broken at the first space preceding 80 columns. The problem seems to be related to the use of pango. The following hack worked around the problem. A seemingly related problem has to do with crlf line termination. If lines are terminated with crlf, the line length seems to be mis-calculated and will insert extra lines.



Version-Release number of selected component (if applicable):
paps-0.6.6-19

How reproducible:
Always


Steps to Reproduce:
1. Start with a 132 column text file. Normal word breaks, crlf terminated lines.
2. paps --cpi=17 --left-margin=18 --right-margin=18 --paper=letter {filename.txt} >foo.ps
3. ggv foo.ps

Actual Results:
The lines are printed at 17 cpi but are broken at the first word break before 80 columns.

Expected Results:
The lines should have extended to the full 132 columns.

Additional info:
The following ugly hack cured the problem:

*** old/paps.c  2007-04-19 15:44:58.000000000 -0700
--- new/paps.c  2007-04-19 15:45:12.000000000 -0700
***************
*** 754,759 ****
--- 754,760 ----
                }
              /* the amount of characters to be able to put on the line against CPI */
              n = page_layout->column_width / 72.0 * cpi;
+ 
              if (len > n)
                {
                  len = wcslen (wtext);
***************
*** 787,792 ****
--- 788,794 ----
                        exit(1);
                    }
  
+                 pango_layout_set_width (para->layout, -1);
                  pango_layout_set_text (para->layout, newtext, -1);
                  pango_layout_get_extents (para->layout, &ink_rect, &logical_rect);
                  /* update paint_width to wrap_against CPI */
***************
*** 796,807 ****
                }
              g_free (wtext);
            }
            pango_layout_set_text (para->layout, para->text, para->length);
            pango_layout_set_justify (para->layout, page_layout->do_justify);
            pango_layout_set_alignment (para->layout,
                                        page_layout->pango_dir == PANGO_DIRECTION_LTR
                                        ? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT);
!           pango_layout_set_width (para->layout, paint_width * PANGO_SCALE);
            if (page_layout->do_wordwrap)
                pango_layout_set_wrap (para->layout, PANGO_WRAP_WORD_CHAR);
            para->height = 0;
--- 798,811 ----
                }
              g_free (wtext);
            }
+           if ( para->text[para->length-1] == '\r' && para->length > 0) para->length--;
+         pango_layout_set_width (para->layout, -1);
            pango_layout_set_text (para->layout, para->text, para->length);
            pango_layout_set_justify (para->layout, page_layout->do_justify);
            pango_layout_set_alignment (para->layout,
                                        page_layout->pango_dir == PANGO_DIRECTION_LTR
                                        ? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT);
!           //pango_layout_set_width (para->layout, paint_width * PANGO_SCALE);
            if (page_layout->do_wordwrap)
                pango_layout_set_wrap (para->layout, PANGO_WRAP_WORD_CHAR);
            para->height = 0;

Comment 1 Akira TAGOH 2007-11-30 11:55:14 UTC
should be fixed in 0.6.8-1.fc9. please check with it and will backport the fix
to other versions then.

Comment 2 Akira TAGOH 2007-12-03 03:48:16 UTC
pushed the update for FC-6, F-7 and F-8.

Comment 3 Bug Zapper 2008-04-04 06:53:49 UTC
Fedora apologizes that these issues have not been resolved yet. We're
sorry it's taken so long for your bug to be properly triaged and acted
on. We appreciate the time you took to report this issue and want to
make sure no important bugs slip through the cracks.

If you're currently running a version of Fedora Core between 1 and 6,
please note that Fedora no longer maintains these releases. We strongly
encourage you to upgrade to a current Fedora release. In order to
refocus our efforts as a project we are flagging all of the open bugs
for releases which are no longer maintained and closing them.
http://fedoraproject.org/wiki/LifeCycle/EOL

If this bug is still open against Fedora Core 1 through 6, thirty days
from now, it will be closed 'WONTFIX'. If you can reporduce this bug in
the latest Fedora version, please change to the respective version. If
you are unable to do this, please add a comment to this bug requesting
the change.

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we are following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

And if you'd like to join the bug triage team to help make things
better, check out http://fedoraproject.org/wiki/BugZappers

Comment 4 Akira TAGOH 2008-04-07 11:11:48 UTC
This bug was actually on MODIFIED state. so closing.