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