Bug 698275

Summary: GPL Ghostscript 9.21: Failed to interpret TT Instructions
Product: Ghostscript Reporter: mack.aries
Component: PDF InterpreterAssignee: Ken Sharp <ken.sharp>
Status: RESOLVED FIXED QA Contact: Bug traffic <tech>
Severity: normal    
Priority: P4    
Version: 9.21   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: crsmthmauoe.pdf
crsmthmautb.pdf
2017.07.21-01.png
simplified 1 page file

Description mack.aries 2017-07-20 12:07:21 UTC
Created attachment 13991 [details]
crsmthmauoe.pdf

GPL Ghostscript 9.21: Failed to interpret TT instructions in font CAAAAA+Lato-Black. Continue ignoring instructions of the font.
GPL Ghostscript 9.21: Failed to interpret TT instructions in font BAAAAA+Lato-Regular. Continue ignoring instructions of the font.
   **** Error: can't process embedded font stream,
        attempting to load the font using its name.
               Output may be incorrect.
   **** Error reading a content stream. The page may be incomplete.
               Output may be incorrect.
 . . . . . 
  . . . . 
   . . . 
    . .
     . 

Command:
./gs/gs-921-linux-x86_64 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=ps2write -q -sOutputFile=$PS_Output/$x.ps $PDF_Queue/$x
Comment 1 mack.aries 2017-07-20 12:07:49 UTC
Created attachment 13992 [details]
crsmthmautb.pdf
Comment 2 Ken Sharp 2017-07-21 00:34:36 UTC
You've attached two PDF files, and the command line you;ve supplied doesn't give me any clue as to which file is the problem. SO which one should I be looking at ?

Neither file, using both current HEAD and the 9.21 release gives me an error "Failed to interpret TT instructions in font CAAAAA+Lato-Black.". I do get a different set of errors on crsmthmautb.pdf regarding Times New Roman but that isn't the bug you are reporting. The other file, crsmthmauoe.pdf, completes without errors.

I notice that you are using Linux, and the name of the executable is not the standard 'gs'. Where did you get this executable from ? Did you build it form source ? Download a package ? Something else ?

If you got it from a package, then I'm going to have to suggest you contact the package maintainer and tell them there's a problem which doesn't exist in the vanilla version (in short, they broke it).
Comment 3 Ken Sharp 2017-07-21 01:00:10 UTC
OK I do now see the warning, but only at exit, not during the course of processing. Which is not surprising, since the font will only be interpreted at the end of the input.

What exactly do you see as the problem ? The file seems to work correctly to me.
Comment 4 mack.aries 2017-07-21 10:02:36 UTC
Created attachment 13994 [details]
2017.07.21-01.png
Comment 5 mack.aries 2017-07-21 10:03:28 UTC
I downloaded from:
https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs921/ghostscript-9.21-linux-x86_64.tgz

lets' focus on crsmthmautb.pdf

  **** Error: can't process embedded font stream,
        attempting to load the font using its name.
               Output may be incorrect.
   **** Error reading a content stream. The page may be incomplete.
               Output may be incorrect.
   **** Error: File did not complete the page properly and may be damaged.
               Output may be incorrect.

 . . . . . 
  . . . . 
   . . . 
    . .
     . 

GPL Ghostscript 9.21: Failed to interpret TT instructions in font BAAAAA+Lato-Regular. Continue ignoring instructions of the font.
GPL Ghostscript 9.21: Failed to interpret TT instructions in font CAAAAA+Lato-Black. Continue ignoring instructions of the font.


I've attached a prtscn (2017.07.21-01.png) of what I'm seeing after going from pdf to ps, entire blocks of text are missing.
Comment 6 Ken Sharp 2017-07-22 01:43:10 UTC
(In reply to mack.aries from comment #5)

> I've attached a prtscn (2017.07.21-01.png) of what I'm seeing after going
> from pdf to ps, entire blocks of text are missing.

Right, but that's nothing to do with the TT instructions. The log messages of importance in this file is the one which says:

   **** Error: can't process embedded font stream,
        attempting to load the font using its name.
               Output may be incorrect.

This also (unlike the TT instructions warning) applies to rendering as well as to the ps2write device. This is why its important to be as clear as possible when reporting bugs; tell us what you see as the problem and try to make it simple to reproduce.
Comment 7 Ken Sharp 2017-07-22 02:04:03 UTC
So, as a matter of interest mack, what is your relationship with the producer of this document ?

Do you work for 'EveryCRSReport.com' ? The reason I ask is that the PDF Producer is listed as EveryCRSReport.com.

The basic problem with the PDF file is that it contains a Widths array with indirect object references. For example:

62 0 obj
[ 250 0 0 0 500 61 0 R ........... 

The 61 0 R is an indirect reference. Doing this is, basically, nuts, since all it does is make the file larger. I don't think this is technically legal, though of course the specification is somewhat grey on this point. It says:

"An array of (LastChar − FirstChar + 1) widths, each element being the glyph width for the character code that equals FirstChar plus the array index"

Ordinarily I would say that precludes indirect references, but these days Adobe seems to allow pretty much anything to be an indirect reference.
Comment 8 Ken Sharp 2017-07-24 06:33:10 UTC
Created attachment 14004 [details]
simplified 1 page file
Comment 9 Ken Sharp 2017-07-24 07:57:31 UTC
OK the actual problem is fixed in commit bfed2aa2b1d854d4b63bc75957438e38fca361fc

The failure to interpret TT instructions is because the PDF file contains two broken TrueType fonts. This has no bearing on the output so we will ignore the error.

Note that, in additi0on to all the other problems, this file declares itself to be a PDF 1.3, but uses features of PDF 1.5, so that's incorrect too.
Comment 10 mack.aries 2017-07-24 08:35:31 UTC
I appreciate your analysis and assistance, Thank You!