Re: Asking help for preview-latex
Ikumi Keita <[email protected]> Wed, 03 Jul 2019 17:30:28 +0900
| Newsgroups | gmane.comp.printing.ghostscript.devel,gmane.emacs.auctex.devel |
|---|---|
| Message-ID | <51930.1562142628@localhost> |
--=-=-= Content-Type: text/plain Hi Chris, >>>>> Chris Liddell <[email protected]> writes: > Right, sorry for the delay, as I said, that ended up being a much more > involved task than I'd anticipated! Thanks, the proposed fix works well on my side! The generated image turns its color as expected. > First and foremost (and apologies for this), we can't do anything to get > this working in the 9.27 release. Your options are to use 9.26, use the > "in-development" code from our repo, or (on Linux systems) convince the > package maintainer to pick up the commits listed below. I tested the ghostscript source of 9.27 release with the three patches associated with the listed commits, on FreeBSD 12.0. Though there was one rejection when applying the patches at gs_fonts.ps, I could manually recover the fail it since it was just straightforward. > So, in essence, the idea is that you'll remove the stuff using > GS_PDF_ProcSet entirely. Add the option -dDELAYBIND to your gs command > line, include a suitable redefinition of initgraphics, then call > .bindnow, and continue as before. > The redefinition of initgraphics would look something like: > /initgraphics { > //initgraphics > /RG where { > pop <R value> <B value> <G value> 3 copy rg RG > } if > } bind def > So, that first calls the original initgraphics operator. It then checks > if the name "RG" is known to any dictionary on the dictionary stack > (which will only be the case when being called from the PDF > interpreter), and if that is the case, then set fill and stroke colors > as you require ("R/G/B value" being place holders for the "real" numbers). > After that, and before running any more Postscript or PDF, you'd call > the .bindnow operator. Attached is the change I used for preview-latex, for those who are interested. Chris, there is a possibility that we ask you (or the Ghostscript development team) to agree to transfer the copyright of the above PostScript code of several lines to Free Software Foundation. Are you fine to agree if that really happens? To project admin of AUCTeX (especially David Kastrup): Could you please judge whether the PostScript code Chris provided above needs copyright assignment in order to incorporate into AUCTeX, and if so, provide instruction for him if he is fine to do so? (Ah, but now the message from David arrived. Maybe he writes relevant PS codes by himself.) > I can't test all this in the context of your workflow, but I've tested > it with the example PDF you supplied, and I can change the color of the > objects. Thank you again, Chris, we all appreciate your kind cooperation pretty much. Best regards, Ikumi Keita --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=diff-preview-el-in Content-Description: patch for preview-latex diff --git a/preview.el.in b/preview.el.in index 30bf45bf..11ff3299 100644 --- a/preview.el.in +++ b/preview.el.in @@ -353,7 +353,7 @@ LIST consists of TeX dimensions in sp (1/65536 TeX point)." :group 'preview-gs :type 'string) -(defcustom preview-gs-options '("-q" "-dDELAYSAFER" "-dNOPAUSE" +(defcustom preview-gs-options '("-q" "-dDELAYBIND" "-dDELAYSAFER" "-dNOPAUSE" "-DNOPLATFONTS" "-dPrinted" "-dTextAlphaBits=4" "-dGraphicsAlphaBits=4") @@ -749,11 +749,20 @@ to Ghostscript floats." ;; anything readable turned up, anyway. (let ((fg (aref colors 1))) (if fg +;; (concat +;; "/GS_PDF_ProcSet GS_PDF_ProcSet dup maxlength dict copy dup begin\ +;; /graphicsbeginpage{//graphicsbeginpage exec " +;; (mapconcat #'preview-gs-color-value fg " ") +;; " 3 copy rg RG}bind store end readonly store ")))) (concat - "/GS_PDF_ProcSet GS_PDF_ProcSet dup maxlength dict copy dup begin\ -/graphicsbeginpage{//graphicsbeginpage exec " + "/initgraphics { + //initgraphics + /RG where { + pop " (mapconcat #'preview-gs-color-value fg " ") - " 3 copy rg RG}bind store end readonly store ")))) + " 3 copy rg RG + } if +} bind def ")))) (defun preview-gs-color-string (colors) "Return a string setting up colors" @@ -912,7 +921,8 @@ The usual PROCESS and COMMAND arguments for (setq TeX-sentinel-function nil) (setq preview-gs-init-string (concat preview-gs-init-string - (preview-pdf-color-string preview-colors))) + (preview-pdf-color-string preview-colors) + ".bindnow")) (preview-prepare-fast-conversion) (when gsstart (if preview-gs-queue --=-=-=--