[cups.bugs] [HIGH] STR #2347: Text filter not updating column count for 17cpi

Joe Julian joe at julianfamily.org
Thu Apr 19 15:46:37 PDT 2007


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

The problem exists in paps' use of pango. The following kludge solved my
printing problems for me. This kludge set pango not to wrap the lines.
Since paps is already wrapping lines, it seemed rather redundant to let
pango do it too. Somewhere in paps, the line length is miscalculated if
there's a carriage return preceding the line feed. This hack works around
that problem too.

*** 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;

Link: http://www.cups.org/str.php?L2347
Version: 1.2-current





More information about the cups-devel mailing list