[comp.sys.ibm.pc.rt] Fix for text bug on X11 megapel

jfc@athena.mit.edu (John F Carr) (11/09/89)

There is a bug in the X11R3 megapel server that causes text near the bottom
edge of the screen not to be displayed.  This is because the megapel rounds
font sizes up to multiples of 4 pixels internally; the current server does
not detect the case where the character as displayed by the megapel extends
beyond the screen edge but the X character does not.  Here is a patch:

*** /mit/x11/src/server/ddx/ibm/mpel/mpelText.c	Tue Jul 25 20:25:04 1989
--- mpelText.c	Wed Nov  8 06:01:19 1989
***************
*** 229,234 ****
--- 229,235 ----
      char		 wholeStr[MAX_CHARS_PER_CALL] ;
      char		 partStr[MAX_CHARS_PER_CALL] ;
      CARD16		*charsOut ;
+     int			bot_edge;	/* Does bottom edge of screen clip ? */
  
      TRACE(("mpelImageText( 0x%x, 0x%x, (%d,%d), %d, 0x%x)\n", pDraw, pGC, x, y, count, chars,fontEncoding)) ;
  
***************
*** 311,322 ****
  
      ht = ( ( ( fontHeight( xFont ) + 3 ) / 4 ) * 4 ) - fontHeight( xFont ) ;
      wholeTxt.point.x =	x ;
!     wholeTxt.point.y =	MPEL_HEIGHT - y - font->pFI->fontDescent - ht ;
      wholeTxt.reserved =	0 ;
      wholeTxt.length =	n ;
      wholeTxt.string =	wholeStr ;
  
      setFontDimensions( xFont ) ;
  
      for ( i = 0 ; ( i < nbox ) && !allIn ; i++, pbox++ ) {
  	switch ( mpelRectIntersect( pbox, &bbox ) ) {
--- 312,330 ----
  
      ht = ( ( ( fontHeight( xFont ) + 3 ) / 4 ) * 4 ) - fontHeight( xFont ) ;
      wholeTxt.point.x =	x ;
!     bot_edge = ((wholeTxt.point.y = MPEL_HEIGHT - y - font->pFI->fontDescent - ht) < 0);
      wholeTxt.reserved =	0 ;
      wholeTxt.length =	n ;
      wholeTxt.string =	wholeStr ;
  
      setFontDimensions( xFont ) ;
+ 
+     if(bot_edge)
+       {
+ 	TRACE(("Bottom edge effects in mpelImageText (ht = %d).\n", ht));
+ 	backrect.height += ht;
+ 	bbox.y2 += ht;
+       }
  
      for ( i = 0 ; ( i < nbox ) && !allIn ; i++, pbox++ ) {
  	switch ( mpelRectIntersect( pbox, &bbox ) ) {


    --John Carr (jfc@athena.mit.edu)