686975 Black box when converting to tiff

"Jeong Kim" <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
Reviewers,

The reason why a black box appears when the given file is converted 
into tiff format is due to the invalid glyph data in the file.
If you convert this file into pdf with Acrobat Distiller, you can see a
black 
line which is located at the position of the bottom line of the black
rectangle.

Therefore, the problem is not the black rectangle but a difference between
results 
at low and high resolution.
This difference is related with new Type1 hinter.

With NEW_TYPE1_HINTER = 0, at both low and high resolution
the black rectangle appears. Again there is no difference between
the outputs at any resolution.

With NEW_TYPE1_HINTER = 1, fraction bits are used to increase
accuracy and this makes difference between low and high resolution.

gxhintn.c
--
private inline fixed o2d(const t1_hinter *h, t1_hinter_space_coord v)
{   
    return ((v >> (h->g2o_fraction_bits - _fixed_shift - 1)) + 1) >> 1;
}

In line 283 - gxhintn.c, 'v' is shifted by the value of 
'h->g2o_fraction_bits - _fixed_shift - 1'. But in the case of 'h-
>g2o_fraction_bits'
is less or equal than the value of _fixed_shift, 'v' is attempted to be
shifted 
by
a negative value and 'v' is set as zero.

So I did a simple patch work for this problem as follows.

private inline fixed o2d(const t1_hinter *h, t1_hinter_space_coord v)
{   
    return ((h->g2o_fraction_bits > _fixed_shift) ?
	((v >> (h->g2o_fraction_bits - _fixed_shift - 1)) + 1) >> 1 :
	((v << (_fixed_shift - h->g2o_fraction_bits + 1)) + 1) >> 1);
}

Log:
With new Type1 Hinter, fraction bits are used to increase accuracy and this 
makes difference between results at low and high resolution. 
Now Fixed. 686975.

Jeong

Index: src/gxhintn.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gxhintn.c,v
retrieving revision 1.41
diff -C2 -r1.41 gxhintn.c
*** src/gxhintn.c	7 Jan 2004 11:12:59 -0000	1.41
--- src/gxhintn.c	12 Jan 2004 00:22:01 -0000
***************
*** 280,284 ****
  
  private inline fixed o2d(const t1_hinter *h, t1_hinter_space_coord v)
! {   return ((v >> (h->g2o_fraction_bits - _fixed_shift - 1)) + 1) >> 1;
  }
  
--- 280,287 ----
  
  private inline fixed o2d(const t1_hinter *h, t1_hinter_space_coord v)
! {
!     return ((h->g2o_fraction_bits > _fixed_shift) ?
! 	((v >> (h->g2o_fraction_bits - _fixed_shift - 1)) + 1) >> 1 :
! 	((v << (_fixed_shift - h->g2o_fraction_bits + 1)) + 1) >> 1);
  }
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.