File: fixfmps

package info (click to toggle)
psutils 3.3.8-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,248 kB
  • sloc: python: 2,955; perl: 233; makefile: 25
file content (20 lines) | stat: -rwxr-xr-x 538 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl
# fixfmps: get conforming PostScript out of FrameMaker version 2 file
# move all FMDEFINEFONTs to start of pages
#
# Copyright (C) Angus J. C. Duggan 1991-1995
# See file LICENSE for details.

%fonts=();

while (<>) {
   if (/^([0-9]+) [0-9]+ .* FMDEFINEFONT$/) {
      $fonts{$1} = $_;
   } elsif (/^[0-9.]+ [0-9.]+ [0-9]+ FMBEGINPAGE$/) {
      print $_, join('',values(%fonts));
   } elsif (m%(.*/PageSize \[paperwidth paperheight\]put )setpagedevice(.*)%) {
      print "$1pop$2\n";
   } else {
      print $_;
   }
}