FLTK 1.3.0
Xutf8.h
00001 /* "$Id$"
00002  *
00003  * Author: Jean-Marc Lienher ( http://oksid.ch )
00004  * Copyright 2000-2010 by O'ksi'D.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00019  * USA.
00020  *
00021  * Please report all bugs and problems on the following page:
00022  *
00023  *     http://www.fltk.org/str.php
00024  */
00025 
00026 #ifndef _Xutf8_h
00027 #define _Xutf8_h
00028 
00029 #  ifdef __cplusplus
00030 extern "C" {
00031 #  endif
00032 
00033 #include <X11/X.h>
00034 #include <X11/Xlib.h>
00035 #include <X11/Xlocale.h>
00036 #include <X11/Xutil.h>
00037 
00038 typedef struct {
00039         int nb_font;
00040         char **font_name_list;
00041         int *encodings;
00042         XFontStruct **fonts;
00043         Font fid;
00044         int ascent;
00045         int descent;
00046         int *ranges;
00047 } XUtf8FontStruct;
00048 
00049 XUtf8FontStruct *
00050 XCreateUtf8FontStruct (
00051         Display         *dpy,
00052         const char      *base_font_name_list);
00053 
00054 void
00055 XUtf8DrawString(
00056         Display                 *display,
00057         Drawable                d,
00058         XUtf8FontStruct  *font_set,
00059         GC                      gc,
00060         int                     x,
00061         int                     y,
00062         const char              *string,
00063         int                     num_bytes);
00064 
00065 void
00066 XUtf8_measure_extents(
00067         Display                 *display,
00068         Drawable                d,
00069         XUtf8FontStruct  *font_set,
00070         GC                      gc,
00071         int                     *xx,
00072         int                     *yy,
00073         int                     *ww,
00074         int                     *hh,
00075         const char              *string,
00076         int                     num_bytes);
00077 
00078 void
00079 XUtf8DrawRtlString(
00080         Display                 *display,
00081         Drawable                d,
00082         XUtf8FontStruct  *font_set,
00083         GC                      gc,
00084         int                     x,
00085         int                     y,
00086         const char              *string,
00087         int                     num_bytes);
00088 
00089 void
00090 XUtf8DrawImageString(
00091         Display         *display,
00092         Drawable        d,
00093         XUtf8FontStruct         *font_set,
00094         GC              gc,
00095         int             x,
00096         int             y,
00097         const char      *string,
00098         int             num_bytes);
00099 
00100 int
00101 XUtf8TextWidth(
00102         XUtf8FontStruct  *font_set,
00103         const char              *string,
00104         int                     num_bytes);
00105 int
00106 XUtf8UcsWidth(
00107         XUtf8FontStruct  *font_set,
00108         unsigned int            ucs);
00109 
00110 int
00111 XGetUtf8FontAndGlyph(
00112         XUtf8FontStruct  *font_set,
00113         unsigned int            ucs,
00114         XFontStruct     **fnt,
00115         unsigned short  *id);
00116 
00117 void
00118 XFreeUtf8FontStruct(
00119         Display                 *dpy,
00120         XUtf8FontStruct         *font_set);
00121 
00122 
00123 int
00124 XConvertUtf8ToUcs(
00125         const unsigned char     *buf,
00126         int                     len,
00127         unsigned int            *ucs);
00128 
00129 int
00130 XConvertUcsToUtf8(
00131         unsigned int            ucs,
00132         char                    *buf);
00133 
00134 int
00135 XUtf8CharByteLen(
00136         const unsigned char     *buf,
00137         int                     len);
00138 
00139 int
00140 XCountUtf8Char(
00141         const unsigned char *buf,
00142         int len);
00143 
00144 int
00145 XFastConvertUtf8ToUcs(
00146         const unsigned char     *buf,
00147         int                     len,
00148         unsigned int            *ucs);
00149 
00150 long
00151 XKeysymToUcs(
00152         KeySym  keysym);
00153 
00154 int
00155 XUtf8LookupString(
00156     XIC                 ic,
00157     XKeyPressedEvent*   event,
00158     char*               buffer_return,
00159     int                 bytes_buffer,
00160     KeySym*             keysym,
00161     Status*             status_return);
00162 
00163 unsigned short
00164 XUtf8IsNonSpacing(
00165         unsigned int ucs);
00166 
00167 unsigned short
00168 XUtf8IsRightToLeft(
00169         unsigned int ucs);
00170 
00171 
00172 int
00173 XUtf8Tolower(
00174         int ucs);
00175 
00176 int
00177 XUtf8Toupper(
00178         int ucs);
00179 
00180 
00181 #  ifdef __cplusplus
00182 }
00183 #  endif
00184 
00185 #endif
00186 
00187 /*
00188  *  End of "$Id$".
00189  */