FLTK 1.3.x

Xutf8.h

00001 /* "$Id: Xutf8.h 7904 2010-11-28 21:12:59Z matt $"
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 XUtf8DrawRtlString(
00067         Display                 *display,
00068         Drawable                d,
00069         XUtf8FontStruct  *font_set,
00070         GC                      gc,
00071         int                     x,
00072         int                     y,
00073         const char              *string,
00074         int                     num_bytes);
00075 
00076 void
00077 XUtf8DrawImageString(
00078         Display         *display,
00079         Drawable        d,
00080         XUtf8FontStruct         *font_set,
00081         GC              gc,
00082         int             x,
00083         int             y,
00084         const char      *string,
00085         int             num_bytes);
00086 
00087 int
00088 XUtf8TextWidth(
00089         XUtf8FontStruct  *font_set,
00090         const char              *string,
00091         int                     num_bytes);
00092 int 
00093 XUtf8UcsWidth(
00094         XUtf8FontStruct  *font_set,
00095         unsigned int            ucs);
00096 
00097 int
00098 XGetUtf8FontAndGlyph(
00099         XUtf8FontStruct  *font_set,
00100         unsigned int            ucs,
00101         XFontStruct     **fnt,
00102         unsigned short  *id);
00103         
00104 void
00105 XFreeUtf8FontStruct(
00106         Display                 *dpy,
00107         XUtf8FontStruct         *font_set);
00108 
00109 
00110 int 
00111 XConvertUtf8ToUcs( 
00112         const unsigned char     *buf, 
00113         int                     len, 
00114         unsigned int            *ucs);
00115 
00116 int 
00117 XConvertUcsToUtf8(
00118         unsigned int            ucs, 
00119         char                    *buf);
00120 
00121 int 
00122 XUtf8CharByteLen(
00123         const unsigned char     *buf, 
00124         int                     len);
00125 
00126 int 
00127 XCountUtf8Char(
00128         const unsigned char *buf, 
00129         int len);
00130 
00131 int 
00132 XFastConvertUtf8ToUcs( 
00133         const unsigned char     *buf, 
00134         int                     len, 
00135         unsigned int            *ucs);
00136 
00137 long 
00138 XKeysymToUcs(
00139         KeySym  keysym);
00140 
00141 int
00142 XUtf8LookupString(
00143     XIC                 ic,
00144     XKeyPressedEvent*   event,
00145     char*               buffer_return,
00146     int                 bytes_buffer,
00147     KeySym*             keysym,
00148     Status*             status_return);
00149 
00150 unsigned short 
00151 XUtf8IsNonSpacing(
00152         unsigned int ucs);
00153 
00154 unsigned short
00155 XUtf8IsRightToLeft(
00156         unsigned int ucs);
00157 
00158 
00159 int 
00160 XUtf8Tolower(
00161         int ucs);
00162 
00163 int 
00164 XUtf8Toupper(
00165         int ucs);
00166 
00167 
00168 #  ifdef __cplusplus
00169 }
00170 #  endif
00171 
00172 #endif
00173 
00174 /*
00175  *  End of "$Id: Xutf8.h 7904 2010-11-28 21:12:59Z matt $".
00176  */