A fix for the Bug 687156 "some characters shifted higher in acrobat4 generated eps".

"Igor V. Melichev" <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
Fix (type 1 hinter) : sbw was wrongly accounted with FontBBox over 4095
units.

DETAILS :

Side bearing and width was accounted before import_shift is adjusted to
FontBBox.
Bug 687156 "some characters shifted higher in acrobat4 generated eps".

This patch fixes the problem when the font has a valid FontBBox.
If FontBBox is zero (it is allowed due to PLRM),
a fixed overflow still can happen in the hinter.
We have no real examples, but another bug 687175 is opened for that.

EXPECTED DIFFERENCES :

None with comparefiles.

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
patch.txt (text/plain, 5.4 KB)
[Log message beg]
Fix (type 1 hinter) : sbw was wrongly accounted with FontBBox over 4095 units.

DETAILS :

Side bearing and width was accounted before import_shift is adjusted to FontBBox.
Bug 687156 "some characters shifted higher in acrobat4 generated eps".

This patch fixes the problem when the font has a valid FontBBox.
If FontBBox is zero (it is allowed due to PLRM),
a fixed overflow still can happen in the hinter.
We have no real examples, but another bug 687175 is opened for that.

EXPECTED DIFFERENCES :

None with comparefiles.
[Log message end]


Changes: 
 
 
 
*** f:\casper\HEAD\gs\src\gstype1.c	Tue Oct 21 05:43:28 2003
--- files\gs\src\gstype1.c	Mon Dec  1 15:26:21 2003
***************
*** 83,92 ****
      switch (pcis->init_done) {
  	case -1:
! 	    t1_hinter__init(h, pcis->path);
  	    break;
  	case 0:
  	    gs_type1_finish_init(pcis);	/* sets origin */
  	    ftx = pcis->origin.x, fty = pcis->origin.y;
!             code = t1_hinter__set_mapping(h, &pcis->pis->ctm, &pfont->FontBBox, 
  			    &pfont->FontMatrix, &pfont->base->FontMatrix,
  			    pcis->scale.x.log2_unit, pcis->scale.x.log2_unit,
--- 83,92 ----
      switch (pcis->init_done) {
  	case -1:
! 	    t1_hinter__init(h, pcis->path, &pfont->FontBBox);
  	    break;
  	case 0:
  	    gs_type1_finish_init(pcis);	/* sets origin */
  	    ftx = pcis->origin.x, fty = pcis->origin.y;
!             code = t1_hinter__set_mapping(h, &pcis->pis->ctm, 
  			    &pfont->FontMatrix, &pfont->base->FontMatrix,
  			    pcis->scale.x.log2_unit, pcis->scale.x.log2_unit,
 
 
 
*** f:\casper\HEAD\gs\src\gstype2.c	Tue Oct 21 05:43:28 2003
--- files\gs\src\gstype2.c	Mon Dec  1 15:26:34 2003
***************
*** 138,146 ****
      switch (pcis->init_done) {
  	case -1:
! 	    t1_hinter__init(h, pcis->path);
  	    break;
  	case 0:
  	    gs_type1_finish_init(pcis);	/* sets origin */
!             code = t1_hinter__set_mapping(h, &pcis->pis->ctm, &pfont->FontBBox, 
  			    &pfont->FontMatrix, &pfont->base->FontMatrix,
  			    pcis->scale.x.log2_unit, pcis->scale.x.log2_unit,
--- 138,146 ----
      switch (pcis->init_done) {
  	case -1:
! 	    t1_hinter__init(h, pcis->path, &pfont->FontBBox);
  	    break;
  	case 0:
  	    gs_type1_finish_init(pcis);	/* sets origin */
!             code = t1_hinter__set_mapping(h, &pcis->pis->ctm, 
  			    &pfont->FontMatrix, &pfont->base->FontMatrix,
  			    pcis->scale.x.log2_unit, pcis->scale.x.log2_unit,
 
 
 
*** f:\casper\HEAD\gs\src\gxhintn.c	Mon Nov 10 19:55:00 2003
--- files\gs\src\gxhintn.c	Mon Dec  1 15:26:55 2003
***************
*** 458,463 ****
  /* --------------------- t1_hinter class members - import --------------------*/
  
! void t1_hinter__init(t1_hinter * this, gx_path *output_path)
! {   this->stem_snap_count[0] = this->stem_snap_count[1] = 0;
      this->zone_count = 0;
      this->pole_count = 0;
--- 458,469 ----
  /* --------------------- t1_hinter class members - import --------------------*/
  
! void t1_hinter__init(t1_hinter * this, gx_path *output_path, gs_rect * FontBBox)
! {   double size = Maxd(Maxd(fabs(FontBBox->p.x), fabs(FontBBox->p.y)), 
!                        Maxd(fabs(FontBBox->q.x), fabs(FontBBox->q.y)));
! 
!     this->import_shift = 0;
!     while (size >= (1 << split_bits))
! 	++this->import_shift, size = shift_rounded((int)ceil(size), 1);
!     this->stem_snap_count[0] = this->stem_snap_count[1] = 0;
      this->zone_count = 0;
      this->pole_count = 0;
***************
*** 496,500 ****
      this->charpath_flag = false;
      this->grid_fit_x = this->grid_fit_y = true;
-     this->import_shift = 0;
      this->output_path = output_path;
      this->memory = (output_path == 0 ? 0 : output_path->memory);
--- 502,505 ----
***************
*** 565,569 ****
  }
  
! int t1_hinter__set_mapping(t1_hinter * this, gs_matrix_fixed * ctm, gs_rect * FontBBox, 
  		    gs_matrix * FontMatrix, gs_matrix * baseFontMatrix,
  		    int log2_pixels_x, int log2_pixels_y,
--- 570,574 ----
  }
  
! int t1_hinter__set_mapping(t1_hinter * this, gs_matrix_fixed * ctm,
  		    gs_matrix * FontMatrix, gs_matrix * baseFontMatrix,
  		    int log2_pixels_x, int log2_pixels_y,
***************
*** 573,585 ****
      float ayx = fabs(ctm->xx), ayy = fabs(ctm->xy);
      float scale = max(axx + axy, ayx + ayy);
-     double size = Maxd(Maxd(fabs(FontBBox->p.x), fabs(FontBBox->p.y)), 
-                        Maxd(fabs(FontBBox->q.x), fabs(FontBBox->q.y)));
      double_matrix CTM;
      int code;
  
-     while (size >= (1 << split_bits))
- 	++this->import_shift, size = shift_rounded((int)ceil(size), 1);
-     if (size == 0)
- 	size = 1024 * fixed_scale; /* Hack for fonts with no bbox. */
      if (scale == 0)
  	return_error(gs_error_invalidfont);
--- 578,584 ----
 
 
 
*** f:\casper\HEAD\gs\src\gxhintn.h	Tue Oct 21 05:43:28 2003
--- files\gs\src\gxhintn.h	Mon Dec  1 15:26:06 2003
***************
*** 156,161 ****
  } t1_hinter;
  
! void t1_hinter__init(t1_hinter * this, gx_path *output_path);
! int  t1_hinter__set_mapping(t1_hinter * this, gs_matrix_fixed * ctm, gs_rect * FontBBox, 
  			gs_matrix * FontMatrix, gs_matrix * baseFontMatrix,
  			int log2_pixels_x, int log2_pixels_y,
--- 156,161 ----
  } t1_hinter;
  
! void t1_hinter__init(t1_hinter * this, gx_path *output_path, gs_rect * FontBBox);
! int  t1_hinter__set_mapping(t1_hinter * this, gs_matrix_fixed * ctm,
  			gs_matrix * FontMatrix, gs_matrix * baseFontMatrix,
  			int log2_pixels_x, int log2_pixels_y,
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.