/usr/bin/ogonkify is in a2ps 1:4.14-1.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | #!/usr/bin/perl
# Convert the PostScript output of Netscape to use an arbitrary encoding.
# Do font remapping if asked for.
# By J. Chroboczek <jec at dcs.ed.ac.uk>
#
# Copyright (c) 1996-1999 by J. Chroboczek
# This code may be distributed under the terms of the
# GNU Public License, either version 3 of the license, or (at your
# option) any later version.
# Time-stamp: <99/05/14 04:09:10 jec>
# Warning: this program is written in Perl
$PROGNAME='ogonkify';
$VERSION='v. 0.7.0 by J. Chroboczek';
# Directory with the IBM Courier fonts
$IBMFONTS="";
# Directory with ogonkify's prologs
$LIBDIR="/usr/share/ogonkify";
@procsets=();
@downloadFonts=();
$encoding='L2';
%encodings=('L1',"$LIBDIR/latin1.enc",'L2',"$LIBDIR/latin2.enc",
'L3',"$LIBDIR/latin3.enc",'L4',"$LIBDIR/latin4.enc",
'L5',"$LIBDIR/latin5.enc",'L6',"$LIBDIR/latin6.enc",
'L7',"$LIBDIR/latin7.enc",'L9',"$LIBDIR/latin9.enc",
'CP1250',"$LIBDIR/cp1250.enc",'cp1250',"$LIBDIR/cp1250.enc",
'ibmpc',"$LIBDIR/ibmpc.enc",'mac',"$LIBDIR/mac.enc",
'HP',"$LIBDIR/hp.enc");
%encodingvecs=('L1','ISOLatin1Encoding','L2','ISOLatin2Encoding',
'L3','ISOLatin3Encoding','L4','ISOLatin4Encoding',
'L5','ISOLatin5Encoding','L6','ISOLatin6Encoding',
'L7','ISOLatin7Encoding','L9','ISOLatin9Encoding',
'CP1250','CP1250Encoding','cp1250','CP1250Encoding',
'ibmpc','IBMPCEncoding', 'mac','MacintoshEncoding',
'HP','HPRomanEncoding');
@standardFont=
('Courier', 'Courier-Oblique', 'Courier-Bold', 'Courier-BoldItalic',
'Times-Roman', 'Times-Italic', 'Times-Bold', 'Times-BoldItalic',
'Helvetica', 'Helvetica-Oblique', 'Helvetica-Bold',
'Helvetica-BoldOblique');
%remappings=();
$doNetscape=0;
$doMosaic=0;
$doStarOffice=0;
$doApplixWare=0;
$doXfig=0;
$doMp=0;
$recodeStandardFonts=0;
$eurify=0;
sub courierRemappings {
$remappings{'Courier-Oblique'}="Courier-Italic";
$remappings{'Courier-BoldOblique'}="Courier-BoldItalic";
if($doApplixWare) {
$remappings{'Courier_AX'}="Courier";
$remappings{'Courier-Bold_AX'}="Courier-Bold";
$remappings{'Courier-Oblique_AX'}="Courier-Italic";
$remappings{'Courier-BoldOblique_AX'}="Courier-BoldItalic";
}
}
sub timesRemappings {
$remappings{'Times-Roman'}="Times-Roman-Ogonki";
$remappings{'Times-Bold'}="Times-Bold-Ogonki";
$remappings{'Times-Italic'}="Times-Italic-Ogonki";
$remappings{'Times-BoldItalic'}="Times-BoldItalic-Ogonki";
if($doApplixWare) {
$remappings{'Times-Roman_AX'}="Times-Roman-Ogonki";
$remappings{'Times-Bold_AX'}="Times-Bold-Ogonki";
$remappings{'Times-Italic_AX'}="Times-Italic-Ogonki";
$remappings{'Times-BoldItalic_AX'}="Times-BoldItalic-Ogonki";
}
}
sub helveticaRemappings {
$remappings{'Helvetica'}="Helvetica-Ogonki";
$remappings{'Helvetica-Bold'}="Helvetica-Bold-Ogonki";
$remappings{'Helvetica-Oblique'}="Helvetica-Oblique-Ogonki";
$remappings{'Helvetica-BoldOblique'}="Helvetica-BoldOblique-Ogonki";
if($doApplixWare) {
$remappings{'Helvetica_AX'}="Helvetica-Ogonki";
$remappings{'Helvetica-Bold_AX'}="Helvetica-Bold-Ogonki";
$remappings{'Helvetica-Oblique_AX'}="Helvetica-Oblique-Ogonki";
$remappings{'Helvetica-BoldOblique_AX'}="Helvetica-BoldOblique-Ogonki";
}
}
sub adobeCourierRemappings {
$remappings{'Courier'}="Courier-Ogonki";
$remappings{'Courier-Bold'}="Courier-Bold-Ogonki";
$remappings{'Courier-Oblique'}="Courier-Oblique-Ogonki";
$remappings{'Courier-BoldOblique'}="Courier-BoldOblique-Ogonki";
if($doApplixWare) {
$remappings{'Courier_AX'}="Courier-Ogonki";
$remappings{'Courier-Bold_AX'}="Courier-Bold-Ogonki";
$remappings{'Courier-Oblique_AX'}="Courier-Oblique-Ogonki";
$remappings{'Courier-BoldOblique_AX'}="Courier-BoldOblique-Ogonki";
}
}
sub courierFonts {
while(<$IBMFONTS>) {
$downloadFonts[$#downloadFonts+1]=$_;
}
}
sub timesFonts {
$compositeProcset=TRUE;
$downloadFonts[$#downloadFonts+1]="$LIBDIR/ptmr-o.ps";
$downloadFonts[$#downloadFonts+1]="$LIBDIR/ptmri-o.ps";
$downloadFonts[$#downloadFonts+1]="$LIBDIR/ptmb-o.ps";
$downloadFonts[$#downloadFonts+1]="$LIBDIR/ptmbi-o.ps";
}
sub adobeCourierFonts {
$compositeProcset=TRUE;
$downloadFonts[$#downloadFonts+1]="$LIBDIR/pcrr-o.ps";
$downloadFonts[$#downloadFonts+1]="$LIBDIR/pcrro-o.ps";
$downloadFonts[$#downloadFonts+1]="$LIBDIR/pcrb-o.ps";
$downloadFonts[$#downloadFonts+1]="$LIBDIR/pcrbo-o.ps";
}
sub helveticaFonts {
$compositeProcset=TRUE;
$downloadFonts[$#downloadFonts+1]="$LIBDIR/phvr-o.ps";
$downloadFonts[$#downloadFonts+1]="$LIBDIR/phvro-o.ps";
$downloadFonts[$#downloadFonts+1]="$LIBDIR/phvb-o.ps";
$downloadFonts[$#downloadFonts+1]="$LIBDIR/phvbo-o.ps";
}
sub procset {
local($ps)=@_;
open(PROCSET,$ps);
if($_=<PROCSET>) {
print;
} else {
die "File $ps not found; stopped";
}
while(<PROCSET>) {
print;
}
}
sub downloadFont {
local($ps)=@_;
# print("%%BeginResource: font $ps\n"); # this is not DSC conforming
open(PROCSET,$ps);
if($_=<PROCSET>) {
print;
} else {
die "File $ps not found; stopped";
}
while(<PROCSET>) {
print;
}
print("%%EndResource\n");
}
sub remap {
local($from,$to,$newencoding)=@_;
print <<"ALAMAKOTA";
/$to findfont
dup length 1 add dict begin
{1 index /FID ne {def} {pop pop} ifelse} forall
ALAMAKOTA
if($newencoding) {
print "/Encoding $newencoding def\n";
}
print <<"ALAMAKOTA";
currentdict end
/$from exch definefont pop
ALAMAKOTA
}
sub eurifyFont {
local($name)=@_;
print "/$name /$name eurifyFont\n";
}
sub usage {
local($oldfh)=select(STDERR);
print <<"ALAMAKOTA";
$PROGNAME $VERSION
$PROGNAME -p<procset> -e<encoding> -rOld=New
-a -c -h -t -A -C -H -T -AT -CT -ATH -CTH -E
-N -M -mp -SO -AX -F -RS
-- file ...
ALAMAKOTA
select($oldfh);
}
while(defined($_ = $ARGV[0]) && /^-/) {
shift;
if(/^--$/) {last;}
elsif (/^-p$/) { $procsets[$#procsets+1]=$ARGV[0]; shift; }
elsif (/^-p(.*)/) { $procsets[$#procsets+1]=$1; }
elsif (/^-e$/) { $encoding=$ARGV[0]; shift; }
elsif (/^-e(.*)/) { $encoding=$1 ; }
elsif (/^-r(.*)=(.*)/) { $remappings{$1}=$2; }
elsif (/^-c$/) { &courierRemappings; }
elsif (/^-C$/) { &courierRemappings; &courierFonts; }
elsif (/^-a$/) { &adobeCourierRemappings; }
elsif (/^-t$/) { ×Remappings; }
elsif (/^-h$/) { &helveticaRemappings ; }
elsif (/^-T$/) { ×Remappings; ×Fonts; }
elsif (/^-A$/) { &adobeCourierRemappings; &adobeCourierFonts; }
elsif (/^-H$/) { &helveticaRemappings; &helveticaFonts; }
elsif (/^-CT$/){ &courierRemappings; ×Remappings;
&courierFonts; ×Fonts; }
elsif (/^-AT$/){ &adobeCourierRemappings; ×Remappings;
&adobeCourierFonts; ×Fonts; }
elsif (/^-CTH$/){ &courierRemappings; ×Remappings; &helveticaRemappings;
&courierFonts; ×Fonts; &helveticaFonts; }
elsif (/^-ATH$/){ &adobeCourierRemappings; ×Remappings;
&helveticaRemappings;
&adobeCourierFonts; ×Fonts; &helveticaFonts; }
elsif(/^-E$/) { $compositeProcset=TRUE; $eurify=TRUE; }
elsif (/^-RS$/) { $recodeStandardFonts=TRUE; }
elsif (/^-N$/) { $doNetscape=TRUE; }
elsif (/^-SO$/) { $doStarOffice=TRUE; }
elsif (/^-AX$/) { $doApplixWare=TRUE; }
elsif (/^-M$/) { $doMosaic=TRUE; }
elsif (/^-mp$/) { $doMp=TRUE; }
elsif (/^-F$/) { $doXfig=TRUE; }
else { &usage ; die "\n"; }
}
if(!$encodings{$encoding}) {
die "Unknown encoding $encoding";
}
$where=0;
while(<>) {
if($where==0) {
print;
if(($doMosaic || $doMp) && /^%%EndComments/) {
$_="%%BeginProlog\n";
print;
}
if(/^%%BeginProlog/) {
$where=1;
&procset($encodings{$encoding});
if($compositeProcset) {
&procset("$LIBDIR/compose.ps");
&procset("$LIBDIR/ogonki.enc");
}
for(@procsets) {
&procset($_);
}
for(@downloadFonts) {
&downloadFont($_);
}
if($eurify) {
for(@standardFont) {
&eurifyFont($_);
}
}
while(($from,$to)=each %remappings) {
&remap($from,$to);
}
if($recodeStandardFonts) {
for(@standardFont) {
&remap($_, $_,
$encodingvecs{$encoding});
}
}
}
} elsif($where==1) {
if(/^%%EndProlog/) {
$where=2;
} else {
if ($doNetscape && m|/Encoding[ \t]+isolatin1encoding[ \t]*def|) {
s/isolatin1encoding/$encodingvecs{$encoding}/;
} elsif ($doMosaic && m|/Encoding[ \t]+ISOLatin1Encoding[ \t]*D|) {
s/ISOLatin1Encoding/$encodingvecs{$encoding}/;
} elsif ($doMp && m|/Encoding[ \t]+ISOLatin1Encoding[ \t]*def|) {
s/ISOLatin1Encoding/$encodingvecs{$encoding}/;
} elsif ($doStarOffice && m/ISOLatin1Encoding/) {
s/ISOLatin1Encoding/$encodingvecs{$encoding}/;
} elsif ($doXfig &&
m|/([^ \t]+)[ \t]+/([^ \t]+)[ \t]+isovec[ \t]+ReEncode|) {
&remap($2,$1,$encodingvecs{$encoding});
next;
}
}
print;
} elsif($where==2) {
print;
}
}
### Local Variables: ***
### mode: perl ***
### End: ***
|