Simplify redisplay-x/separate_textual_runs

Aidan Kehoe kehoea at parhasard.net
Fri Mar 30 11:14:47 EDT 2007


 Ar an triochadú lá de mí Márta, scríobh Olivier Galibert: 

 > +#if defined(USE_XFT) && defined(MULE)
 >  static int
 > -separate_textual_runs (unsigned char *text_storage,
 > -		       struct textual_run *run_storage,
 > -		       const Ichar *str, Charcount len,
 > -		       struct face_cachel *cachel)
 > +separate_textual_runs_xft_mule (unsigned char *text_storage,
 > +				struct textual_run *run_storage,
 > +				const Ichar *str, Charcount len,
 > +				struct face_cachel *cachel)
 > +{
 > +  Lisp_Object prev_charset = Qnil;
 > +  int runs_so_far = 0, i;
 > +
 > +  run_storage[0].ptr = text_storage;
 > +  run_storage[0].len = len;
 > +  run_storage[0].dimension = 2;
 > +  run_storage[0].charset = Qnil;
 > +
 > +  for (i = 0; i < len; i++)
 > +    {
 > +      Ichar ch = str[i];      
 > +      Lisp_Object charset = ichar_charset(ch);
 > +      int ucs = ichar_to_unicode(ch);
 > +
 > +      /* If UCS is less than zero or greater than 0xFFFF, set ucs2 to
 > +	 REPLACMENT CHARACTER. */
 > +      /* That means we can't handle characters outside of the BMP for now */
 > +      ucs = (ucs & ~0xFFFF) ? 0xFFFD : ucs;

You’ve just done that Unicode conversion to throw away the result. That’s
not very constructive, since the XFT redisplay routines *require* that the
supplied strings are Unicode. I’m fighting with Cygwin right now to get it
to usefully install fontconfig so I can check this out for certain, but I
believe strongly that this will break redisplay with non-Latin-1 characters
under XFT and Mule.

 > +      if (prev_charset != charset)
 > +	{
 > +	  if (runs_so_far)
 > +	    run_storage[runs_so_far-1].len = (text_storage - run_storage[runs_so_far-1].ptr) >> 1;
 > +	  run_storage[runs_so_far].ptr = text_storage;
 > +	  run_storage[runs_so_far].dimension = 2;
 > +	  run_storage[runs_so_far].charset = charset;
 > +	  prev_charset = charset;
 > +	  runs_so_far++;
 > +	}
 > +
 > +      *(XftChar16 *)text_storage = str[i];
 > +      text_storage += sizeof(XftChar16);
 > +    }
 > +
 > +  if (runs_so_far)
 > +    run_storage[runs_so_far-1].len = (text_storage - run_storage[runs_so_far-1].ptr) >> 1;
 > +  return runs_so_far;
 > +}
 > +#endif

-- 
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)



More information about the XEmacs-Patches mailing list