FLTK 1.3.4
Xutf8.h
1 /* "$Id: Xutf8.h 10588 2015-02-22 13:26:00Z AlbrechtS $"
2  *
3  * Author: Jean-Marc Lienher ( http://oksid.ch )
4  * Copyright 2000-2010 by O'ksi'D.
5  *
6  * This library is free software. Distribution and use rights are outlined in
7  * the file "COPYING" which should have been included with this file. If this
8  * file is missing or damaged, see the license at:
9  *
10  * http://www.fltk.org/COPYING.php
11  *
12  * Please report all bugs and problems on the following page:
13  *
14  * http://www.fltk.org/str.php
15  */
16 
17 #if ! ( defined(_Xutf8_h) || defined(FL_DOXYGEN) )
18 #define _Xutf8_h
19 
20 # ifdef __cplusplus
21 extern "C" {
22 # endif
23 
24 #include <X11/X.h>
25 #include <X11/Xlib.h>
26 #include <X11/Xlocale.h>
27 #include <X11/Xutil.h>
28 #include <FL/Fl_Export.H>
29 
30 typedef struct {
31  int nb_font;
32  char **font_name_list;
33  int *encodings;
34  XFontStruct **fonts;
35  Font fid;
36  int ascent;
37  int descent;
38  int *ranges;
39 } XUtf8FontStruct;
40 
41 XUtf8FontStruct *
42 XCreateUtf8FontStruct (
43  Display *dpy,
44  const char *base_font_name_list);
45 
46 void
47 XUtf8DrawString(
48  Display *display,
49  Drawable d,
50  XUtf8FontStruct *font_set,
51  GC gc,
52  int x,
53  int y,
54  const char *string,
55  int num_bytes);
56 
57 void
58 XUtf8_measure_extents(
59  Display *display,
60  Drawable d,
61  XUtf8FontStruct *font_set,
62  GC gc,
63  int *xx,
64  int *yy,
65  int *ww,
66  int *hh,
67  const char *string,
68  int num_bytes);
69 
70 void
71 XUtf8DrawRtlString(
72  Display *display,
73  Drawable d,
74  XUtf8FontStruct *font_set,
75  GC gc,
76  int x,
77  int y,
78  const char *string,
79  int num_bytes);
80 
81 void
82 XUtf8DrawImageString(
83  Display *display,
84  Drawable d,
85  XUtf8FontStruct *font_set,
86  GC gc,
87  int x,
88  int y,
89  const char *string,
90  int num_bytes);
91 
92 int
93 XUtf8TextWidth(
94  XUtf8FontStruct *font_set,
95  const char *string,
96  int num_bytes);
97 int
98 XUtf8UcsWidth(
99  XUtf8FontStruct *font_set,
100  unsigned int ucs);
101 
102 FL_EXPORT int
103 fl_XGetUtf8FontAndGlyph(
104  XUtf8FontStruct *font_set,
105  unsigned int ucs,
106  XFontStruct **fnt,
107  unsigned short *id);
108 
109 void
110 XFreeUtf8FontStruct(
111  Display *dpy,
112  XUtf8FontStruct *font_set);
113 
114 
115 int
116 XConvertUtf8ToUcs(
117  const unsigned char *buf,
118  int len,
119  unsigned int *ucs);
120 
121 int
122 XConvertUcsToUtf8(
123  unsigned int ucs,
124  char *buf);
125 
126 int
127 XUtf8CharByteLen(
128  const unsigned char *buf,
129  int len);
130 
131 int
132 XCountUtf8Char(
133  const unsigned char *buf,
134  int len);
135 
136 int
137 XFastConvertUtf8ToUcs(
138  const unsigned char *buf,
139  int len,
140  unsigned int *ucs);
141 
142 long
143 XKeysymToUcs(
144  KeySym keysym);
145 
146 #ifdef X_HAVE_UTF8_STRING
147 #define XUtf8LookupString Xutf8LookupString
148 #else
149 int
150 XUtf8LookupString(
151  XIC ic,
152  XKeyPressedEvent* event,
153  char* buffer_return,
154  int bytes_buffer,
155  KeySym* keysym,
156  Status* status_return);
157 #endif
158 
159 unsigned short
160 XUtf8IsNonSpacing(
161  unsigned int ucs);
162 
163 unsigned short
164 XUtf8IsRightToLeft(
165  unsigned int ucs);
166 
167 
168 int
169 XUtf8Tolower(
170  int ucs);
171 
172 int
173 XUtf8Toupper(
174  int ucs);
175 
176 
177 # ifdef __cplusplus
178 }
179 # endif
180 
181 #endif
182 
183 /*
184  * End of "$Id: Xutf8.h 10588 2015-02-22 13:26:00Z AlbrechtS $".
185  */