[gs-cvs] rev 8074 - trunk/gs/lib

alexcher at ghostscript.com alexcher at ghostscript.com
Fri Jun 22 19:43:32 PDT 2007


Author: alexcher
Date: 2007-06-22 19:43:31 -0700 (Fri, 22 Jun 2007)
New Revision: 8074

Modified:
   trunk/gs/lib/pdfwrite.ps
Log:
Replace exponential format of a real number with a decimal point format
in PDF writing utilities because PDF doesn't support exponential format.
Bug 689293, customer 932.


Modified: trunk/gs/lib/pdfwrite.ps
===================================================================
--- trunk/gs/lib/pdfwrite.ps	2007-06-22 22:05:56 UTC (rev 8073)
+++ trunk/gs/lib/pdfwrite.ps	2007-06-23 02:43:31 UTC (rev 8074)
@@ -244,8 +244,38 @@
   /nulltype { pop (null) ows } bind
   /integertype { =string cvs ows } bind
   /booleantype 1 index
-  /realtype { OFile exch write===only } bind
-  /stringtype 1 index
+  /realtype {
+    =string cvs
+    (e) search {  % PDF has no exponential format
+      exch pop % exp pre
+      exch cvi exch
+      (-) anchorsearch { ows } if
+      (.) search {
+        exch pop            % exp (frac) (int)
+        1 index length      % exp (frac) (int) len
+        3 1 roll            % exp len (frac) (int)
+        exch concatstrings  % exp len (int_frac)
+        3 1 roll sub        % (int_frac) exp-len
+        exch                % exp-len (int_frac)
+      } if                  % exp (mant)
+      1 index 0 ge {
+        ows { (0) ows } repeat (.) ows
+      } {
+        dup length          % exp (mant) len
+        3 -1 roll add       % (mant) exp+len
+        dup 0 le {
+          (0.) ows neg { (0) ows } repeat ows
+        } {
+          2 copy 0 exch getinterval ows
+          (.) ows
+          1 index length 1 index sub getinterval ows
+        } ifelse
+      } ifelse
+    } {
+      ows
+    } ifelse
+  } bind
+  /stringtype { OFile exch write===only } bind
   /nametype { pdfwritename } bind
 	% Composite/reference objects
   /arraytype { pdfwritearray } bind



More information about the gs-cvs mailing list