[comp.windows.x] V10R4 bug in libqvss

edmoy%opal.Berkeley.EDU@UCBVAX.BERKELEY.EDU.UUCP (02/06/87)

In compiling the X server for the qvss, I discovered a problem with ddxfont.c.
It has been modified since R3 and now the widths table for non-constant width
fonts is incorrect (each position is offset by the amount firstchar).  Below
is my bug fix.  Unfortunately, I haven't test the fix as I can't compile
ddxfont.c because the distribution does not have the include file param.h.
Does anyone have this and can send it to me?

Edward Moy
Academic Computing Services
University of California
Berkeley, CA  94720

edmoy@opal.Berkeley.EDU
ucbvax!opal!edmoy

--------- cut ------------------------------ cut ------------------------
*** ddxfont.c.old	Thu Feb  4 11:56:14 1987
--- ddxfont.c	Thu Feb  5 13:49:32 1987
***************
*** 140,146
  	fpriv->maxwidth = 0;
  
  	/* convert the leftarray to the width table */
! 	for (i = fd->first; i <= fd->last; i++) {
  	    width = fpriv->leftarray[i + 1] - fpriv->leftarray[i];
  	    if (width > fpriv->maxwidth) fpriv->maxwidth = width;
  	    if (width < 0) {

--- 140,146 -----
  	fpriv->maxwidth = 0;
  
  	/* convert the leftarray to the width table */
! 	for (i = 0, j = fd->last - fd->first + 1; j > 0; i++, j--) {
  	    width = fpriv->leftarray[i + 1] - fpriv->leftarray[i];
  	    if (width > fpriv->maxwidth) fpriv->maxwidth = width;
  	    if (width < 0) {
***************
*** 147,153
  		width = 0;	/* font sanity check */
  		DeviceError ("Bad font leftarray!\n");
  		}
! 	    fpriv->widths[i - fd->first] = width;
  	}
  		
          fd->avg_width = ((fpriv->leftarray[fd->last + 1]  - 

--- 147,153 -----
  		width = 0;	/* font sanity check */
  		DeviceError ("Bad font leftarray!\n");
  		}
! 	    fpriv->widths[i] = width;
  	}
  		
          fd->avg_width = ((fpriv->leftarray[fd->last + 1]  - 

swick@ATHENA.MIT.EDU.UUCP (02/07/87)

Ed, I believe you're offsetting once too often.  The fix we've tested here
is just:

% diff ddxfont.{old,c}
150c150
<           fpriv->widths[i - fd->first] = width;
---
>           fpriv->widths[i] = width;


Not sure why param.h was left out of the distribution, but I'll check into it.

-Ralph