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

(mgp-users 00615) Re:



From: Christopher Drexler <drexler@informatik.uni-erlangen.de>
Subject: (mgp-users 00610) Re: 
Date: Fri, 15 Jun 2001 15:19:53 +0900
Message-ID: <>

>> Isn't this problem related to the way mgp handles characters belonging to
>> words and characters treated as 'breakable before this char'? How exactly
>> does the line breaking algorithm work? I couldn't find it in the source
>> because I'm not very familiar with all this font handling stuff.

Line break processing is done in draw_string() and draw_fragment().
It contains adhoc solutions. So it may be complicated and messy.

I think the following patch will solve your problem.

Cheers,
--
Yoshifumi Nishida <nishida@csl.sony.co.jp>
Sony Computer Science Laboratories, Inc.



*** draw.c.orig	Fri May 25 21:03:57 2001
--- draw.c	Fri May 25 21:01:37 2001
***************
*** 1128,1134 ****
  	char *registry;
  	int charset16;	/*2-octet charset?*/
  {
! 	u_int char_len;
  	u_short code;
  	struct render_object *tail;
  	struct render_object *thisline;
--- 1128,1134 ----
  	char *registry;
  	int charset16;	/*2-octet charset?*/
  {
! 	u_int char_len, i;
  	u_short code;
  	struct render_object *tail;
  	struct render_object *thisline;
***************
*** 1286,1295 ****
  
  		state->linewidth += HORIZ_STEP(char_size[caching], char_len);
  		/* ukai */
! 		if (!charset16 && 
! 			state->linewidth + HORIZ_STEP(char_size[caching], char_len)
! 		    	> state->width)
! 		    break;
  	}
  
  	if (state->width - state->leftfillpos / 2 < state->linewidth
--- 1286,1299 ----
  
  		state->linewidth += HORIZ_STEP(char_size[caching], char_len);
  		/* ukai */
! 		if (!charset16 && state->linewidth + HORIZ_STEP(char_size[caching], 
! 				char_len) > state->width) {
! 			if (len >= 20) break; /* too long word */
! 			for (i = 0; i < len; i ++){
! 				if (isspace(*(p +i))) break;	
! 			}
! 			if (i == len) break;
! 		}
  	}
  
  	if (state->width - state->leftfillpos / 2 < state->linewidth