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

Re: Re: (3) Arabic vim patch (was - BAD BUG)



Steve Hall wrote:

> > > Nope, doesn't work for me, this patch actually causes the Arabic
> > > patch to fail. Nadim has updated (1.12) to sync with 6.1.350 and
> > > all is fine without it.
>  
>   [snip]
> 
> > Try this change on top of the previous one:
> 
>   [patch]
> 
> > Note that this is not a real patch, just an attempt to find out what
> > is going on.  I begin to suspect that ETO_PDY doesn't work with
> > composing characters.
> 
> Bram, would it still help you for me to try this patch, despite Tony's
> issue having been solved by the latest binary? Be glad to create it,
> just say the word.

Yes, I would still like to find out what the actual problem is.  Patch
6.1.334 fixes the problem for Win98 at least, but might still leave a
problem for NT/2000/XP.  On those platforms the check for 'rightleft'
might help.

It's probably best to completely remove ETO_PDY until we find out what
problems it causes.

I just found some docs for ETO_PDY.  Apparently it specifies that the
padding argument contains two ints per cell instead of one, and it's
only supported for Win 2000/XP.  That explains why it failed on Win98.
But it also means we can use the padding without adding the ETO_PDY
flag.  Try the patch below (relative to 6.1.351).  One thing that I
noticed it will fix: when your font is missing some characters, the
rectangle that replaces it will now be positioned correctly!

*** ../vim61.351/src/gui_w32.c	Thu Feb 20 21:29:10 2003
--- src/gui_w32.c	Fri Feb 21 23:03:17 2003
***************
*** 270,278 ****
  #ifndef ETO_IGNORELANGUAGE
  # define ETO_IGNORELANGUAGE  0x1000
  #endif
- #ifndef ETO_PDY
- # define ETO_PDY             0x2000
- #endif
  
  /*
   * Return TRUE when running under Windows NT 3.x or Win32s, both of which have
--- 270,275 ----
***************
*** 1759,1769 ****
  	vim_free(unicodebuf);
  	unicodebuf = (WCHAR *)alloc(len * sizeof(WCHAR));
  
! 	if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT)
! 	{
! 	    vim_free(unicodepdy);
! 	    unicodepdy = (int *)alloc(len * sizeof(int) * 2);
! 	}
  
  	unibuflen = len;
      }
--- 1756,1763 ----
  	vim_free(unicodebuf);
  	unicodebuf = (WCHAR *)alloc(len * sizeof(WCHAR));
  
! 	vim_free(unicodepdy);
! 	unicodepdy = (int *)alloc(len * sizeof(int));
  
  	unibuflen = len;
      }
***************
*** 1778,1787 ****
  	int		cw;	/* width of current cell */
  
  	cells = 0;
- 	/* Add ETO_PDY to make characters fit as we expect, even when the font
- 	 * uses different widths (e.g., bold character is wider). */
- 	if (unicodepdy != NULL)
- 	    foptions |= ETO_PDY;
  	for (clen = 0; i < len; )
  	{
  	    unicodebuf[clen] = utf_ptr2char(text + i);
--- 1772,1777 ----
***************
*** 1790,1797 ****
  		cw = 1;
  	    if (unicodepdy != NULL)
  	    {
! 		unicodepdy[clen * 2] = cw * gui.char_width;
! 		unicodepdy[clen * 2 + 1] = 0;
  	    }
  	    cells += cw;
  	    i += utfc_ptr2len_check_len(text + i, len - i);
--- 1780,1789 ----
  		cw = 1;
  	    if (unicodepdy != NULL)
  	    {
! 		/* Use unicodepdy to make characters fit as we expect, even
! 		 * when the font uses different widths (e.g., bold character
! 		 * is wider).  */
! 		unicodepdy[clen] = cw * gui.char_width;
  	    }
  	    cells += cw;
  	    i += utfc_ptr2len_check_len(text + i, len - i);

-- 
GUARD #2:  It could be carried by an African swallow!
GUARD #1:  Oh, yeah, an African swallow maybe, but not a European swallow,
           that's my point.
GUARD #2:  Oh, yeah, I agree with that...
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- Bram at Moolenaar dot net -- http://www.Moolenaar.net   \\\
///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///