Ignore:
Timestamp:
Dec 17, 2009, 2:46:22 AM (13 years ago)
Author:
Sam Hocevar
Message:

Allow the X11 driver to display Unicode characters if they are in the
current font (addresses #21).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver/x11.c

    r4069 r4140  
    6565    int cursor_flags;
    6666    int dirty_cursor_x, dirty_cursor_y;
    67 #if defined(X_HAVE_UTF8_STRING)
     67#if defined X_HAVE_UTF8_STRING
    6868    XIM im;
    6969    XIC ic;
     
    511511            continue;
    512512
    513 #if defined(X_HAVE_UTF8_STRING)
     513#if defined X_HAVE_UTF8_STRING
    514514        if(Xutf8LookupString(dp->drv.p->ic, &xevent.xkey, ev->data.key.utf8, 8, NULL, NULL))
    515515        {
     
    666666    Pixmap px = dp->drv.p->pixmap;
    667667    GC gc = dp->drv.p->gc;
     668    XChar2b ch16;
    668669    int fw;
    669     XChar2b ch16;
    670670
    671671    /* Underline */
     
    822822    }
    823823
     824#if defined X_HAVE_UTF8_STRING
     825    if(ch >= 0x00000020)
     826#else
    824827    if(ch >= 0x00000020 && ch <= dp->drv.p->max_char)
    825     {
    826         /* ascii, latin-1 or unicode font (might draw a blank square) */
    827         ch16.byte1 = (ch) >> 8;
    828         ch16.byte2 = (ch) & 0xff;
     828#endif
     829    {
     830        ch16.byte1 = (uint8_t)(ch >> 8);
     831        ch16.byte2 = (uint8_t)ch;
    829832    }
    830833    else
     
    834837    }
    835838
    836     XDrawString16(dpy, px, gc, x + (ch16.byte1 ? 0 : (fw - w) / 2), yoff, &ch16, 1);
     839    XDrawString16(dpy, px, gc,
     840                  x + (ch16.byte1 ? 0 : (fw - w) / 2), yoff, &ch16, 1);
    837841}
    838842
Note: See TracChangeset for help on using the changeset viewer.