| 1 |
README for project pkfix 2012/04/18 v1.7 |
| 2 |
|
| 3 |
TABLE OF CONTENTS |
| 4 |
================= |
| 5 |
A. Project pkfix |
| 6 |
B. Copyright, Disclaimer, License |
| 7 |
C. Files |
| 8 |
D. Requirements |
| 9 |
E. Installation |
| 10 |
F. User Interface |
| 11 |
G. Author |
| 12 |
H. Questions, Suggested Improvements |
| 13 |
I. Known Problems |
| 14 |
J. History |
| 15 |
|
| 16 |
A. PROJECT PKFIX |
| 17 |
================ |
| 18 |
Often PostScript files with embedded pk fonts are available that |
| 19 |
were generated by dvips. If these files are converted to pdf, |
| 20 |
the quality is very poor because of the bitmapped fonts. |
| 21 |
But what can be done, if the sources dvi or tex are not available? |
| 22 |
This project pkfix tries a solution by replacing the used |
| 23 |
pk fonts by the type 1 ones. |
| 24 |
It scans the file for the pk fonts by searching the comments, |
| 25 |
introduced by not too old dvips versions. For each detected bitmap |
| 26 |
font pkfix generates a tex file that uses this font. Then it runs |
| 27 |
dvips with option setting for pdf and hopes, that the corresponding |
| 28 |
type 1 font is found and included in the temporary PostScript file. |
| 29 |
So this font will be extracted and replaces the bitmapped font of |
| 30 |
the original PostScript file. |
| 31 |
|
| 32 |
CAUTION: The state is experimental. Tests are only done with teTeX. |
| 33 |
|
| 34 |
NOTICE: |
| 35 |
pkfix works only for PostScript files that are generated |
| 36 |
by dvips 5.58 or newer. These versions records the used |
| 37 |
font in a PostScript comment. |
| 38 |
Scott Pakin wrote `pkfix-helper' that uses a heuristics |
| 39 |
to guess the original fonts and writes a PostScript file |
| 40 |
that is suitable for processing by pkfix. The Perl script |
| 41 |
`pkfix-helper' is available at CTAN:support/pkfix-helper. |
| 42 |
|
| 43 |
B. COPYRIGHT, DISCLAIMER, LICENSE |
| 44 |
================================= |
| 45 |
Copyright (C) 2001, 2005, 2007, 2009, 2011, 2012 Heiko Oberdiek. |
| 46 |
|
| 47 |
This work may be distributed and/or modified under the |
| 48 |
conditions of the LaTeX Project Public License, either version 1.3 |
| 49 |
of this license or (at your option) any later version. |
| 50 |
The latest version of this license is in |
| 51 |
http://www.latex-project.org/lppl.txt |
| 52 |
and version 1.3 or later is part of all distributions of LaTeX |
| 53 |
version 2003/12/01 or later. |
| 54 |
This work has the LPPL maintenance status "maintained". |
| 55 |
This Current Maintainer of this work is Heiko Oberdiek. |
| 56 |
|
| 57 |
C. FILES |
| 58 |
======== |
| 59 |
The project `pkfix' consists of two files: |
| 60 |
pkfix(.pl): This perl script is the main program. The extension |
| 61 |
`.pl' may be omitted. |
| 62 |
README: Documentation, the file you are reading. |
| 63 |
|
| 64 |
Following temporary files are produced if `pkfix' is invoked |
| 65 |
($$ means the job number): |
| 66 |
_pkfix_$$.tex, _pkfix_$$.log, _pkfix_$$.dvi, _pkfix_$$.ps |
| 67 |
eventually missfont.log |
| 68 |
|
| 69 |
D. REQUIREMENTS |
| 70 |
=============== |
| 71 |
* Perl5 (version 5 of the perl interpreter). |
| 72 |
* TeX (plain format) |
| 73 |
* dvips (not too old, for example 5.86) |
| 74 |
* texps.pro (part of dvips) |
| 75 |
* fonts |
| 76 |
|
| 77 |
E. INSTALLATION |
| 78 |
=============== |
| 79 |
1. TeX directory structure (TDS): |
| 80 |
The file |
| 81 |
`README' (documentation) |
| 82 |
go to |
| 83 |
texmf/doc/programs/pkfix/README |
| 84 |
or |
| 85 |
texmf/doc/pkfix/README |
| 86 |
|
| 87 |
2. Perl script `pkfix.pl': |
| 88 |
|
| 89 |
Unix |
| 90 |
* Your are allowed to rename `pkfix.pl' to `pkfix': |
| 91 |
mv pkfix.pl pkfix |
| 92 |
* Ensure that the execute permission is set: |
| 93 |
chmod +x pkfix |
| 94 |
* Move the file to a directory where the shell can find it |
| 95 |
(environment variable PATH, e.g. /usr/local/bin/). |
| 96 |
|
| 97 |
Dos/Windows/(OS2) |
| 98 |
* Running the perl interpreter directly with the perl script: |
| 99 |
perl pkfix.pl ... |
| 100 |
* Methods for calling by typing the script name without extension |
| 101 |
and perl interpreter: |
| 102 |
a) If your perl distribution provides a pl2exe program, |
| 103 |
use it to generate `pkfix.exe'. |
| 104 |
Advantage: I/O redirection works. |
| 105 |
b) A good method is a dos program of John Dallman: |
| 106 |
#!perl.exe (versions below 4) |
| 107 |
hbperl.exe (version 4) |
| 108 |
http://www.perl.com/CPAN/authors/id/JDALLMAN/hbp_403.zip |
| 109 |
Move pkfix.pl in a PERLLIB directory and copy the |
| 110 |
exe program to `pkfix.exe'. Then the program looks |
| 111 |
for the perl interpreter, the script and calls them. |
| 112 |
Advantage: I/O redirection works. |
| 113 |
c) Windows NT 4.0 users can use associated file types: |
| 114 |
SET PATHEXT=.pl;%PATHEXT% |
| 115 |
See perl win32 faq "How do I associate Perl scripts with perl?": |
| 116 |
http://www.activestate.com/support/faqs/win32/perlwin32faq4.html |
| 117 |
Disadvantage: I/O redirection does not work. |
| 118 |
d) 4DOS: SET .PL=c:/bin/perl.exe |
| 119 |
See perl win32 faq "How can I get Perl to run a Perl script at |
| 120 |
the 4DOS command line by typing the name of the script without |
| 121 |
the extension or "perl", just like a regular exe file?": |
| 122 |
http://www.activestate.com/support/faqs/win32/perlwin32faq1.html |
| 123 |
e) Convert the perl script to a batch file `pkfix.bat', if your |
| 124 |
distribution provides `pl2bat.bat'. |
| 125 |
Disadvantage: I/O redirection does not work. |
| 126 |
Many of this methods are listed in the perl win32 faq |
| 127 |
"What's the equivalent of the shebang ("#!") syntax for Win32?": |
| 128 |
http://www.activestate.com/support/faqs/win32/perlwin32faq4.html |
| 129 |
|
| 130 |
F. USER INTERFACE |
| 131 |
================= |
| 132 |
The perl script `pkfix.pl' can be invoked in two ways: |
| 133 |
a) pkfix --help |
| 134 |
prints a help screen with the options and some default values. |
| 135 |
b) pkfix [options] <input.ps> <output.ps> |
| 136 |
<input.ps> is the original PostScript file with pk fonts, |
| 137 |
<output.ps> will be the result. |
| 138 |
|
| 139 |
Options: |
| 140 |
--clean: Removing of the temporary files. |
| 141 |
--quiet Messages except warnings are suppressed. |
| 142 |
--verbose Informations about the actions are printed. |
| 143 |
--debug Additional messages for debugging purposes; |
| 144 |
also option `--clean' is disabled. |
| 145 |
--options opt Here the options for the dvips run can be changed, |
| 146 |
default is "-Ppdf -G0". |
| 147 |
The other options are experimental. |
| 148 |
|
| 149 |
Example: |
| 150 |
pkfix --verbose test.ps out.ps |
| 151 |
|
| 152 |
If a file name is replaced by "-" then the standard input/output is |
| 153 |
used. In case of standard output, messages of pkfix are written to |
| 154 |
standard error output. Thus pkfix can be used in pipes, eg: |
| 155 |
pkfix foo.ps - | ps2pdf - foo.pdf |
| 156 |
cat foo.ps | pkfix --quiet - - | ps2pdf - - >foo.pdf |
| 157 |
|
| 158 |
Environment variable `PKFIX': |
| 159 |
Before scanning the command line for options the perl script |
| 160 |
`pkfix.pl' looks for the environment variable `PKFIX'. |
| 161 |
Example (bash syntax): |
| 162 |
export PKFIX="--verbose" |
| 163 |
Example (DOS syntax): |
| 164 |
SET PKFIX=--verbose |
| 165 |
|
| 166 |
G. AUTHOR |
| 167 |
========= |
| 168 |
Heiko Oberdiek |
| 169 |
Email: heiko.oberdiek at googlemail.com |
| 170 |
|
| 171 |
Many thanks to |
| 172 |
* Berthold Crysmann (crysmann at dfki.de) and |
| 173 |
Harald Harders (h.harders at tu-bs.de) for testing |
| 174 |
and bug reports. |
| 175 |
* Melissa O'Neill for providing a patch to support dvips 5.399. |
| 176 |
* Scott Pakin who wrote pkfix-helper. |
| 177 |
|
| 178 |
H. QUESTIONS, SUGGESTED IMPROVEMENTS |
| 179 |
==================================== |
| 180 |
If you have questions, problems with `pkfix', error reports, |
| 181 |
if you have improvements or want to have additional features, |
| 182 |
please send them to the author. |
| 183 |
|
| 184 |
The environment that I had used for developing and testing: |
| 185 |
* linux, suse 9.1 |
| 186 |
* perl 5.8.1 |
| 187 |
* tex 3.14159 |
| 188 |
* dvips 5.94a |
| 189 |
* kpsewhich 3.5.2 |
| 190 |
|
| 191 |
(Nowadays I have installed TeX Live, for instance). |
| 192 |
|
| 193 |
I. KNOWN PROBLEMS |
| 194 |
================= |
| 195 |
* I have only tested with a few test files on a linux machine |
| 196 |
with teTeX. |
| 197 |
* PostScript files, generated with older dvips versions |
| 198 |
(for example 5.58), do not contain the essential comments, |
| 199 |
so pkfix does not detect pk fonts. See Scott Pakin's pkfix-helper |
| 200 |
that addresses this problem. |
| 201 |
* The perl script pkfix uses dvips and analyses its output, |
| 202 |
so the version should not be too old (5.86 recommanded). |
| 203 |
Some older (not too old) versions do not know the option |
| 204 |
"-G0". As workaround the options for dvips can currently |
| 205 |
be overwritten by an option for pkfix "--options". |
| 206 |
Example: --options="-Pcmz -Pamz". |
| 207 |
* The new embedded type 1 fonts are not added to the |
| 208 |
DSC comment %%DocumentFonts'. |
| 209 |
* It is assumed that the conversion bitmap to type 1 font |
| 210 |
does not result in type 1 fonts that are already present. |
| 211 |
Then this font would be added twice with probably differnt |
| 212 |
subsettings with the consequence of missing characters. |
| 213 |
|
| 214 |
J. HISTORY |
| 215 |
========== |
| 216 |
2001/04/12 v0.1: |
| 217 |
* First try. |
| 218 |
2001/04/13 v0.2: |
| 219 |
* TeX/dvips is called for each font for the case of errors. |
| 220 |
* First release. |
| 221 |
2001/04/15 v0.3: |
| 222 |
* Call of kpsewhich with option --progname. |
| 223 |
* Extracting of texps.pro from temporary PostScript file, |
| 224 |
if kpsewhich failed. |
| 225 |
* Option -G0 for dvips run added. |
| 226 |
2001/04/16 v0.4: |
| 227 |
* Support for merging PostScript fonts added. |
| 228 |
* \special{!...}/@fedspecial detection added. |
| 229 |
* Bug fix: I detection. |
| 230 |
2001/04/17 v0.5: |
| 231 |
* Redirection of stderr (dvips run) if possible. |
| 232 |
2001/04/20 v0.6: |
| 233 |
* Bug fix: dvips font names can contain numbers. |
| 234 |
2001/04/21 v0.7: |
| 235 |
* Bug fix: long dvi file name in ps file. |
| 236 |
2001/04/23 v0.8: |
| 237 |
* Bug fix: post string parsing. |
| 238 |
2001/04/26 v0.9: |
| 239 |
* Check of version number of dvips in PostScript file. |
| 240 |
2001/06/30 v1.0: |
| 241 |
* Problem with DOS line ending fixed. |
| 242 |
2005/01/28 v1.1: |
| 243 |
* Bug fix: encoding files are now included. |
| 244 |
* The intermediate DVI files are written directly. |
| 245 |
* LPPL 1.3 |
| 246 |
2005/01/29 v1.2: |
| 247 |
* Merging is now based on type 1 names. This solves |
| 248 |
the problem, if different bitmap fonts maps to the |
| 249 |
same type 1 font, eg. (ecrm1000, larm1000) -> SFRM1000. |
| 250 |
* Suppression of PK generation, if environment variable |
| 251 |
MKTEXPK is supported. |
| 252 |
* If output file is "-" (standard output) then messages of |
| 253 |
pkfix are written to standard error output. |
| 254 |
2005/02/25 v1.3: |
| 255 |
* Bug fix: Detection of "@fedspecial end" improved. |
| 256 |
* Bug fix: Typo corrected (PRT -> $PRT). |
| 257 |
2007/11/07 v1.4: |
| 258 |
* Deprecation warning of perl 5.8.8 fixed. |
| 259 |
2009/03/18 v1.5: |
| 260 |
* Patch to support dvips 5.399 (submitted by Melissa O'Neill). |
| 261 |
2011/04/22 v1.6: |
| 262 |
* Bug fix: input and output files are read and written in |
| 263 |
binary mode (thanks M.S. Dousti for bug report). |
| 264 |
2012/04/18 v1.7: |
| 265 |
* Option --version added. |