[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mgp-users 1489] Re: Magicpoint loops forever rendering single word longer than line



Hello Julian,

 > From: "Julian Stacey" <jhs@berklix.org>
 > Subject: [mgp-users 0] Magicpoint loops forever rendering single word longer than line
 > Date: Mon, 21 May 2007 18:07:22 +0200 (CEST)
 > Message-ID: <200705211607.l4LG7M5J081695@fire.jhs.private>
 > 
 >  > Hi Magicpoint users,
 >  > The following applies to both mgp version 1.11b (20040925)
 >  > on FreeBSD-6.1 & also mgp 12 on FreeBSD-6.2
 >  > 
 >  > A couple of bugs/ features/ problems I've noticed:
 >  > 	- All filters I suspect get called at beginning.
 >  > 	- If a single long word longer than page width (eg a URL),
 >  > 	  it loops forever rendering.	(cludge solution: reduce %size)

Please try the following patch.

Thanks,
--
Yoshifumi Nishida
nishida@csl.sony.co.jp



diff -c -r1.233 draw.c
*** draw.c	21 May 2007 10:15:19 -0000	1.233
--- draw.c	30 May 2007 17:31:33 -0000
***************
*** 5215,5226 ****
  		if (isspace(*(p + len -1))) {
  		    XftTextExtents8(display, xft_font, (XftChar8 *)p, len -1, &extents);
  			if (state->width - state->leftfillpos / 2 - state->linewidth >= extents.xOff) goto nofolding;
  		}
  
! 		draw_line_end(state); 
! 	 	draw_line_start(state);
! 		state->linewidth = state->leftfillpos;
! 		return p;
  	}
  
  nofolding:
--- 5215,5242 ----
  		if (isspace(*(p + len -1))) {
  		    XftTextExtents8(display, xft_font, (XftChar8 *)p, len -1, &extents);
  			if (state->width - state->leftfillpos / 2 - state->linewidth >= extents.xOff) goto nofolding;
+ 			draw_line_end(state); 
+ 		 	draw_line_start(state);
+ 			state->linewidth = state->leftfillpos;
+ 			return p;
  		}
  
! 		for (i = 2; i < len; i ++){
! 			XftTextExtents8(display, xft_font, (XftChar8 *)p, len -i, &extents);
! 			if (state->width - state->leftfillpos / 2 - state->linewidth >= extents.xOff){
! 				len -= i;
! 				break;
! 			}
! 		}
! 		draw_line_itemsize(state, xft_font->ascent, xft_font->descent, 0);
! 		if (obj_new_xftfont(state, state->linewidth, state->charoff, p, len, fontname,
! 	   		registry, char_size[caching], charset16, xft_font)) {
! 			draw_line_end(state); 
! 		 	draw_line_start(state);
! 			state->linewidth = state->leftfillpos;
! 			return p +len;
! 		} else 
! 			return NULL;
  	}
  
  nofolding: