Giter VIP home page Giter VIP logo

Comments (2)

michaelrsweet avatar michaelrsweet commented on June 10, 2024

Original reporter: Michael Sweet

Fixed in CVS - the anonymous CVS repository will be updated at midnight EST.See attached patch...

from htmldoc.

michaelrsweet avatar michaelrsweet commented on June 10, 2024

"str32.patch":

Index: ps-pdf.cxx
===================================================================
RCS file: /development/cvs/htmldoc1/htmldoc/ps-pdf.cxx,v
retrieving revision 1.89.2.260
diff -u -r1.89.2.260 ps-pdf.cxx
--- ps-pdf.cxx	4 Oct 2004 20:59:51 -0000	1.89.2.260
+++ ps-pdf.cxx	20 Oct 2004 18:21:16 -0000
@@ -2659,8 +2659,17 @@
             if (box[0] != r->data.box[0] ||
 		box[1] != r->data.box[1] ||
 		box[2] != r->data.box[2])
-              flate_printf(out, "%.2f %.2f %.2f RG\n", box[0] = r->data.box[0],
-	        	   box[1] = r->data.box[1], box[2] = r->data.box[2]);
+            {
+              box[0] = r->data.box[0];
+	      box[1] = r->data.box[1];
+	      box[2] = r->data.box[2];
+
+	      if (OutputColor)
+        	flate_printf(out, "%.2f %.2f %.2f RG\n", box[0], box[1], box[2]);
+              else
+        	flate_printf(out, "%.2f G\n",
+		             box[0] * 0.31f + box[1] * 0.61f + box[2] * 0.08f);
+            }
 
             flate_printf(out, "%.1f %.1f m %.1f %.1f l S\n",
                 	 r->x, r->y, r->x + r->width, r->y);
@@ -9382,10 +9391,24 @@
   render_rgb[1] = rgb[1];
   render_rgb[2] = rgb[2];
 
-  if (PSLevel > 0)
-    fprintf(out, "%.2f %.2f %.2f C ", rgb[0], rgb[1], rgb[2]);
+  if (OutputColor)
+  {
+    // Output RGB color...
+    if (PSLevel > 0)
+      fprintf(out, "%.2f %.2f %.2f C ", rgb[0], rgb[1], rgb[2]);
+    else
+      flate_printf(out, "%.2f %.2f %.2f rg ", rgb[0], rgb[1], rgb[2]);
+  }
   else
-    flate_printf(out, "%.2f %.2f %.2f rg ", rgb[0], rgb[1], rgb[2]);
+  {
+    // Output grayscale...
+    if (PSLevel > 0)
+      fprintf(out, "%.2f G ",
+              rgb[0] * 0.31f + rgb[1] * 0.61f + rgb[2] * 0.08f);
+    else
+      flate_printf(out, "%.2f g ",
+                   rgb[0] * 0.31f + rgb[1] * 0.61f + rgb[2] * 0.08f);
+  }
 }
 
 
@@ -11070,15 +11093,13 @@
     fputs("/BD{bind def}bind def", out);
     fputs("/B{dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto\n"
           "closepath stroke}BD", out);
-    if (!OutputColor)
-      fputs("/C{0.08 mul exch 0.61 mul add exch 0.31 mul add setgray}BD\n", out);
-    else
-      fputs("/C{setrgbcolor}BD\n", out);
+    fputs("/C{setrgbcolor}BD\n", out);
     fputs("/CM{concat}BD", out);
     fputs("/DF{findfont dup length dict begin{1 index/FID ne{def}{pop pop}\n"
           "ifelse}forall/Encoding fontencoding def currentdict end definefont pop}BD\n", out);
     fputs("/F{dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto closepath fill}BD\n", out);
     fputs("/FS{/hdFontSize exch def}BD", out);
+    fputs("/G{setgray}BD\n", out);
     fputs("/GS{gsave}BD", out);
     fputs("/GR{grestore}BD", out);
     fputs("/J{0 exch ashow}BD\n", out);

from htmldoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.