source: branches/2.2/filemanager/tp/dompdf/lib/ttf2ufm/ttf2ufm-src/app/netscape/README @ 3019

Revision 3019, 7.3 KB checked in by amuller, 14 years ago (diff)

Ticket #1135 - Corrigindo CSS e adicionando filemanager

Line 
1Installing the fonts in Netscape Navigator
2
3by Sergey Babkin
4<babkin@bellatlantic.net>, <sab123@hotmail.com>
5
6This is a collection of supplements to Netscape 4.x on
7Unix. Probably they will also work with Netscape 3.x,
8possilby with minor modifications.
9
10  Makefile
11  nsfix.c
12  psfonts.cf
13
14This is a program that allows to substitute the font metrics
15of any PostScript font in Netscape.
16
17When Netscape prints the files to PostScript format it uses a
18built-in table of character widths. It prints all the fixed-width
19characters in the typeface "Courier" and all the variable-width
20characters in the typeface "Times". And if the PostScript printer
21has these fonts by Adobe then everything goes fine because
22the tables inside Netscape are generated from the Adobe fonts.
23But if the fonts are different (say, those supplied with Ghostscripts
24or the fonts with non-latin characters) then the result is quite
25ugly. This program allows to replace the width tables inside
26the Netscape executable with the tables for any given font.
27The only problem is that Netscape can hold only one set of tables
28at once. So if you want to print with different fonts (say,
29for different languages or encodings) you will have to make
30multiple copies of the executable, tune each of them for its
31font and then run them separately.
32
33I tried to make the program as machine-independent as possible.
34But because it patches the binary files it still has the dependencies
35on hardware. The default version as supplied was designed for
36Intel x86 machines but it should work OK on any machine
37with 32-bit CPU and 4Kbyte (or less) page size. If it can't
38find the tables matching the font names on some other architecture
39the first thing to try would be reduce the `PAGEBITS' definition
40in the source code. On the machines with non-page-aligned structure
41of executables it won't work at all. I don't know whether would
42it work on the 64-bit machines. This may depend on whether the
43Netscape executable was compiled in 32-bit or 64-bit mode. For
44the 64-bit executables it may be neccessary to change the definition
45of the type `tptr' to an 8-byte integer type (probably `long'
46or `long long'). Also must be re-compiled for patching of the
47Netscape binary for each particular machine architecture because
48it assumes the byte order of the current machine.
49
50It might be possible to create a program that would patch
51a running Netscape binary on the fly, that would allow
52changing the printing fonts as neccessary when Netscape is
53running. But this would be even more platform-dependent,
54so I don't feel any enthusiasm about doing that.
55
56I have tested the program on the Intel machines, Netscape
574.08 and 4.7, OS FreeBSD (both a.out and ELF formats of the
58Netscape binary) and UnixWare.
59
60After all these scary issues are resolved the compiling
61is easy: just run `make'.
62
63To command to patch the Netscape is:
64  ./nsfix <netscape-binary> <config-file>
65
66Please make a copy of the original Netscape binary before
67patching in case anything goes wrong. Patch the copy, test
68that it works OK and only then install it. The configuration
69file describes the fonts that are to be used. An example
70is provided in the file psfonts.cf.
71
72Each line in the configuration file consists of 4
73columns:
74
75<PS_font_name> <font_base_file> <suffix_afm> <suffix_font>
76
77For example, the following line from my configuration file:
78
79Courier /usr/lib/X11/fonts/ttf/cokoi8n.koi8-r .afm .pfa
80
81says that the font `Courier' will be replaced with the
82font taken from the file `/usr/lib/X11/fonts/ttf/cokoi8n.koi8-r.pfa'
83and the metrics for that font will be taken from the file
84`/usr/lib/X11/fonts/ttf/cokoi8n.koi8-r.afm' .
85
86One more caveat: the new font must have a proper encoding
87table. Some fonts contain characters for multiple encodings
88hoping that the program wil re-encode them as neccessary.
89This won't work in this case, only the primary encoding table
90of the font will be used.
91
92  nsfilter
93  nsprint
94  psfonts.cf
95
96These are the filters for printing from Netscape.
97
98Changing the metrics is not the end of the story. This will
99provide proper placement of the characters but not the
100characters themselves. There are a few ways to provide
101the characters:
102
103First, if you use GhostScript you may configure proper
104aliases in the GhostScript configuration file. We will
105consider this variant trivial and won't discuss it furter
106except for one caveat: Netscape tries to re-encode the
107fonts per the ISO Latin-1 encoding. If the primary encoding
108of the font is different this cause unexpected effects.
109So you still may consider using the filters (at least in a
110simplified form) to solve this problem.
111
112Second, load the fonts right into your printer. This is
113very much like configuring GhostScript.
114
115Third, use the provided filters. The script `nsfilter'
116reads the output of Netscape on its standard input and
117puts the result to its standard output. It uses the same
118configuration file `psfonts.cf' as `nsfix'. First it
119looks for the configuration file in the user's home
120directory ($HOME/.netscape/psfonts.cf) and if the
121file it not there then the second guess is the system-wide
122configuration file /usr/local/etc/psfonts.cf. The
123script inserts the fonts into the output and also
124removes the Netscape's experiments with the encodings.
125
126`nsfilter' is generally intended to be ran by user, not by the
127printing subsystem. The reason is that the user may have
128changed fonts in his Netscape and the printing subsystem
129would have no way to access user's configuration file.
130But if all the users are using the same fonts then it
131may be incorporated into the printing subsystem and use
132the system-wide configuration file.
133
134The script `nsprint' is purely for convenience, to type it
135as a printing command in the Netscape printing window.
136It just pipelines the data through `nsfilter' to the
137printing program which also gets all the arguments. Please
138note that the SystemV-style and BSD-style systems use different
139printing programs (although they commonly provide compatibility
140with the other style too). The script tries to guess the
141type of system and use its native print program, `lp' or
142`lpr'. But in case it guesses wrong you may want
143to change this in the script.  Also if the printer does not support
144PostScript directly this script may be a good place to
145insert a call to GhostScript.
146
147  notscape
148  fontsz.cf
149
150Netscape on Unix has a very annoying "feature", it does
151not remember the desired base size of the scalable screen
152fonts and always resets it to 12.0 points. Even if the size
153is changed manually in its preferences file, Netscape
154forgets it after it exits.
155
156So my solution was to write a program which would change
157the size to my favorite one every time right before
158starting Netscape. `notscape' is exactly such a program,
159it sets the font sizes an then transparently executes
160netscape. It takes the font sizes from the file
161`$HOME/.netscape/fontsz.cf' . An example of such file
162is provided. The format of the file is quite self-explanatory,
163for example the lines
164
165fixed-koi8-r    140
166prop-koi8-r     150
167
168mean "set the size of the fixed-width screen font in the
169encoding koi8-r to 14.0 points; set the size of the proportional
170(variable-width) font in the encoding koi8-r to 15.0 points".
171
172
173  nspr
174by Zvezdan Petkovic
175
176To print from Netscape, I usually print to the Postscript file first.
177Then I use this small script to change the names of Times and Courier fonts
178in the file and remove `/Encoding' lines.  After that the file can be
179sent to printer.
180
Note: See TracBrowser for help on using the repository browser.