xref: /plan9-contrib/sys/src/cmd/gs/doc/Issues.htm (revision d46c239f8612929b7dbade67d0d071633df3a15d)
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<title>Ghostscript Open Issues.</title>
5<!-- $Id: Issues.htm,v 1.15.2.2 2002/02/01 05:31:25 raph Exp $ -->
6<link rel="stylesheet" type="text/css" href="gs.css" title="Ghostscript Style">
7</head>
8
9<body>
10<!-- [1.0 begin visible header] ============================================ -->
11
12<!-- [1.1 begin headline] ================================================== -->
13
14<h1>Known limitations and minor bugs.</h1>
15
16<!-- [1.1 end headline] ==================================================== -->
17
18<!-- [1.2 begin table of contents] ========================================= -->
19
20<h2>Table of contents</h2>
21
22<ul>
23<li><a href="#Known_Limitations">Known Limitations</a>
24<li><a href="#Minor_bugs">Minor bugs</a>
25<li><a href="#Driver_Issues">Specific Driver Issues</a>
26<li><a href="#Performance">Performance</a>
27<li><a href="#Differences_from_Adobe">Differences from Adobe Implementation</a>
28</ul>
29
30<!-- [1.2 end table of contents] =========================================== -->
31
32<!-- [1.3 begin hint] ====================================================== -->
33
34<p>For other information, see the <a href="Projects.htm">Development Projects list
35</a>.
36
37<!-- [1.3 end hint] ======================================================== -->
38
39<hr>
40
41<!-- [1.0 end visible header] ============================================== -->
42
43<!-- [2.0 begin contents] ================================================== -->
44
45<p>
46There are many areas that might make Ghostscript more useful or minor bugs
47that we would like to investigate and possibly fix, but for which we don't
48have enough resources. These may or may not be addressed in future releases.
49<p>
50If you would like to take responsibility for any of these issues, please
51<a href="mailto:raph@artofcode.com">contact us</a>.
52<p>
53Additional comments on implementation approaches or project goals are in
54<I>italic type like this</I>.
55<hr>
56
57<h2><a name="Known_Limitations"></a>Known Limitations.</h2>
58
59<h3>bbox device doesn't allow min coords < 0.</h3>
60Adobe eps specification doesn't say that bbox values must be positive,
61and, for example Adobe Illustrator, can create EPS files with negative bboxes.
62In such case, Ghostscipt returns zero instead of proper negative number.
63<br>SourceForge Bug #202735 March 09, 2000.
64<p>
65<I>
66This might be able to be fixed by applying a large positive translation to
67the bbox CTM which would be subtracted from coordinates passed to the target
68device as well as from the results the bbox device reports.
69<p>
70If coordinates for the ImagingBBox[0] and [1] values, then negative
71values are handled, but this is not reliable since there are places in
72the graphics library that depend on first quadrant coordinates.
73</I>
74
75<h3>Error messages are too low level and confusing.</h3>
76
77<p>
78Although technically correct many error messages are confusing for
79end users. Some commonly reported examples are listed below.
80
81<p>
82When pdfwrite device cannot open the output file it fails with:
83<pre>**** Unable to open the initial device, quitting.</pre>
84
85When CIDFont-CMap pair required by PDF file is not available GS
86fails with:
87<pre>/undefinedresource in --findresource--</pre>
88
89<hr>
90<h2><a name="Minor_bugs"></a>Minor Bugs.</h2>
91
92<h3>gs-6.31 and gs-6.60 fail running lib/image-qa.ps</h3>
93Running lib/image-qa.ps with gs-6.31 or gs-6.60 produces an error message.
94<pre>
95Type 1
96Stencil
97Mask
98Error: /ioerror in --fileposition--
99</pre>
100SourceForge Bug #223005, November 20, 2000.
101<p>
102<I>
103This is an error in the test file, not GS. fileposition correctly
104throws ioerror when it is used on filtered files.
105<br>
106The test should be written to use .fileposition when running on Ghostscript
107and enclose fileposition in { } stopped when not. Also for portability to
108PostScript interpreters without Ghostscript extensions, '=only' should be
109defined to use '=print' or '='.
110</I>
111
112<h3>PageSize cannot use packedarray</h3>
113PageSize doesn't accept packed array as an argument if the page size is
114adjusted, for instance, to the whole number of pixels. The following
115program
116<pre>
117%!
118/x 333.33333333 def /y 666.66666666 def
119
120<< /PageSize x y 2 packedarray >> setpagedevice
121(pached passed)==    % fails
122%EOF
123</pre>
124fails with
125<pre>
126Error: /configurationerror in --setpagedevice--
127Additional information: [/PageSize [333.333344 666.666687]]
128</pre>
129
130<h3> Multiple encode filters in a pipeline fail.</h3>
131The following code fragment should output "3E>". It outputs nothing.
132<pre>
133%!PS
134(%stdout) (w) file
135/ASCIIHexEncode filter
136/ASCIIHexEncode filter
137closefile
138</pre>
139SourceForge bug #224134, December 2, 2000.
140
141<h3> Bad JPEG stream in PDF generated when source ends prematurely</h3>
142When GS converts the source image to JPEG stream in PDF file and the
143source data end prematurely, it generates bad JPEG stream.
144tiff2ps from libtiff distribution often generates such files.
145<p>
146One potential workaround is to use -dAutoFilterColorImages=false and
147-dColorImageFilter=/FlateEncode.
148<p>
149SourceForge bug #228808, Jan 15, 2000.
150<p>
151<I>
152JPEG stream writes image dimensions in JPEG header when the stream is created.
153When the source data end the dimensions are not updated. There may be other
154problems too.
155</I>
156
157<h3> Some attributes of Catalog object are lost during PDF to PDF conversion</h3>
158Dests, OpenAction, URI, PageMode, ViewerPreferences are lost during PDF to PDF
159conversion. Other attributes have not been checked.
160<p>
161<I>
162The loss happens diring PDF interpretation. GS can generate these attributes
163from pdfmark's.
164</I>
165<p>
166March 25, 2001.
167<h3>ps2pdf ignores transfer functions in shaded fill</h3>
168ps2pdf ignores transfer functions in the shaded fill but
169uses them for vector objects. The following sample program
170has 2 shaded fills and 2 rectangles that should have the
171same color as the left end of the shaded fill.
172<pre>
173
174      <</PageSize [612 200] /Policies<</PageSize 1>> >>setpagedevice
175      612 1 scale
176      /grad
177      { gsave
178	  0 0 1 100 rectclip
179	  <<
180	      /ColorSpace [/DeviceCMYK]
181	      /Domain [0 1]
182	      /Coords [0 0 1 0]
183	      /Extend [false false]
184	      /Function
185	      << /FunctionType 3
186		  /Domain [ 0 1]
187		  /Functions
188		  [ <<
189		      /FunctionType 2
190		      /N 1
191		      /C0 [ 0 0.5 0 0 ]
192		      /Domain [ 0 1]
193		      /C1 [0.5 0 0 0]
194		  >> ]
195		  /Bounds []
196		  /Encode [0 1]
197	      >>
198	      /ShadingType 2
199	  >> shfill
200
201      0 0.5 0 0 setcmykcolor
202      0 0 0.1 50 rectfill
203      grestore
204      } def
205
206      grad
207      {1 exch 2 div sub} settransfer
208      0 100 translate
209      grad
210      showpage
211</pre>
212SourceForge Bug #232334, Feb 14, 2001.
213
214<h3>ResourceFileName gives wrong result with Font category.</h3>
215The following sequence:
216
217<pre>
218	/Font /Category findresource begin
219	/CharterBT-Roman 255 string ResourceFileName =
220	end
221</pre>
222
223Gives the results:
224<pre>
225        /Resource/Font/CharterBT-Roman
226</pre>
227
228This should be a valid platform specific file name and path such as:
229<pre>
230        f:/afpl/fonts/bchr.pfa
231</pre>
232SourceForge Bug #233403, Feb 21, 2001.
233<h3>GS doesn't handle names of separations with HalftoneType 5.</h3>
234PLRM3 says, that HalftoneType 5 may use user defined
235names of separations. Neither zht2.c nor cmd_put_drawing_color in
236gxclpath.c can handle this. GS chooses default halftone component
237for any non-standard separation name.
238<p>
239SourceForge Bug #406643, Mar 7, 2001.
240
241<h3> PDF 1.4 images don't deallocate all memory </h3>
242
243The pdf14_begin_typed_image() function in the PDF 1.4 device creates
244a marking device, but this is not freed on end_image. The garbage
245collector will free it, so it's not a real memory leak, but it would
246still be nicer to free it explicitly.
247
248<h3> </h3>
249
250<hr>
251
252<h2><a name="Driver_Issues"></a>Driver Issues.</h2>
253
254<h3> [ ] Missing text in landscape mode.</h3>
255Using GSWIN32C.EXE with djet500 to print a file in landscape mode
256on a HP 2000C, the first 3 characters on the left margin are missing.<br>
257When the postscript file is editted to use a larger offset (1st moveto
258parameter), the text appears ok.<br>
259When the postscript file is sent to a printer with a builtin postscript
260interpreter, it prints ok.
261<br>SourceForge Bug #206652.
262<p><I>
263A possible work around is to send the following
264postscript file to the printer prior to printing the problem
265file.  This works but it leaves a .5" margin at the top
266and left which is may be ok for some uses.
267</I>
268<pre>
269
270%!PS-Adobe-2.0
271% Reset the offset and margins.
272<<
273    /PageOffset [-12 -18]
274    /Margins [0 0]
275    /.HWMargins [0 0 0 0]
276>>
277setpagedevice
278</pre>
279
280<I>
281This is an instance of the endless struggle with printer margins, especially
282for HP printers. The HP drivers are inconsistent as to whether the user space
283(0,0) should be the physical corner of the page (as it is in PostScript) or
284the corner of the printable area, and if the latterm whether the page should
285be clipped or scaled.
286</I>
287<p>
288
289<hr>
290
291<h2><a name="Performance"></a>Performance.</h2>
292
293<h3>Incremental loading for CIDFontType 2 and TrueType fonts.</h3>
294
295Entire TrueType outline data in CIDFontType 2 and TrueType fonts are
296loaded into memory at once.  Incremental loading of the outline data is
297indispensable for practical use of Asian fonts.
298<p>
299There is one other type of CID-keyed font that should also be
300loaded incrementally: CFF CIDFontType0, i.e., a CIDFontType 0
301font represented using the compact binary CFF format. This is
302important because this is one of the two variants of Asian OpenType
303fonts (the other is essentially the same as TrueType). Ghostscript
304already supports both of these OpenType variants, but not with
305incremental loading.
306<p>
307SourceForge bug #223992, November 30, 2000.
308<p><I>
309We suggest that anyone who would like to work on this project
310start by looking at how CIDFontType 0 fonts do incremental loading
311(lib/gs_cidfn.ps and src/zfcid0.c). Probably much of this
312code can be also be used with CIDFontType 2 and TrueType fonts.
313</I>
314
315<hr>
316
317<h2><a name="Differences_from_Adobe"></a>Differences from Adobe Implementation.</h2>
318
319<h3>pdfwrite + TT font => Acrobat 3.x for Windows gives error</h3>
320
321Running ps2pdf12 on the file test1.ps produces a PDF on which Acrobat
3223.x for Windows complains about not being able to find or create a
323particular TrueType font that is embedded in the PDF file.  However,
324Acrobat 3.x for other platforms, and Acrobat 4.x for all platforms,
325accepts the file.
326<p>
327SourceForge bug #201955, February 14, 2000.
328<p><I>
329Since Acrobat 3 is superseded by Acrobat 4 which is available at no
330charge, and the file produced by Ghostscript meets published PDF
331specification, this will most likely be left as is.
332</I>
333
334<h3> Inconsistent handling of /Orientation.</h3>
335PLRM says "The dictionary returned by currentpagedevice always
336contains an entry for every parameter supported by the device".
337GS prints both messages in the following program:
338
339<pre>
340%!
341currentpagedevice /Orientation known not
342{ (This printer does _not_ support Orientation.) =
343}
344if
345<</Orientation 1>> setpagedevice
346currentpagedevice /Orientation known
347{ (Err... wait... it does.) =
348}
349if
350%%EOF
351</pre>
352SourceForge bug #220967, October 31, 2000.
353<p><I>
354The handling of Orientation is a mess. The PLRM says quite explicitly
355that it is only supported for roll devices, where the page size
356alone doesn't give enough information to decide whether to rotate
357the page.
358<p>
359The reason that Ghostscript accepts it for other devices at all
360is twofold: displays are like roll media in that they don't have
361an inherent orientation, and almost none of the other Ghostscript
362devices actually specify their page sizes. Both of these reasons
363are now poorly motivated: displays should behave like
364portrait-orientation devices (albeit with variable page dimensions),
365rotating the image if the requested page width is greater than
366the height, and now that setpagedevice and the Resource machinery
367are fully implemented, all printer drivers should be updated
368to provide the paper size information. Once these fixes are made
369(which will probably have some repercussions other places in
370the code), Ghostscript will handle Orientation properly.
371<p>
372This should be addressed when the "setpagedevice in C" project is
373completed since part of this will require printer drivers to make
374page size information available to the setpagedevice logic.
375</I>
376
377<h3>Filesystem implementation differences.</h3>
378Adobe implementations often treat the filesystem as flat. This means that the
379path separator characters are not handled as special characters in filenames.
380The PLRM states that file names are implementation specific (section 3.8.2)
381and Ghostscript currently implements filenames that conform with the underlying
382operating system as is stated in this section about the %os% device. This
383can result from behaviour that is different from Adobe printer implementations.
384<br><br>
385<I>
386Current implementation is incompatible with most font installers. Installers
387expect that:
388<ul>
389"filenameforall" enumerates all files in all directories using the relative path name.
390Directory names, including . and .. are not enumerated
391</ul>
392<ul>
393characters not supported on the platform are encoded.
394</ul>
395<ul>
396"(w) file" operator creates directories if necessary.
397</ul>
398</I>
399
400<h3>Cannot load Adobe's fonts. </h3>
401The following program fails with Adobe fonts:
402
403<pre>
404(C*)
405{ cvn findfont pop
406} 255 string /Font resourceforall
407</pre>
408SourceForge Bug #226462, December 20, 2000.
409<p>
410<I>
411The 'findfont' operator and '/Font resourceforall' are very difficult to
412keep consistent, because the same logic algorithms must be implemented
413in two different ways. The problem is likely to be in lib/gs_fonts.ps,
414lib/gs_res.ps, and lib/gs_cidcm.ps.
415</I>
416<h3> There's no %ram% device.</h3>
417GS doesn't have %ram% device reguired on all Level 3 products.
418It is documented in PS Supplement 3010 and 3011 dated August 30, 1999
419<br>SourceForge Bug #226943, December 27, 2000.
420<p>
421<I>
422This should be implemented using the (disk) file system rather than
423actual RAM, at least initially, since that will be easy.
424<br>
425On Unix, it should be implemented with a directory /tmp/$$/ (where
426$$ is the process id), which Ghostscript should delete when it exits.
427</I>
428
429<h3> pdfwrite doesn't recognise the image type by content</h3>
430Currently pdfwrite uses JPEG compression for any 8 bit per component
431images >= 64 pixels in both dimensions.
432<p>
433<I>
434pdfwrite needs to be changed to use a reasonable algorithm for deciding
435between JPEG and Flate compression, probably based on sharp vs. smooth
436color transitions in the image; in case of uncertainty, it should use Flate.
437</I>
438<p>
439SourceForge Bug #226391, December 19, 2000.
440<p>
441
442
443<h3> ps2ascii can't handle incremental fonts</h3>
444ps2ascii fails with rangecheck on incremental fonts.
445Need to recognise incremental fonts and say that incremental
446fonts are impossible to convert to ASCII.
447<p>
448SourceForge Bug #441959 keeps good test data for this.
449<p>
450
451
452<h3> Buffering in input filters</h3>
453
454The following program prints differently to stdout on GS and Adobe :
455<p>
456<pre>
457%!
458/proc
459  { currentfile =string readline pop
460    dup ==
461    (%) anchorsearch { pop } if
462  } bind def
463/test
464  { //proc /ASCIIHexDecode filter
465    3 string readstring pop ==
466  } bind def
467
468(start) ==
469
470test
471%31
472%32
473%33
474%34
475%35
476%36
477%37
478%38
479%39
480
481(stop) ==
482
483%%EOF
484</pre>
485<p>
486<I>
487Adobe fills entire input buffer of ASCIIHexDecode with procedure's output,
488before passing data to ASCIIHexDecode, and without knowledge how much data
489does ASCIIHexDecode want. GS does know the size of data requested,
490so as the procedure is called exact number of times. Thus, GS is more conservative.
491</I>
492<p>
493Anoter useful test to be made by repeating lines %31-%39 hundred times,
494without intermediate empty lines.
495<p>
496<h3>                                              </h3>
497<p>
498
499
500<!-- [2.0 end contents] ==================================================== -->
501
502<!-- [3.0 begin visible trailer] =========================================== -->
503<hr>
504
505<p>
506<small>Copyright &copy; 2000 artofocode LLC.  All rights reserved.</small>
507
508<p>
509<small>This file is part of AFPL Ghostscript.  See the
510<a href="Public.htm">Aladdin Free Public License</a> (the "License") for
511full details of the terms of using, copying, modifying, and redistributing
512AFPL Ghostscript.</small>
513
514<p>
515<small>Ghostscript version 7.04, 31 January 2002
516
517<!-- [3.0 end visible trailer] ============================================= -->
518
519</body>
520</html>
521