Fix for Bug 686961 - Can't open a PDF file in GS 8_10 (but it works in GS 8_00).

"Jeong Kim" <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <000001c369d4$c701e800$6100a8c0@daedun>
Reviewers,

When an MS TrueType Format 2.0 font does not have Glyph names data, the 
rangecheck error occurs.

Following code segment (line 461-467 in gs_ttf.ps) is for building Glyph

names array for MS TrueType Format 2.0,

      [ numglyphs 1 sub {
	postglyphs postpos get <-----
        postglyphs postpos 1 add 2 index getinterval cvn
	exch postpos add 1 add /postpos exch def
	postpos postglyphs length ge { exit } if
      } repeat
      ] /postnames exch def

/postpos is the pointer value for the position where Glyph names data 
starts. When Glyph names data is not included in a font, /postpos value
is 
equal to the length of the whole 'post' table data (/postglyphs) and
'get' 
operator in the second line of the code segment above makes invalid
access 
to the data.

To avoid this situation mentioned, I moved the termination condition 
checking code in the last of the loop to the first.

      [ numglyphs 1 sub {
	postpos postglyphs length ge { exit } if <-----
	postglyphs postpos get
        postglyphs postpos 1 add 2 index getinterval cvn
	exch postpos add 1 add /postpos exch def
      } repeat
      ] /postnames exch def

Now the condition checking code makes the process exit the loop when
Glyph 
names data is not available and no error occurs.

Jeong

Log:
When Glyph names data is not available for a TrueType Format 2.0 font, 
rangecheck error occured. Now fixed. Bug#686961.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.