/[dotgnu-pnet]/pnetlib/Xsharp/XsharpSupport.c
ViewVC logotype

Diff of /pnetlib/Xsharp/XsharpSupport.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.32 by t3rmin4t0r, Wed Dec 8 16:14:22 2004 UTC revision 1.33 by darkdust, Fri Sep 9 13:04:17 2005 UTC
# Line 512  void XSharpDrawStringXft(Display *dpy, D Line 512  void XSharpDrawStringXft(Display *dpy, D
512                                                   DefaultColormap(dpy, DefaultScreen(dpy)));                                                   DefaultColormap(dpy, DefaultScreen(dpy)));
513          if(draw)          if(draw)
514          {          {
 #ifdef HAVE_MBSTOWCS  
                 size_t len;  
 #endif /* HAVE_MBSTOWCS */  
                   
515                  if(clipRegion)                  if(clipRegion)
516                  {                  {
517                          XftDrawSetClip(draw, clipRegion);                          XftDrawSetClip(draw, clipRegion);
518                  }                  }
519    
520  #ifdef HAVE_MBSTOWCS                  XftDrawStringUtf8(draw, &color, (XftFont *)fontSet,
521                  /* Can the string be converted into wide chars (Unicode) ? */                          x, y, (XftChar8 *)str, strlen(str));
                 len = mbstowcs (NULL, str, 0);  
                 if (len != -1)  
                 {  
                         /* Yes, convert to to Unicode and draw */  
                         wchar_t wstr[len + 1];  
                         mbstowcs (wstr, str, len);  
                         XftDrawString32(draw, &color, (XftFont *)fontSet,  
                                 x, y, (XftChar32 *)wstr, len);  
                 }  
                 else  
                 {  
 #endif /* HAVE_MBSTOWCS */  
   
                         /* No, draw plain ASCII */  
                         XftDrawString8(draw, &color, (XftFont *)fontSet,  
                                 x, y, (XftChar8 *)str, strlen(str));  
   
 #ifdef HAVE_MBSTOWCS  
                 }  
 #endif /* HAVE_MBSTOWCS */  
522                                    
523                  XftDrawDestroy(draw);                  XftDrawDestroy(draw);
524          }          }
# Line 762  void XSharpTextExtentsXft(Display *dpy, Line 738  void XSharpTextExtentsXft(Display *dpy,
738    
739          XGlyphInfo extents;          XGlyphInfo extents;
740                    
741  #ifdef HAVE_MBSTOWCS          XftTextExtentsUtf8(dpy, fontSet, (XftChar8 *)str, strlen(str), &extents);
         size_t len;  
   
         /* Can the string be converted into wide chars (Unicode) ? */  
         len = mbstowcs (NULL, str, 0);  
         if (len != -1)  
         {  
                 /* Yes, convert to to Unicode and measure */  
                 wchar_t wstr[len + 1];  
                 mbstowcs (wstr, str, len);  
                 XftTextExtents32(dpy, fontSet, (XftChar32 *)wstr, len, &extents);  
         }  
         else  
         {  
 #endif /* HAVE_MBSTOWCS */  
   
                 /* No, measure plain ASCII */  
                 XftTextExtents8(dpy, fontSet, (XftChar8 *)str, strlen(str), &extents);  
   
 #ifdef HAVE_MBSTOWCS  
         }  
 #endif /* HAVE_MBSTOWCS */  
   
742    
743          overall_ink_return->x = -(extents.x);          overall_ink_return->x = -(extents.x);
744          overall_ink_return->y = -(extents.y);          overall_ink_return->y = -(extents.y);

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26