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