~ubuntu-branches/debian/experimental/cups-filters/experimental

« back to all changes in this revision

Viewing changes to debian/local/textonly

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter
  • Date: 2012-07-28 11:54:32 UTC
  • mfrom: (1.1.17) (22 sid)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: package-import@ubuntu.com-20120728115432-p5fgn9hv6du22cqa
Tags: 1.0.20-1
* New upstream release
   - pdftops: Added another workaround for Kyocera printers: Some
     models get very slow on images which request interpolation,
     so now we remove the image interpolation requests by additional
     PostScript code only inserted for Kyocera printers (LP: #1026974).
   - Made the Poppler-based filters pdftopdf and pdftoopvp build with
     both Poppler 0.18.x and 0.20.x (Upstream bug #1055).
   - Fixes according to Coverity scan results (Upstream bug #1054).
   - Switched build system to autotools. This especially fixes several
     build problems in Gentoo. Also build-tested with CUPS 1.6.0b1.
   - Fixes for compatibility with clang/gcc-4.7.
   - textonly: Filter did not work as a pipe with copies=1 (Upstream bug
     #1032).
   - texttopdf: Avoid trimming the results of FcFontSort(), as this may
     miss some reasonable candidates under certain circumstances. BTW,
     fix passing a non-pointer as a pointer to "result" (Closes: #670055).
   - Corrected documentation. The option for the maximum image rendering
     resolution in pdftops is "pdftops-max-image-resolution", not
     "pdftops-max-image-resolution-default".
* debian/patches/fcfontsort-no-trim.patch: Removed, fixed upstream.
* debian/rules: Updated options for ./configure and make for the new autotools
  build system.
* debian/watch: Switched to bz2 upstream packages.
* debian/rules, debian/copyright, debian/cups-filters.docs: Updated for
  renamed documentation files.
* debian/control, debian/libfontembed1.install,
  debian/libfontembed-dev.install: Added new binary packages for libfontembed.
* debian/copyright: Updated for recent file additions, and rearrangement of
  directories.
* debian/control: Added missing build dependency on libpoppler-cpp-dev.
* debian/copyright: Corrections (Closes: #682752).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
## Copyright (C) 2003-2006 Red Hat, Inc.
3
 
## Copyright (C) 2003-2006 Tim Waugh <twaugh@redhat.com>
4
 
## Changed on 2007/05/17, Opher Shachar, LADPC Ltd.
5
 
##     Added support for page-ranges option.
6
 
##     Added page accounting.
7
 
 
8
 
## This program is free software; you can redistribute it and/or modify
9
 
## it under the terms of the GNU General Public License as published by
10
 
## the Free Software Foundation; either version 2 of the License, or
11
 
## (at your option) any later version.
12
 
 
13
 
## This program is distributed in the hope that it will be useful,
14
 
## but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
## GNU General Public License for more details.
17
 
 
18
 
## You should have received a copy of the GNU General Public License
19
 
## along with this program; if not, write to the Free Software
20
 
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
 
 
22
 
if [ $# == 0 ]; then
23
 
  echo >&2 "ERROR: $0 job-id user title copies options [file]"
24
 
  exit 1
25
 
fi
26
 
 
27
 
# Extract the papersize
28
 
SENDFF=`grep '^\*DefaultSendFF' "$PPD" | cut -d\  -f2`
29
 
COPIES=1
30
 
if [ $# -ge 4 ]; then
31
 
  COPIES="$4"
32
 
fi
33
 
 
34
 
if [ "$COPIES" -gt 1 ] && [ $# -lt 6 ]; then
35
 
  unset TMPFILE
36
 
  trap -- 'rm -f "$TMPFILE"' EXIT
37
 
  TMPFILE=$(mktemp ${TMPDIR:-/tmp}/textonly.XXXXXX)
38
 
  cat > "$TMPFILE"
39
 
else
40
 
  TMPFILE="$6"
41
 
fi
42
 
 
43
 
PR=${5#*page-ranges=}
44
 
# Do options specify page-ranges?
45
 
if [[ "$PR" != "$5" ]]; then
46
 
  PR=${PR%% *}
47
 
else
48
 
  #unset PR
49
 
  PR=1-999999
50
 
fi
51
 
 
52
 
if [[ "$PR" ]]; then
53
 
  TMPFILE2=$(mktemp ${TMPDIR:-/tmp}/textonly2.XXXXXX)
54
 
  pagenum=0
55
 
  EOF=
56
 
  { 
57
 
  while [[ "$PR" ]]; do
58
 
    pl=${PR%%,*}                ;# take first subrange
59
 
    PR=${PR#$pl};PR=${PR#,}     ;# remove from range list
60
 
    pu=${pl#*-}                 ;# extract upper and lower
61
 
    pl=${pl%-*}                 ;# pages of subrange
62
 
    # Allows interpreting 0-5,3-10 as 1-5,6-10 rejects 5-1 or 1-
63
 
    (( pagenum >= pl )) && pl=$(( pagenum + 1 ))
64
 
    (( pl > pu )) && continue
65
 
    
66
 
    # Loop reading pages until at or over lower page of subrange.
67
 
    while read -d `echo -ne '\f'` -r; do
68
 
      (( pagenum++ ))
69
 
      (( pagenum == pl )) && break
70
 
    done
71
 
    # Did we reach lower page of subrange or EOF?
72
 
    if (( pagenum < pl )); then
73
 
      [[ ! "$REPLY" ]] && break         ;# empty last page - we're done.
74
 
      (( pagenum++ ))
75
 
      EOF=y
76
 
    fi
77
 
    # Output page and report to page log
78
 
    if (( pagenum == pl )); then
79
 
      echo -n "${REPLY}" >>"$TMPFILE2"
80
 
      # If EOF then page has no final FF
81
 
      [[ ! "$EOF" ]] && echo -ne '\f' >>"$TMPFILE2"
82
 
      echo "PAGE: $pagenum $COPIES" >&2
83
 
    fi
84
 
    [[ "$EOF" ]] && break
85
 
    # Is the current subrange a single page?
86
 
    (( pagenum == pu )) && continue
87
 
    while read -d `echo -ne '\f'` -r; do
88
 
      (( pagenum++ ))
89
 
      echo -ne "${REPLY}\f" >>"$TMPFILE2"
90
 
      echo "PAGE: $pagenum $COPIES" >&2
91
 
      (( pagenum == pu )) && break
92
 
    done
93
 
    # Could be that we reached EOF before page boundry
94
 
    if (( pagenum < pu )); then
95
 
      if [[ "$REPLY" ]]; then
96
 
        (( pagenum++ ))
97
 
        echo -n "${REPLY}" >>"$TMPFILE2"
98
 
        echo "PAGE: $pagenum $COPIES" >&2
99
 
      fi
100
 
      break
101
 
    fi
102
 
  done
103
 
  } <"$TMPFILE"
104
 
else
105
 
  TMPFILE2="$TMPFILE"
106
 
  pc=$(grep -co `echo -ne '\f'` "$TMPFILE2")
107
 
  pc=$(( pc * $COPIES ))
108
 
  echo "PAGE: $pc" >&2
109
 
fi
110
 
 
111
 
while [ "$COPIES" -gt 0 ]; do
112
 
  # Just translate LF->CRLF at the moment, until the PPD has options added.
113
 
  sed -e 's/$/'`echo -ne '\r'`'/g' "$TMPFILE2"
114
 
 
115
 
  if [ "$SENDFF" == "True" ]
116
 
    then
117
 
    echo -ne \\014
118
 
  fi
119
 
 
120
 
  COPIES=$(($COPIES - 1))
121
 
done
122
 
# Cleanup
123
 
[[ "$TMPFILE" != "$TMPFILE2" ]] && rm -f "$TMPFILE2"
124
 
exit 0