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

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

Ticket #1135 - Corrigindo CSS e adicionando filemanager

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