in reply to Re^3: How to change font color in PDF based by font name
in thread How to change font color in PDF based by font name

Hi

Thanks for your help

I am able to find the (/FontName /XJQTHX+NewsGothicStd def) with in the postscript file. Please help me out how to change the color of the font.

If i go and inserting individual line before text (0.134 0.473 0.790 setrgbcolor) the color information, the color is change and i can able to see in PDF

Can i get any guidence from you

Thanks in Advance

  • Comment on Re^4: How to change font color in PDF based by font name

Replies are listed 'Best First'.
Re^5: How to change font color in PDF based by font name
by ambrus (Abbot) on Jul 07, 2011 at 14:45 UTC
    If i go and inserting individual line before text (0.134 0.473 0.790 setrgbcolor) the color information, the color is change and i can able to see in PDF

    Great, you're almost there! Now you just have to find the places where the font is changed.

    Notice how the prelude will probably define a function that changes font, using the primitive operator setfont or selectfont. For example, the definition may look like this:

    /Tf { dup /pdfFontSize exch def dup pdfHorizScaling mul exch matrix scale pdfTextMat matrix concatmatrix dup 4 0 put dup 5 0 put exch findfont exch makefont setfont } def

    (Of course, this function in the prelude is specific to the pdftops utility, but I'm assuming here you've used that to generate the postscript file.)

    Once you've found this, search for calls to this proceduce, such as this:

    /F784_0 1 Tf

    The F784_0 here is an identifier for the font (the actual font is assigned to it somewhere in the prelude, but pdftops generates such a short identifier because the same font will typically occur many times), and the 1 is I think a scaling modifier.

    Find these lines that change the font, and change the color after that, depending on which font is used.

    PS. the part you mention with /FontName /XJQTHX+NewsGothicStd def is where the font is defined, not the statement where that font is activated. It could be useful if you want to know which short identifier means which font.

Re^5: How to change font color in PDF based by font name
by luis.roca (Deacon) on Jul 07, 2011 at 12:38 UTC

    Hello vinothjaguva,

    Also, there's no need to post a reply two or three times. Doing this only makes it more confusing for people to respond and help you. Please preview your message, double check the thread to confirm your post has gone up and wait for a reply from one of the monks.

    Good luck with your postscript problem. :)

    Luis


    "...the adversities born of well-placed thoughts should be considered mercies rather than misfortunes." — Don Quixote