blob: b122d2e048f97d01678066bec7cd8083b7ba6b8e [file] [log] [blame]
DRC2ff39b82011-07-28 08:38:59 +00001/* "$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
30extern "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
38typedef 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
49XUtf8FontStruct *
50XCreateUtf8FontStruct (
51 Display *dpy,
52 const char *base_font_name_list);
53
54void
55XUtf8DrawString(
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
65void
66XUtf8_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
78void
79XUtf8DrawRtlString(
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
89void
90XUtf8DrawImageString(
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
100int
101XUtf8TextWidth(
102 XUtf8FontStruct *font_set,
103 const char *string,
104 int num_bytes);
105int
106XUtf8UcsWidth(
107 XUtf8FontStruct *font_set,
108 unsigned int ucs);
109
110int
111XGetUtf8FontAndGlyph(
112 XUtf8FontStruct *font_set,
113 unsigned int ucs,
114 XFontStruct **fnt,
115 unsigned short *id);
116
117void
118XFreeUtf8FontStruct(
119 Display *dpy,
120 XUtf8FontStruct *font_set);
121
122
123int
124XConvertUtf8ToUcs(
125 const unsigned char *buf,
126 int len,
127 unsigned int *ucs);
128
129int
130XConvertUcsToUtf8(
131 unsigned int ucs,
132 char *buf);
133
134int
135XUtf8CharByteLen(
136 const unsigned char *buf,
137 int len);
138
139int
140XCountUtf8Char(
141 const unsigned char *buf,
142 int len);
143
144int
145XFastConvertUtf8ToUcs(
146 const unsigned char *buf,
147 int len,
148 unsigned int *ucs);
149
150long
151XKeysymToUcs(
152 KeySym keysym);
153
154int
155XUtf8LookupString(
156 XIC ic,
157 XKeyPressedEvent* event,
158 char* buffer_return,
159 int bytes_buffer,
160 KeySym* keysym,
161 Status* status_return);
162
163unsigned short
164XUtf8IsNonSpacing(
165 unsigned int ucs);
166
167unsigned short
168XUtf8IsRightToLeft(
169 unsigned int ucs);
170
171
172int
173XUtf8Tolower(
174 int ucs);
175
176int
177XUtf8Toupper(
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 */