DRC | 2ff39b8 | 2011-07-28 08:38:59 +0000 | [diff] [blame] | 1 | /* "$Id: Xutf8.h 8399 2011-02-07 22:22:16Z ianmacarthur $" |
| 2 | * |
| 3 | * Author: Jean-Marc Lienher ( http://oksid.ch ) |
| 4 | * Copyright 2000-2010 by O'ksi'D. |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Library General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Library General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Library General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 19 | * USA. |
| 20 | * |
| 21 | * Please report all bugs and problems on the following page: |
| 22 | * |
| 23 | * http://www.fltk.org/str.php |
| 24 | */ |
| 25 | |
| 26 | #ifndef _Xutf8_h |
| 27 | #define _Xutf8_h |
| 28 | |
| 29 | # ifdef __cplusplus |
| 30 | extern "C" { |
| 31 | # endif |
| 32 | |
| 33 | #include <X11/X.h> |
| 34 | #include <X11/Xlib.h> |
| 35 | #include <X11/Xlocale.h> |
| 36 | #include <X11/Xutil.h> |
| 37 | |
| 38 | typedef struct { |
| 39 | int nb_font; |
| 40 | char **font_name_list; |
| 41 | int *encodings; |
| 42 | XFontStruct **fonts; |
| 43 | Font fid; |
| 44 | int ascent; |
| 45 | int descent; |
| 46 | int *ranges; |
| 47 | } XUtf8FontStruct; |
| 48 | |
| 49 | XUtf8FontStruct * |
| 50 | XCreateUtf8FontStruct ( |
| 51 | Display *dpy, |
| 52 | const char *base_font_name_list); |
| 53 | |
| 54 | void |
| 55 | XUtf8DrawString( |
| 56 | Display *display, |
| 57 | Drawable d, |
| 58 | XUtf8FontStruct *font_set, |
| 59 | GC gc, |
| 60 | int x, |
| 61 | int y, |
| 62 | const char *string, |
| 63 | int num_bytes); |
| 64 | |
| 65 | void |
| 66 | XUtf8_measure_extents( |
| 67 | Display *display, |
| 68 | Drawable d, |
| 69 | XUtf8FontStruct *font_set, |
| 70 | GC gc, |
| 71 | int *xx, |
| 72 | int *yy, |
| 73 | int *ww, |
| 74 | int *hh, |
| 75 | const char *string, |
| 76 | int num_bytes); |
| 77 | |
| 78 | void |
| 79 | XUtf8DrawRtlString( |
| 80 | Display *display, |
| 81 | Drawable d, |
| 82 | XUtf8FontStruct *font_set, |
| 83 | GC gc, |
| 84 | int x, |
| 85 | int y, |
| 86 | const char *string, |
| 87 | int num_bytes); |
| 88 | |
| 89 | void |
| 90 | XUtf8DrawImageString( |
| 91 | Display *display, |
| 92 | Drawable d, |
| 93 | XUtf8FontStruct *font_set, |
| 94 | GC gc, |
| 95 | int x, |
| 96 | int y, |
| 97 | const char *string, |
| 98 | int num_bytes); |
| 99 | |
| 100 | int |
| 101 | XUtf8TextWidth( |
| 102 | XUtf8FontStruct *font_set, |
| 103 | const char *string, |
| 104 | int num_bytes); |
| 105 | int |
| 106 | XUtf8UcsWidth( |
| 107 | XUtf8FontStruct *font_set, |
| 108 | unsigned int ucs); |
| 109 | |
| 110 | int |
| 111 | XGetUtf8FontAndGlyph( |
| 112 | XUtf8FontStruct *font_set, |
| 113 | unsigned int ucs, |
| 114 | XFontStruct **fnt, |
| 115 | unsigned short *id); |
| 116 | |
| 117 | void |
| 118 | XFreeUtf8FontStruct( |
| 119 | Display *dpy, |
| 120 | XUtf8FontStruct *font_set); |
| 121 | |
| 122 | |
| 123 | int |
| 124 | XConvertUtf8ToUcs( |
| 125 | const unsigned char *buf, |
| 126 | int len, |
| 127 | unsigned int *ucs); |
| 128 | |
| 129 | int |
| 130 | XConvertUcsToUtf8( |
| 131 | unsigned int ucs, |
| 132 | char *buf); |
| 133 | |
| 134 | int |
| 135 | XUtf8CharByteLen( |
| 136 | const unsigned char *buf, |
| 137 | int len); |
| 138 | |
| 139 | int |
| 140 | XCountUtf8Char( |
| 141 | const unsigned char *buf, |
| 142 | int len); |
| 143 | |
| 144 | int |
| 145 | XFastConvertUtf8ToUcs( |
| 146 | const unsigned char *buf, |
| 147 | int len, |
| 148 | unsigned int *ucs); |
| 149 | |
| 150 | long |
| 151 | XKeysymToUcs( |
| 152 | KeySym keysym); |
| 153 | |
| 154 | int |
| 155 | XUtf8LookupString( |
| 156 | XIC ic, |
| 157 | XKeyPressedEvent* event, |
| 158 | char* buffer_return, |
| 159 | int bytes_buffer, |
| 160 | KeySym* keysym, |
| 161 | Status* status_return); |
| 162 | |
| 163 | unsigned short |
| 164 | XUtf8IsNonSpacing( |
| 165 | unsigned int ucs); |
| 166 | |
| 167 | unsigned short |
| 168 | XUtf8IsRightToLeft( |
| 169 | unsigned int ucs); |
| 170 | |
| 171 | |
| 172 | int |
| 173 | XUtf8Tolower( |
| 174 | int ucs); |
| 175 | |
| 176 | int |
| 177 | XUtf8Toupper( |
| 178 | int ucs); |
| 179 | |
| 180 | |
| 181 | # ifdef __cplusplus |
| 182 | } |
| 183 | # endif |
| 184 | |
| 185 | #endif |
| 186 | |
| 187 | /* |
| 188 | * End of "$Id: Xutf8.h 8399 2011-02-07 22:22:16Z ianmacarthur $". |
| 189 | */ |