summaryrefslogtreecommitdiff
path: root/fonts/utilities/ttf2pt1/app/netscape/README.html
blob: 3c832c3f03cc5ed7b793998e5c1bfce49d0853d4 (plain)
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
<HTML>
<HEAD>
<TITLE>
Installing the fonts in Netscape Navigator
</TITLE>
</HEAD>
<BODY>
<H2>
Installing the fonts in Netscape Navigator
</H2>

<tt>
by Sergey Babkin 
&lt;babkin@bellatlantic.net&gt;, &lt;sab123@hotmail.com&gt;
</tt>
<p>

This is a collection of supplements to Netscape 4.x on
Unix. Probably they will also work with Netscape 3.x,
possilby with minor modifications.
<p>

<h4><tt>
&nbsp;&nbsp;Makefile<br>
&nbsp;&nbsp;nsfix.c<br>
&nbsp;&nbsp;psfonts.cf
</tt></h4>
<p>

This is a program that allows to substitute the font metrics
of any PostScript font in Netscape. 
<p>

When Netscape prints the files to PostScript format it uses a 
built-in table of character widths. It prints all the fixed-width 
characters in the typeface "Courier" and all the variable-width 
characters in the typeface "Times". And if the PostScript printer
has these fonts by Adobe then everything goes fine because
the tables inside Netscape are generated from the Adobe fonts.
But if the fonts are different (say, those supplied with Ghostscripts
or the fonts with non-latin characters) then the result is quite
ugly. This program allows to replace the width tables inside
the Netscape executable with the tables for any given font.
The only problem is that Netscape can hold only one set of tables
at once. So if you want to print with different fonts (say,
for different languages or encodings) you will have to make
multiple copies of the executable, tune each of them for its
font and then run them separately.
<p>

I tried to make the program as machine-independent as possible.
But because it patches the binary files it still has the dependencies
on hardware. The default version as supplied was designed for
Intel x86 machines but it should work OK on any machine
with 32-bit CPU and 4Kbyte (or less) page size. If it can't
find the tables matching the font names on some other architecture
the first thing to try would be reduce the `<tt>PAGEBITS</tt>' definition
in the source code. On the machines with non-page-aligned structure
of executables it won't work at all. I don't know whether would
it work on the 64-bit machines. This may depend on whether the
Netscape executable was compiled in 32-bit or 64-bit mode. For
the 64-bit executables it may be neccessary to change the definition
of the type `<tt>tptr</tt>' to an 8-byte integer type (probably `<tt>long</tt>'
or `<tt>long long</tt>'). Also must be re-compiled for patching of the 
Netscape binary for each particular machine architecture because
it assumes the byte order of the current machine.
<p>

It might be possible to create a program that would patch
a running Netscape binary on the fly, that would allow
changing the printing fonts as neccessary when Netscape is
running. But this would be even more platform-dependent,
so I don't feel any enthusiasm about doing that.
<p>

I have tested the program on the Intel machines, Netscape
4.08 and 4.7, OS FreeBSD (both a.out and ELF formats of the
Netscape binary) and UnixWare.
<p>

After all these scary issues are resolved the compiling
is easy: just run `<tt>make</tt>'.
<p>

To command to patch the Netscape is:
<p>
<tt>
&nbsp;&nbsp;./nsfix <i>&lt;netscape-binary&gt; &lt;config-file&gt;</i>
</tt>
<p>

Please make a copy of the original Netscape binary before
patching in case anything goes wrong. Patch the copy, test
that it works OK and only then install it. The configuration
file describes the fonts that are to be used. An example
is provided in the file psfonts.cf.
<p>

Each line in the configuration file consists of 4
columns:
<p>

<tt><i>
&lt;PS_font_name&gt; &lt;font_base_file&gt; &lt;suffix_afm&gt; &lt;suffix_font&gt;
</i></tt>
<p>

For example, the following line from my configuration file:
<p>

<tt>
Courier /usr/lib/X11/fonts/ttf/cokoi8n.koi8-r .afm .pfa
</tt>
<p>

says that the font `Courier' will be replaced with the
font taken from the file `<tt>/usr/lib/X11/fonts/ttf/cokoi8n.koi8-r.pfa</tt>'
and the metrics for that font will be taken from the file
`<tt>/usr/lib/X11/fonts/ttf/cokoi8n.koi8-r.afm</tt>' .
<p>

One more caveat: the new font must have a proper encoding
table. Some fonts contain characters for multiple encodings
hoping that the program wil re-encode them as neccessary.
This won't work in this case, only the primary encoding table
of the font will be used.
<p>

<h4><tt>
&nbsp;&nbsp;nsfilter<br>
&nbsp;&nbsp;nsprint<br>
&nbsp;&nbsp;psfonts.cf
</tt></h4>
<p>

These are the filters for printing from Netscape.
<p>

Changing the metrics is not the end of the story. This will
provide proper placement of the characters but not the
characters themselves. There are a few ways to provide
the characters:
<p>

First, if you use GhostScript you may configure proper
aliases in the GhostScript configuration file. We will
consider this variant trivial and won't discuss it furter
except for one caveat: Netscape tries to re-encode the
fonts per the ISO Latin-1 encoding. If the primary encoding
of the font is different this cause unexpected effects.
So you still may consider using the filters (at least in a
simplified form) to solve this problem.
<p>

Second, load the fonts right into your printer. This is
very much like configuring GhostScript.
<p>

Third, use the provided filters. The script `<tt>nsfilter</tt>'
reads the output of Netscape on its standard input and
puts the result to its standard output. It uses the same
configuration file `<tt>psfonts.cf</tt>' as `<tt>nsfix</tt>'. First it
looks for the configuration file in the user's home
directory (<tt>$HOME/.netscape/psfonts.cf</tt>) and if the
file it not there then the second guess is the system-wide
configuration file <tt>/usr/local/etc/psfonts.cf</tt>. The
script inserts the fonts into the output and also
removes the Netscape's experiments with the encodings.
<p>

`<tt>nsfilter</tt>' is generally intended to be ran by user, not by the 
printing subsystem. The reason is that the user may have
changed fonts in his Netscape and the printing subsystem
would have no way to access user's configuration file.
But if all the users are using the same fonts then it
may be incorporated into the printing subsystem and use
the system-wide configuration file.
<p>

The script `<tt>nsprint</tt>' is purely for convenience, to type it
as a printing command in the Netscape printing window.
It just pipelines the data through `<tt>nsfilter</tt>' to the
printing program which also gets all the arguments. Please 
note that the SystemV-style and BSD-style systems use different
printing programs (although they commonly provide compatibility
with the other style too). The script tries to guess the
type of system and use its native print program, `<tt>lp</tt>' or
`<tt>lpr</tt>'. But in case it guesses wrong you may want
to change this in the script.  Also if the printer does not support
PostScript directly this script may be a good place to
insert a call to GhostScript.
<p>

<h4><tt>
&nbsp;&nbsp;notscape<br>
&nbsp;&nbsp;fontsz.cf
</tt></h4>
<p>

Netscape on Unix has a very annoying "feature", it does
not remember the desired base size of the scalable screen
fonts and always resets it to 12.0 points. Even if the size
is changed manually in its preferences file, Netscape
forgets it after it exits. 
<p>

So my solution was to write a program which would change
the size to my favorite one every time right before
starting Netscape. `<tt>notscape</tt>' is exactly such a program,
it sets the font sizes an then transparently executes 
netscape. It takes the font sizes from the file
`<tt>$HOME/.netscape/fontsz.cf</tt>' . An example of such file
is provided. The format of the file is quite self-explanatory,
for example the lines
<p>

<tt>
fixed-koi8-r	140<br>
prop-koi8-r	150
</tt>
<p>

mean "set the size of the fixed-width screen font in the 
encoding koi8-r to 14.0 points; set the size of the proportional 
(variable-width) font in the encoding koi8-r to 15.0 points".
<p>
</BODY>
</HTML>