Mercurial > vim
annotate runtime/doc/print.txt @ 28871:18604231a1d1 v8.2.4958
patch 8.2.4958: a couple conditions are always true
Commit: https://github.com/vim/vim/commit/dd41037552c1be3548d2ce34bb1c889f14edb553
Author: =?UTF-8?q?Dundar=20G=C3=B6c?= <gocdundar@gmail.com>
Date: Sun May 15 13:59:11 2022 +0100
patch 8.2.4958: a couple conditions are always true
Problem: A couple conditions are always true.
Solution: Remove the conditions. (Goc Dundar, closes https://github.com/vim/vim/issues/10428)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 15 May 2022 15:00:02 +0200 |
parents | d19b7aee1925 |
children | f8116058ca76 |
rev | line source |
---|---|
27459 | 1 *print.txt* For Vim version 8.2. Last change: 2022 Jan 23 |
15 | 2 |
3 | |
4 VIM REFERENCE MANUAL by Bram Moolenaar | |
5 | |
6 | |
7 Printing *printing* | |
8 | |
9 1. Introduction |print-intro| | |
10 2. Print options |print-options| | |
11 3. PostScript Printing |postscript-printing| | |
12 4. PostScript Printing Encoding |postscript-print-encoding| | |
856 | 13 5. PostScript CJK Printing |postscript-cjk-printing| |
15 | 14 6. PostScript Printing Troubleshooting |postscript-print-trouble| |
15 7. PostScript Utilities |postscript-print-util| | |
16 8. Formfeed Characters |printing-formfeed| | |
17 | |
18 {only available when compiled with the |+printer| feature} | |
19 | |
20 ============================================================================== | |
21 1. Introduction *print-intro* | |
22 | |
23 On MS-Windows Vim can print your text on any installed printer. On other | |
24 systems a PostScript file is produced. This can be directly sent to a | |
25 PostScript printer. For other printers a program like ghostscript needs to be | |
26 used. | |
27 | |
1619 | 28 Note: If you have problems printing with |:hardcopy|, an alternative is to use |
29 |:TOhtml| and print the resulting html file from a browser. | |
30 | |
15 | 31 *:ha* *:hardcopy* *E237* *E238* *E324* |
32 :[range]ha[rdcopy][!] [arguments] | |
33 Send [range] lines (default whole file) to the | |
34 printer. | |
35 | |
36 On MS-Windows a dialog is displayed to allow selection | |
236 | 37 of printer, paper size etc. To skip the dialog, use |
15 | 38 the [!]. In this case the printer defined by |
39 'printdevice' is used, or, if 'printdevice' is empty, | |
40 the system default printer. | |
41 | |
42 For systems other than MS-Windows, PostScript is | |
43 written in a temp file and 'printexpr' is used to | |
44 actually print it. Then [arguments] can be used by | |
45 'printexpr' through |v:cmdarg|. Otherwise [arguments] | |
46 is ignored. 'printoptions' can be used to specify | |
47 paper size, duplex, etc. | |
14519 | 48 Note: If you want PDF, there are tools such as |
49 "ps2pdf" that can convert the PostScript to PDF. | |
15 | 50 |
51 :[range]ha[rdcopy][!] >{filename} | |
52 As above, but write the resulting PostScript in file | |
53 {filename}. | |
54 Things like "%" are expanded |cmdline-special| | |
55 Careful: An existing file is silently overwritten. | |
56 {only available when compiled with the |+postscript| | |
57 feature} | |
58 On MS-Windows use the "print to file" feature of the | |
59 printer driver. | |
60 | |
61 Progress is displayed during printing as a page number and a percentage. To | |
62 abort printing use the interrupt key (CTRL-C or, on MS-systems, CTRL-Break). | |
63 | |
64 Printer output is controlled by the 'printfont' and 'printoptions' options. | |
65 'printheader' specifies the format of a page header. | |
66 | |
67 The printed file is always limited to the selected margins, irrespective of | |
68 the current window's 'wrap' or 'linebreak' settings. The "wrap" item in | |
69 'printoptions' can be used to switch wrapping off. | |
70 The current highlighting colors are used in the printout, with the following | |
71 considerations: | |
236 | 72 1) The normal background is always rendered as white (i.e. blank paper). |
15 | 73 2) White text or the default foreground is rendered as black, so that it shows |
74 up! | |
75 3) If 'background' is "dark", then the colours are darkened to compensate for | |
76 the fact that otherwise they would be too bright to show up clearly on | |
77 white paper. | |
78 | |
79 ============================================================================== | |
80 2. Print options *print-options* | |
81 | |
82 Here are the details for the options that change the way printing is done. | |
83 For generic info about setting options see |options.txt|. | |
84 | |
85 *pdev-option* | |
86 'printdevice' 'pdev' string (default empty) | |
87 global | |
88 This defines the name of the printer to be used when the |:hardcopy| command | |
89 is issued with a bang (!) to skip the printer selection dialog. On Win32, it | |
90 should be the printer name exactly as it appears in the standard printer | |
91 dialog. | |
92 If the option is empty, then vim will use the system default printer for | |
93 ":hardcopy!" | |
94 | |
95 *penc-option* *E620* | |
96 'printencoding' 'penc' String (default empty, except for: | |
18912
ccd16426a1f9
patch 8.2.0017: OS/2 and MS-DOS are still mentioned
Bram Moolenaar <Bram@vim.org>
parents:
18879
diff
changeset
|
97 MS-Windows: cp1252, |
15 | 98 Macintosh: mac-roman, |
99 VMS: dec-mcs, | |
100 HPUX: hp-roman8, | |
101 EBCDIC: ebcdic-uk) | |
102 global | |
11473 | 103 Sets the character encoding used when printing. This option tells Vim which |
15 | 104 print character encoding file from the "print" directory in 'runtimepath' to |
105 use. | |
106 | |
107 This option will accept any value from |encoding-names|. Any recognized names | |
11473 | 108 are converted to Vim standard names - see 'encoding' for more details. Names |
109 not recognized by Vim will just be converted to lower case and underscores | |
15 | 110 replaced with '-' signs. |
111 | |
11473 | 112 If 'printencoding' is empty or Vim cannot find the file then it will use |
15878 | 113 'encoding' (if it is set an 8-bit encoding) to find the print character |
114 encoding file. If Vim is unable to find a character encoding file then it | |
115 will use the "latin1" print character encoding file. | |
15 | 116 |
21991 | 117 When 'encoding' is set to a multibyte encoding, Vim will try to convert |
15 | 118 characters to the printing encoding for printing (if 'printencoding' is empty |
119 then the conversion will be to latin1). Conversion to a printing encoding | |
11473 | 120 other than latin1 will require Vim to be compiled with the |+iconv| feature. |
15 | 121 If no conversion is possible then printing will fail. Any characters that |
122 cannot be converted will be replaced with upside down question marks. | |
123 | |
124 Four print character encoding files are provided to support default Mac, VMS, | |
125 HPUX, and EBCDIC character encodings and are used by default on these | |
126 platforms. Code page 1252 print character encoding is used by default on | |
18912
ccd16426a1f9
patch 8.2.0017: OS/2 and MS-DOS are still mentioned
Bram Moolenaar <Bram@vim.org>
parents:
18879
diff
changeset
|
127 MS-Windows platform. |
15 | 128 |
129 *pexpr-option* | |
130 'printexpr' 'pexpr' String (default: see below) | |
131 global | |
132 Expression that is evaluated to print the PostScript produced with | |
133 |:hardcopy|. | |
134 The file name to be printed is in |v:fname_in|. | |
135 The arguments to the ":hardcopy" command are in |v:cmdarg|. | |
136 The expression must take care of deleting the file after printing it. | |
137 When there is an error, the expression must return a non-zero number. | |
138 If there is no error, return zero or an empty string. | |
139 The default for non MS-Windows or VMS systems is to simply use "lpr" to print | |
140 the file: > | |
141 | |
27903 | 142 system('lpr' .. (&printdevice == '' ? '' : ' -P' .. &printdevice) |
143 .. ' ' .. v:fname_in) .. delete(v:fname_in) + v:shell_error | |
15 | 144 |
18912
ccd16426a1f9
patch 8.2.0017: OS/2 and MS-DOS are still mentioned
Bram Moolenaar <Bram@vim.org>
parents:
18879
diff
changeset
|
145 On MS-Windows machines the default is to copy the file to the currently |
ccd16426a1f9
patch 8.2.0017: OS/2 and MS-DOS are still mentioned
Bram Moolenaar <Bram@vim.org>
parents:
18879
diff
changeset
|
146 specified printdevice: > |
15 | 147 |
27903 | 148 system('copy' .. ' ' .. v:fname_in .. (&printdevice == '' |
149 ? ' LPT1:' : (' \"' .. &printdevice .. '\"'))) | |
150 .. delete(v:fname_in) | |
15 | 151 |
152 On VMS machines the default is to send the file to either the default or | |
153 currently specified printdevice: > | |
154 | |
27903 | 155 system('print' .. (&printdevice == '' ? '' : ' /queue=' .. |
156 &printdevice) .. ' ' .. v:fname_in) .. delete(v:fname_in) | |
15 | 157 |
158 If you change this option, using a function is an easy way to avoid having to | |
159 escape all the spaces. Example: > | |
160 | |
161 :set printexpr=PrintFile(v:fname_in) | |
162 :function PrintFile(fname) | |
27903 | 163 : call system("ghostview " .. a:fname) |
15 | 164 : call delete(a:fname) |
165 : return v:shell_error | |
166 :endfunc | |
167 | |
168 Be aware that some print programs return control before they have read the | |
169 file. If you delete the file too soon it will not be printed. These programs | |
170 usually offer an option to have them remove the file when printing is done. | |
171 *E365* | |
172 If evaluating the expression fails or it results in a non-zero number, you get | |
173 an error message. In that case Vim will delete the file. In the default | |
174 value for non-MS-Windows a trick is used: Adding "v:shell_error" will result | |
175 in a non-zero number when the system() call fails. | |
176 | |
26743
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
25880
diff
changeset
|
177 If the expression starts with s: or |<SID>|, then it is replaced with the |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
25880
diff
changeset
|
178 script ID (|local-function|). Example: > |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
25880
diff
changeset
|
179 set printexpr=s:MyPrintFile() |
c2c40cefc17b
patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents:
25880
diff
changeset
|
180 set printexpr=<SID>SomePrintFile() |
27459 | 181 Otherwise, the expression is evaluated in the context of the script where the |
182 option was set, thus script-local items are available. | |
183 | |
15 | 184 This option cannot be set from a |modeline| or in the |sandbox|, for security |
185 reasons. | |
186 | |
187 *pfn-option* *E613* | |
188 'printfont' 'pfn' string (default "courier") | |
189 global | |
190 This is the name of the font that will be used for the |:hardcopy| command's | |
191 output. It has the same format as the 'guifont' option, except that only one | |
192 font may be named, and the special "guifont=*" syntax is not available. | |
193 | |
194 In the Win32 GUI version this specifies a font name with its extra attributes, | |
195 as with the 'guifont' option. | |
196 | |
197 For other systems, only ":h11" is recognized, where "11" is the point size of | |
198 the font. When omitted, the point size is 10. | |
199 | |
200 *pheader-option* | |
201 'printheader' 'pheader' string (default "%<%f%h%m%=Page %N") | |
202 global | |
203 This defines the format of the header produced in |:hardcopy| output. The | |
204 option is defined in the same way as the 'statusline' option. If Vim has not | |
205 been compiled with the |+statusline| feature, this option has no effect and a | |
1619 | 206 simple default header is used, which shows the page number. The same simple |
207 header is used when this option is empty. | |
15 | 208 |
209 *pmbcs-option* | |
210 'printmbcharset' 'pmbcs' string (default "") | |
211 global | |
212 Sets the CJK character set to be used when generating CJK output from | |
11473 | 213 |:hardcopy|. The following predefined values are currently recognised by Vim: |
15 | 214 |
215 Value Description ~ | |
216 Chinese GB_2312-80 | |
217 (Simplified) GBT_12345-90 | |
218 MAC Apple Mac Simplified Chinese | |
219 GBT-90_MAC GB/T 12345-90 Apple Mac Simplified | |
220 Chinese | |
221 GBK GBK (GB 13000.1-93) | |
222 ISO10646 ISO 10646-1:1993 | |
223 | |
224 Chinese CNS_1993 CNS 11643-1993, Planes 1 & 2 | |
225 (Traditional) BIG5 | |
226 ETEN Big5 with ETen extensions | |
227 ISO10646 ISO 10646-1:1993 | |
228 | |
229 Japanese JIS_C_1978 | |
230 JIS_X_1983 | |
231 JIS_X_1990 | |
856 | 232 MSWINDOWS Win3.1/95J (JIS X 1997 + NEC + |
15 | 233 IBM extensions) |
234 KANJITALK6 Apple Mac KanjiTalk V6.x | |
235 KANJITALK7 Apple Mac KanjiTalk V7.x | |
236 | |
237 Korean KS_X_1992 | |
238 MAC Apple Macintosh Korean | |
239 MSWINDOWS KS X 1992 with MS extensions | |
240 ISO10646 ISO 10646-1:1993 | |
241 | |
242 Only certain combinations of the above values and 'printencoding' are | |
243 possible. The following tables show the valid combinations: | |
244 | |
245 euc-cn gbk ucs-2 utf-8 ~ | |
246 Chinese GB_2312-80 x | |
247 (Simplified) GBT_12345-90 x | |
248 MAC x | |
249 GBT-90_MAC x | |
250 GBK x | |
251 ISO10646 x x | |
252 | |
253 euc-tw big5 ucs-2 utf-8 ~ | |
254 Chinese CNS_1993 x | |
255 (Traditional) BIG5 x | |
256 ETEN x | |
257 ISO10646 x x | |
258 | |
259 euc-jp sjis ucs-2 utf-8 ~ | |
260 Japanese JIS_C_1978 x x | |
261 JIS_X_1983 x x | |
262 JIS_X_1990 x x x | |
16380 | 263 MSWINDOWS x |
264 KANJITALK6 x | |
265 KANJITALK7 x | |
15 | 266 |
267 euc-kr cp949 ucs-2 utf-8 ~ | |
856 | 268 Korean KS_X_1992 x |
15 | 269 MAC x |
270 MSWINDOWS x | |
271 ISO10646 x x | |
272 | |
273 To set up the correct encoding and character set for printing some | |
274 Japanese text you would do the following; > | |
275 :set printencoding=euc-jp | |
276 :set printmbcharset=JIS_X_1983 | |
277 | |
278 If 'printmbcharset' is not one of the above values then it is assumed to | |
21991 | 279 specify a custom multibyte character set and no check will be made that it is |
11473 | 280 compatible with the value for 'printencoding'. Vim will look for a file |
15 | 281 defining the character set in the "print" directory in 'runtimepath'. |
282 | |
283 *pmbfn-option* | |
284 'printmbfont' 'pmbfn' string (default "") | |
285 global | |
286 This is a comma-separated list of fields for font names to be used when | |
287 generating CJK output from |:hardcopy|. Each font name has to be preceded | |
288 with a letter indicating the style the font is to be used for as follows: | |
289 | |
290 r:{font-name} font to use for normal characters | |
291 b:{font-name} font to use for bold characters | |
292 i:{font-name} font to use for italic characters | |
293 o:{font-name} font to use for bold-italic characters | |
294 | |
295 A field with the r: prefix must be specified when doing CJK printing. The | |
296 other fontname specifiers are optional. If a specifier is missing then | |
297 another font will be used as follows: | |
298 | |
299 if b: is missing, then use r: | |
300 if i: is missing, then use r: | |
839 | 301 if o: is missing, then use b: |
15 | 302 |
303 Some CJK fonts do not contain characters for codes in the ASCII code range. | |
304 Also, some characters in the CJK ASCII code ranges differ in a few code points | |
305 from traditional ASCII characters. There are two additional fields to control | |
306 printing of characters in the ASCII code range. | |
307 | |
308 c:yes Use Courier font for characters in the ASCII | |
309 c:no (default) code range. | |
310 | |
311 a:yes Use ASCII character set for codes in the ASCII | |
312 a:no (default) code range. | |
313 | |
21991 | 314 The following is an example of specifying two multibyte fonts, one for normal |
15 | 315 and italic printing and one for bold and bold-italic printing, and using |
316 Courier to print codes in the ASCII code range but using the national | |
317 character set: > | |
318 :set printmbfont=r:WadaMin-Regular,b:WadaMin-Bold,c:yes | |
319 < | |
320 *popt-option* | |
856 | 321 'printoptions' 'popt' string (default "") |
15 | 322 global |
323 This is a comma-separated list of items that control the format of the output | |
324 of |:hardcopy|: | |
325 | |
326 left:{spec} left margin (default: 10pc) | |
327 right:{spec} right margin (default: 5pc) | |
328 top:{spec} top margin (default: 5pc) | |
329 bottom:{spec} bottom margin (default: 5pc) | |
330 {spec} is a number followed by "in" for inches, "pt" | |
331 for points (1 point is 1/72 of an inch), "mm" for | |
332 millimeters or "pc" for a percentage of the media | |
333 size. | |
334 Weird example: | |
335 left:2in,top:30pt,right:16mm,bottom:3pc | |
336 If the unit is not recognized there is no error and | |
337 the default value is used. | |
338 | |
339 header:{nr} Number of lines to reserve for the header. | |
340 Only the first line is actually filled, thus when {nr} | |
341 is 2 there is one empty line. The header is formatted | |
342 according to 'printheader'. | |
343 header:0 Do not print a header. | |
344 header:2 (default) Use two lines for the header | |
345 | |
346 syntax:n Do not use syntax highlighting. This is faster and | |
347 thus useful when printing large files. | |
348 syntax:y Do syntax highlighting. | |
349 syntax:a (default) Use syntax highlighting if the printer appears to be | |
856 | 350 able to print color or grey. |
15 | 351 |
352 number:y Include line numbers in the printed output. | |
353 number:n (default) No line numbers. | |
354 | |
355 wrap:y (default) Wrap long lines. | |
356 wrap:n Truncate long lines. | |
357 | |
358 duplex:off Print on one side. | |
359 duplex:long (default) Print on both sides (when possible), bind on long | |
856 | 360 side. |
15 | 361 duplex:short Print on both sides (when possible), bind on short |
856 | 362 side. |
15 | 363 |
364 collate:y (default) Collating: 1 2 3, 1 2 3, 1 2 3 | |
365 collate:n No collating: 1 1 1, 2 2 2, 3 3 3 | |
366 | |
367 jobsplit:n (default) Do all copies in one print job | |
368 jobsplit:y Do each copy as a separate print job. Useful when | |
856 | 369 doing N-up postprocessing. |
15 | 370 |
371 portrait:y (default) Orientation is portrait. | |
372 portrait:n Orientation is landscape. | |
373 *a4* *letter* | |
374 paper:A4 (default) Paper size: A4 | |
375 paper:{name} Paper size from this table: | |
376 {name} size in cm size in inch ~ | |
377 10x14 25.4 x 35.57 10 x 14 | |
378 A3 29.7 x 42 11.69 x 16.54 | |
379 A4 21 x 29.7 8.27 x 11.69 | |
380 A5 14.8 x 21 5.83 x 8.27 | |
381 B4 25 x 35.3 10.12 x 14.33 | |
382 B5 17.6 x 25 7.17 x 10.12 | |
383 executive 18.42 x 26.67 7.25 x 10.5 | |
384 folio 21 x 33 8.27 x 13 | |
385 ledger 43.13 x 27.96 17 x 11 | |
386 legal 21.59 x 35.57 8.5 x 14 | |
387 letter 21.59 x 27.96 8.5 x 11 | |
388 quarto 21.59 x 27.5 8.5 x 10.83 | |
389 statement 13.97 x 21.59 5.5 x 8.5 | |
390 tabloid 27.96 x 43.13 11 x 17 | |
391 | |
392 formfeed:n (default) Treat form feed characters (0x0c) as a normal print | |
856 | 393 character. |
15 | 394 formfeed:y When a form feed character is encountered, continue |
395 printing of the current line at the beginning of the | |
396 first line on a new page. | |
397 | |
398 The item indicated with (default) is used when the item is not present. The | |
399 values are not always used, especially when using a dialog to select the | |
400 printer and options. | |
401 Example: > | |
402 :set printoptions=paper:letter,duplex:off | |
403 | |
404 ============================================================================== | |
405 3. PostScript Printing *postscript-printing* | |
406 *E455* *E456* *E457* *E624* | |
407 Provided you have enough disk space there should be no problems generating a | |
408 PostScript file. You need to have the runtime files correctly installed (if | |
409 you can find the help files, they probably are). | |
410 | |
411 There are currently a number of limitations with PostScript printing: | |
412 | |
413 - 'printfont' - The font name is ignored (the Courier family is always used - | |
414 it should be available on all PostScript printers) but the font size is | |
415 used. | |
416 | |
417 - 'printoptions' - The duplex setting is used when generating PostScript | |
418 output, but it is up to the printer to take notice of the setting. If the | |
419 printer does not support duplex printing then it should be silently ignored. | |
420 Some printers, however, don't print at all. | |
421 | |
422 - 8-bit support - While a number of 8-bit print character encodings are | |
423 supported it is possible that some characters will not print. Whether a | |
424 character will print depends on the font in the printer knowing the | |
425 character. Missing characters will be replaced with an upside down question | |
426 mark, or a space if that character is also not known by the font. It may be | |
427 possible to get all the characters in an encoding to print by installing a | |
428 new version of the Courier font family. | |
429 | |
21991 | 430 - Multi-byte support - Currently Vim will try to convert multibyte characters |
15 | 431 to the 8-bit encoding specified by 'printencoding' (or latin1 if it is |
432 empty). Any characters that are not successfully converted are shown as | |
21991 | 433 unknown characters. Printing will fail if Vim cannot convert the multibyte |
15 | 434 to the 8-bit encoding. |
435 | |
436 ============================================================================== | |
437 4. Custom 8-bit Print Character Encodings *postscript-print-encoding* | |
438 *E618* *E619* | |
439 To use your own print character encoding when printing 8-bit character data | |
440 you need to define your own PostScript font encoding vector. Details on how | |
1121 | 441 to define a font encoding vector is beyond the scope of this help file, but |
15 | 442 you can find details in the PostScript Language Reference Manual, 3rd Edition, |
443 published by Addison-Wesley and available in PDF form at | |
11473 | 444 http://www.adobe.com/. The following describes what you need to do for Vim to |
15 | 445 locate and use your print character encoding. |
446 | |
447 i. Decide on a unique name for your encoding vector, one that does not clash | |
11473 | 448 with any of the recognized or standard encoding names that Vim uses (see |
15 | 449 |encoding-names| for a list), and that no one else is likely to use. |
450 ii. Copy $VIMRUNTIME/print/latin1.ps to the print subdirectory in your | |
451 'runtimepath' and rename it with your unique name. | |
452 iii. Edit your renamed copy of latin1.ps, replacing all occurrences of latin1 | |
453 with your unique name (don't forget the line starting %%Title:), and | |
454 modify the array of glyph names to define your new encoding vector. The | |
455 array must have exactly 256 entries or you will not be able to print! | |
11473 | 456 iv. Within Vim, set 'printencoding' to your unique encoding name and then |
457 print your file. Vim will now use your custom print character encoding. | |
15 | 458 |
11473 | 459 Vim will report an error with the resource file if you change the order or |
15 | 460 content of the first 3 lines, other than the name of the encoding on the line |
461 starting %%Title: or the version number on the line starting %%Version:. | |
462 | |
11473 | 463 [Technical explanation for those that know PostScript - Vim looks for a file |
15 | 464 with the same name as the encoding it will use when printing. The file |
465 defines a new PostScript Encoding resource called /VIM-name, where name is the | |
11473 | 466 print character encoding Vim will use.] |
15 | 467 |
468 ============================================================================== | |
469 5. PostScript CJK Printing *postscript-cjk-printing* | |
470 *E673* *E674* *E675* | |
471 | |
11473 | 472 Vim supports printing of Chinese, Japanese, and Korean files. Setting up Vim |
15 | 473 to correctly print CJK files requires setting up a few more options. |
474 | |
475 Each of these countries has many standard character sets and encodings which | |
476 require that both be specified when printing. In addition, CJK fonts normally | |
477 do not have the concept of italic glyphs and use different weight or stroke | |
478 style to achieve emphasis when printing. This in turn requires a different | |
479 approach to specifying fonts to use when printing. | |
480 | |
481 The encoding and character set are specified with the 'printencoding' and | |
482 'printmbcharset' options. If 'printencoding' is not specified then 'encoding' | |
483 is used as normal. If 'printencoding' is specified then characters will be | |
484 translated to this encoding for printing. You should ensure that the encoding | |
485 is compatible with the character set needed for the file contents or some | |
486 characters may not appear when printed. | |
487 | |
488 The fonts to use for CJK printing are specified with 'printmbfont'. This | |
489 option allows you to specify different fonts to use when printing characters | |
490 which are syntax highlighted with the font styles normal, italic, bold and | |
491 bold-italic. | |
492 | |
11473 | 493 No CJK fonts are supplied with Vim. There are some free Korean, Japanese, and |
15 | 494 Traditional Chinese fonts available at: |
495 | |
496 http://examples.oreilly.com/cjkvinfo/adobe/samples/ | |
497 | |
856 | 498 You can find descriptions of the various fonts in the read me file at |
15 | 499 |
2236
dc2e5ec0500d
Added the undofile() function. Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
500 http://examples.oreilly.de/english_examples/cjkvinfo/adobe/00README |
15 | 501 |
502 Please read your printer documentation on how to install new fonts. | |
503 | |
504 CJK fonts can be large containing several thousand glyphs, and it is not | |
505 uncommon to find that they only contain a subset of a national standard. It | |
506 is not unusual to find the fonts to not include characters for codes in the | |
507 ASCII code range. If you find half-width Roman characters are not appearing | |
11473 | 508 in your printout then you should configure Vim to use the Courier font the |
15 | 509 half-width ASCII characters with 'printmbfont'. If your font does not include |
510 other characters then you will need to find another font that does. | |
511 | |
512 Another issue with ASCII characters, is that the various national character | |
513 sets specify a couple of different glyphs in the ASCII code range. If you | |
514 print ASCII text using the national character set you may see some unexpected | |
515 characters. If you want true ASCII code printing then you need to configure | |
11473 | 516 Vim to output ASCII characters for the ASCII code range with 'printmbfont'. |
15 | 517 |
21991 | 518 It is possible to define your own multibyte character set although this |
15 | 519 should not be attempted lightly. A discussion on the process if beyond the |
520 scope of these help files. You can find details on CMap (character map) files | |
521 in the document 'Adobe CMap and CIDFont Files Specification, Version 1.0', | |
522 available from http://www.adobe.com as a PDF file. | |
523 | |
524 ============================================================================== | |
525 6. PostScript Printing Troubleshooting *postscript-print-trouble* | |
526 *E621* | |
527 Usually the only sign of a problem when printing with PostScript is that your | |
528 printout does not appear. If you are lucky you may get a printed page that | |
529 tells you the PostScript operator that generated the error that prevented the | |
530 print job completing. | |
531 | |
532 There are a number of possible causes as to why the printing may have failed: | |
533 | |
534 - Wrong version of the prolog resource file. The prolog resource file | |
11473 | 535 contains some PostScript that Vim needs to be able to print. Each version |
536 of Vim needs one particular version. Make sure you have correctly installed | |
15 | 537 the runtime files, and don't have any old versions of a file called prolog |
538 in the print directory in your 'runtimepath' directory. | |
539 | |
540 - Paper size. Some PostScript printers will abort printing a file if they do | |
11473 | 541 not support the requested paper size. By default Vim uses A4 paper. Find |
15 | 542 out what size paper your printer normally uses and set the appropriate paper |
543 size with 'printoptions'. If you cannot find the name of the paper used, | |
544 measure a sheet and compare it with the table of supported paper sizes listed | |
545 for 'printoptions', using the paper that is closest in both width AND height. | |
546 Note: The dimensions of actual paper may vary slightly from the ones listed. | |
547 If there is no paper listed close enough, then you may want to try psresize | |
548 from PSUtils, discussed below. | |
549 | |
550 - Two-sided printing (duplex). Normally a PostScript printer that does not | |
551 support two-sided printing will ignore any request to do it. However, some | |
552 printers may abort the job altogether. Try printing with duplex turned off. | |
553 Note: Duplex prints can be achieved manually using PS utils - see below. | |
554 | |
555 - Collated printing. As with Duplex printing, most PostScript printers that | |
556 do not support collating printouts will ignore a request to do so. Some may | |
557 not. Try printing with collation turned off. | |
558 | |
559 - Syntax highlighting. Some print management code may prevent the generated | |
560 PostScript file from being printed on a black and white printer when syntax | |
561 highlighting is turned on, even if solid black is the only color used. Try | |
562 printing with syntax highlighting turned off. | |
563 | |
564 A safe printoptions setting to try is: > | |
565 | |
566 :set printoptions=paper:A4,duplex:off,collate:n,syntax:n | |
567 | |
568 Replace "A4" with the paper size that best matches your printer paper. | |
569 | |
570 ============================================================================== | |
571 7. PostScript Utilities *postscript-print-util* | |
572 | |
573 7.1 Ghostscript | |
574 | |
575 Ghostscript is a PostScript and PDF interpreter that can be used to display | |
576 and print on non-PostScript printers PostScript and PDF files. It can also | |
577 generate PDF files from PostScript. | |
578 | |
579 Ghostscript will run on a wide variety of platforms. | |
580 | |
581 There are three available versions: | |
582 | |
583 - AFPL Ghostscript (formerly Aladdin Ghostscript) which is free for | |
584 non-commercial use. It can be obtained from: | |
585 | |
586 http://www.cs.wisc.edu/~ghost/ | |
587 | |
588 - GNU Ghostscript which is available under the GNU General Public License. It | |
589 can be obtained from: | |
590 | |
591 ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/gnu/ | |
592 | |
593 - A commercial version for inclusion in commercial products. | |
594 | |
595 Additional information on Ghostscript can also be found at: | |
596 | |
597 http://www.ghostscript.com/ | |
598 | |
599 Support for a number of non PostScript printers is provided in the | |
600 distribution as standard, but if you cannot find support for your printer | |
601 check the Ghostscript site for other printers not included by default. | |
602 | |
603 | |
604 7.2 Ghostscript Previewers. | |
605 | |
606 The interface to Ghostscript is very primitive so a number of graphical front | |
607 ends have been created. These allow easier PostScript file selection, | |
608 previewing at different zoom levels, and printing. Check supplied | |
609 documentation for full details. | |
610 | |
611 X11 | |
612 | |
613 - Ghostview. Obtainable from: | |
614 | |
615 http://www.cs.wisc.edu/~ghost/gv/ | |
616 | |
617 - gv. Derived from Ghostview. Obtainable from: | |
618 | |
619 http://wwwthep.physik.uni-mainz.de/~plass/gv/ | |
620 | |
621 Copies (possibly not the most recent) can be found at: | |
622 | |
623 http://www.cs.wisc.edu/~ghost/gv/ | |
624 | |
625 OpenVMS | |
626 | |
627 - Is apparently supported in the main code now (untested). See: | |
628 | |
629 http://wwwthep.physik.uni-mainz.de/~plass/gv/ | |
630 | |
18912
ccd16426a1f9
patch 8.2.0017: OS/2 and MS-DOS are still mentioned
Bram Moolenaar <Bram@vim.org>
parents:
18879
diff
changeset
|
631 MS-Windows |
15 | 632 |
633 - GSview. Obtainable from: | |
634 | |
635 http://www.cs.wisc.edu/~ghost/gsview/ | |
636 | |
637 Linux | |
638 | |
19116 | 639 - GSview. Linux version of the popular MS-Windows previewer. |
15 | 640 Obtainable from: |
641 | |
642 http://www.cs.wisc.edu/~ghost/gsview/ | |
643 | |
644 - BMV. Different from Ghostview and gv in that it doesn't use X but svgalib. | |
645 Obtainable from: | |
646 | |
647 ftp://sunsite.unc.edu/pub/Linux/apps/graphics/viewers/svga/bmv-1.2.tgz | |
648 | |
649 | |
650 7.3 PSUtils | |
651 | |
652 PSUtils is a collection of utility programs for manipulating PostScript | |
653 documents. Binary distributions are available for many platforms, as well as | |
654 the full source. PSUtils can be found at: | |
655 | |
656 http://knackered.org/angus/psutils | |
657 | |
658 The utilities of interest include: | |
659 | |
660 - psnup. Convert PS files for N-up printing. | |
661 - psselect. Select page range and order of printing. | |
662 - psresize. Change the page size. | |
663 - psbook. Reorder and lay out pages ready for making a book. | |
664 | |
665 The output of one program can be used as the input to the next, allowing for | |
666 complex print document creation. | |
667 | |
668 | |
669 N-UP PRINTING | |
670 | |
11473 | 671 The psnup utility takes an existing PostScript file generated from Vim and |
15 | 672 convert it to an n-up version. The simplest way to create a 2-up printout is |
673 to first create a PostScript file with: > | |
674 | |
675 :hardcopy > test.ps | |
676 | |
677 Then on your command line execute: > | |
678 | |
679 psnup -n 2 test.ps final.ps | |
680 | |
681 Note: You may get warnings from some Ghostscript previewers for files produced | |
682 by psnup - these may safely be ignored. | |
683 | |
684 Finally print the file final.ps to your PostScript printer with your | |
685 platform's print command. (You will need to delete the two PostScript files | |
686 afterwards yourself.) 'printexpr' could be modified to perform this extra | |
687 step before printing. | |
688 | |
689 | |
690 ALTERNATE DUPLEX PRINTING | |
691 | |
692 It is possible to achieve a poor man's version of duplex printing using the PS | |
693 utility psselect. This utility has options -e and -o for printing just the | |
694 even or odd pages of a PS file respectively. | |
695 | |
6530 | 696 First generate a PS file with the 'hardcopy' command, then generate new |
15 | 697 files with all the odd and even numbered pages with: > |
698 | |
699 psselect -o test.ps odd.ps | |
700 psselect -e test.ps even.ps | |
701 | |
702 Next print odd.ps with your platform's normal print command. Then take the | |
703 print output, turn it over and place it back in the paper feeder. Now print | |
704 even.ps with your platform's print command. All the even pages should now | |
705 appear on the back of the odd pages. | |
706 | |
2033
de5a43c5eedc
Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
1702
diff
changeset
|
707 There are a couple of points to bear in mind: |
15 | 708 |
709 1. Position of the first page. If the first page is on top of the printout | |
710 when printing the odd pages then you need to reverse the order that the odd | |
711 pages are printed. This can be done with the -r option to psselect. This | |
712 will ensure page 2 is printed on the back of page 1. | |
713 Note: it is better to reverse the odd numbered pages rather than the even | |
714 numbered in case there are an odd number of pages in the original PS file. | |
715 | |
716 2. Paper flipping. When turning over the paper with the odd pages printed on | |
717 them you may have to either flip them horizontally (along the long edge) or | |
718 vertically (along the short edge), as well as possibly rotating them 180 | |
719 degrees. All this depends on the printer - it will be more obvious for | |
720 desktop ink jets than for small office laser printers where the paper path | |
721 is hidden from view. | |
722 | |
723 | |
724 ============================================================================== | |
725 8. Formfeed Characters *printing-formfeed* | |
726 | |
25880 | 727 By default Vim does not do any special processing of formfeed control |
11473 | 728 characters. Setting the 'printoptions' formfeed item will make Vim recognize |
15 | 729 formfeed characters and continue printing the current line at the beginning |
730 of the first line on a new page. The use of formfeed characters provides | |
731 rudimentary print control but there are certain things to be aware of. | |
732 | |
11473 | 733 Vim will always start printing a line (including a line number if enabled) |
15 | 734 containing a formfeed character, even if it is the first character on the |
735 line. This means if a line starting with a formfeed character is the first | |
11473 | 736 line of a page then Vim will print a blank page. |
15 | 737 |
738 Since the line number is printed at the start of printing the line containing | |
739 the formfeed character, the remainder of the line printed on the new page | |
740 will not have a line number printed for it (in the same way as the wrapped | |
741 lines of a long line when wrap in 'printoptions' is enabled). | |
742 | |
743 If the formfeed character is the last character on a line, then printing will | |
744 continue on the second line of the new page, not the first. This is due to | |
11473 | 745 Vim processing the end of the line after the formfeed character and moving |
15 | 746 down a line to continue printing. |
747 | |
748 Due to the points made above it is recommended that when formfeed character | |
749 processing is enabled, printing of line numbers is disabled, and that form | |
750 feed characters are not the last character on a line. Even then you may need | |
751 to adjust the number of lines before a formfeed character to prevent | |
752 accidental blank pages. | |
753 | |
754 ============================================================================== | |
14421 | 755 vim:tw=78:ts=8:noet:ft=help:norl: |