问题
Okay, I now "know" postscript, everything makes a lot more sense now.
I've found that if I change the colour though it affects backgrounds in other areas, I now know that sc, SC, cs and CS are procedures:
/cs { /pdfFillXform exch def dup /pdfFillCS exch def
setcolorspace } def
/CS { /pdfStrokeXform exch def dup /pdfStrokeCS exch def
setcolorspace } def
/sc { pdfLastFill not { pdfFillCS setcolorspace } if
dup /pdfFill exch def aload pop pdfFillXform setcolor
/pdfLastFill true def /pdfLastStroke false def } def
/SC { pdfLastStroke not { pdfStrokeCS setcolorspace } if
dup /pdfStroke exch def aload pop pdfStrokeXform setcolor
/pdfLastStroke true def /pdfLastFill false def } def
But when I re-colour some parts of it, that seems to affect the background elsewhere! My task is to change all font to black by the way (there's white for some reason ... I really don't get why).
Things like this:
-0.925088 TJm
Q
/DeviceGray {} cs
[1] sc
q
[10 0 0 10 0 0] cm
[1 0 0 1 0 0] Tm
0 0 Td
[1 0 0 1 286.875 503.428] Tm
0 0 Td
/F11_0 11.9551 Tf
It's that 1 I want to change, I want that to be a 0.
Any ideas I really am not sure what to do now
Source document was a pdf, changed though pdftops
Thanks
Additional:
/Tj {
fCol
1 index stringwidth pdfTextMat idtransform pop
sub 1 index length dup 0 ne { div } { pop pop 0 } ifelse
pdfWordSpacing pdfHorizScaling mul 0 pdfTextMat dtransform 32
4 3 roll pdfCharSpacing pdfHorizScaling mul add 0
pdfTextMat dtransform
6 5 roll Tj1
} def
This renders the characters
(n) 7.471938 Tj
If I can set the colour in that procedure, then pop the colour, I'm set!
How might I do this?
----------------TO PEOPLE OF THE FUTURE---------
/Tj {
/DeviceGray {} cs
[0] sc
fCol
1 index stringwidth pdfTextMat idtransform pop
sub 1 index length dup 0 ne { div } { pop pop 0 } ifelse
pdfWordSpacing pdfHorizScaling mul 0 pdfTextMat dtransform 32
4 3 roll pdfCharSpacing pdfHorizScaling mul add 0
pdfTextMat dtransform
6 5 roll Tj1
} def
That's my fix, I put the device grey part at the bottom, it sets it to black every time this Tj procedure is used (like.... every letter!) and doesn't (seem) to affect anything else.
My white text problem is solved! http://www.adobe.com/products/postscript/pdfs/PLRM.pdf
Worth a read! Postscript's specification!
来源:https://stackoverflow.com/questions/16349454/postscript-forcing-a-text-search