1
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
3
.\" Permission is hereby granted, free of charge, to any person obtaining
4
.\" a copy of this software and associated documentation files (the
5
.\" "Software"), to deal in the Software without restriction, including
6
.\" without limitation the rights to use, copy, modify, merge, publish,
7
.\" distribute, sublicense, and/or sell copies of the Software, and to
8
.\" permit persons to whom the Software is furnished to do so, subject to
9
.\" the following conditions:
11
.\" The above copyright notice and this permission notice shall be included
12
.\" in all copies or substantial portions of the Software.
14
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
18
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
.\" OTHER DEALINGS IN THE SOFTWARE.
22
.\" Except as contained in this notice, the name of the X Consortium shall
23
.\" not be used in advertising or otherwise to promote the sale, use or
24
.\" other dealings in this Software without prior written authorization
25
.\" from the X Consortium.
27
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
28
.\" Digital Equipment Corporation
30
.\" Portions Copyright \(co 1990, 1991 by
33
.\" Permission to use, copy, modify and distribute this documentation for
34
.\" any purpose and without fee is hereby granted, provided that the above
35
.\" copyright notice appears in all copies and that both that copyright notice
36
.\" and this permission notice appear in all copies, and that the names of
37
.\" Digital and Tektronix not be used in in advertising or publicity pertaining
38
.\" to this documentation without specific, written prior permission.
39
.\" Digital and Tektronix makes no representations about the suitability
40
.\" of this documentation for any purpose.
41
.\" It is provided ``as is'' without express or implied warranty.
46
\s+1\fBChapter 13\fP\s-1
48
\s+1\fBLocales and Internationalized Text Functions\fP\s-1
58
Chapter 13: Locales and Internationalized Text Functions
60
An internationalized application is one that is adaptable to the requirements
61
of different native languages, local customs, and character string encodings.
62
The process of adapting the operation to a particular native language,
63
local custom, or string encoding is called \fIlocalization\fP\^.
64
A goal of internationalization is to permit localization
65
without program source modifications or recompilation.
67
As one of the localization mechanisms,
68
Xlib provides an X Input Method
70
functional interface for internationalized text input
71
and an X Output Method
73
functional interface for internationalized text output.
75
Internationalization in X is based on the concept of a \fIlocale\fP.
76
A locale defines the localized behavior of a program at run time.
77
Locales affect Xlib in its:
79
Encoding and processing of input method text
81
Encoding of resource files and values
83
Encoding and imaging of text strings
85
Encoding and decoding for inter-client text communication
87
Characters from various languages are represented in a computer
89
Different languages have different encodings,
90
and there are even different encodings for the same characters
93
This chapter defines support for localized text imaging and text input
94
and describes the locale mechanism that controls all locale-dependent
96
Sets of functions are provided for multibyte (char *) text as well as
97
wide character (wchar_t) text in the form supported
98
by the host C language environment.
99
The multibyte and wide character functions
100
are equivalent except for the form of the text argument.
102
The Xlib internationalization functions are not meant to provide
103
support for multilingual applications (mixing multiple languages
104
within a single piece of text), but they make it possible to
105
implement applications that work in limited fashion with more than
106
one language in independent contexts.
108
The remainder of this chapter discusses:
112
Locale and modifier dependencies
114
Variable argument lists
124
\*(SN X Locale Management
127
X supports one or more of the locales defined by the host environment.
128
On implementations that conform to the ANSI C library,
129
the locale announcement method is
131
This function configures the locale operation of both
132
the host C library and Xlib.
133
The operation of Xlib is governed by the LC_CTYPE category;
134
this is called the \fIcurrent locale\fP.
135
An implementation is permitted to provide implementation-dependent
136
mechanisms for announcing the locale in addition to
139
On implementations that do not conform to the ANSI C library,
140
the locale announcement method is Xlib implementation-dependent.
142
The mechanism by which the semantic operation of Xlib is defined
143
for a specific locale is implementation-dependent.
146
X is not required to support all the locales supported by the host.
147
To determine if the current locale is supported by X, use
148
.PN XSupportsLocale .
149
.IN "XSupportsLocale" "" "@DEF@"
152
Bool XSupportsLocale\^(\|)
160
if Xlib functions are capable of operating under the current locale.
163
Xlib locale-dependent functions for which the
164
.PN XLocaleNotSupported
165
return status is defined will return
166
.PN XLocaleNotSupported .
167
Other Xlib locale-dependent routines will operate in the ``C'' locale.
169
The client is responsible for selecting its locale and X modifiers.
170
Clients should provide a means for the user to override the clients'
171
locale selection at client invocation.
172
Most single-display X clients operate in a single locale
173
for both X and the host processing environment.
174
They will configure the locale by calling three functions:
175
the host locale configuration function,
176
.PN XSupportsLocale ,
178
.PN XSetLocaleModifiers .
180
The semantics of certain categories of X internationalization capabilities
181
can be configured by setting modifiers.
182
Modifiers are named by implementation-dependent and locale-specific strings.
183
The only standard use for this capability at present
184
is selecting one of several styles of keyboard input method.
187
To configure Xlib locale modifiers for the current locale, use
188
.PN XSetLocaleModifiers .
189
.IN "XSetLocaleModifiers" "" "@DEF@"
192
char *XSetLocaleModifiers\^(\^\fImodifier_list\fP\^)
194
char *\fImodifier_list\fP\^;
196
.IP \fImodifier_list\fP 1i
197
Specifies the modifiers.
201
.PN XSetLocaleModifiers
202
function sets the X modifiers for the current locale setting.
203
The modifier_list argument is a null-terminated string of the form
204
``{@\^\fIcategory\fP\^=\^\fIvalue\fP\^}'', that is,
205
having zero or more concatenated ``@\^\fIcategory\fP\^=\^\fIvalue\fP\^''
206
entries, where \fIcategory\fP is a category name
207
and \fIvalue\fP is the (possibly empty) setting for that category.
208
The values are encoded in the current locale.
209
Category names are restricted to the POSIX Portable Filename Character Set.
211
The local host X locale modifiers announcer (on POSIX-compliant systems,
212
the XMODIFIERS environment variable) is appended to the modifier_list to
213
provide default values on the local host.
214
If a given category appears more than once in the list,
215
the first setting in the list is used.
216
If a given category is not included in the full modifier list,
217
the category is set to an implementation-dependent default
218
for the current locale.
219
An empty value for a category explicitly specifies the
220
implementation-dependent default.
222
If the function is successful, it returns a pointer to a string.
223
The contents of the string are such that a subsequent call with that string
224
(in the same locale) will restore the modifiers to the same settings.
225
If modifier_list is a NULL pointer,
226
.PN XSetLocaleModifiers
227
also returns a pointer to such a string,
228
and the current locale modifiers are not changed.
230
If invalid values are given for one or more modifier categories supported by
231
the locale, a NULL pointer is returned, and none of the
232
current modifiers are changed.
235
the modifiers that are in effect are unspecified until
236
the first successful call to set them. Whenever the locale is changed, the
237
modifiers that are in effect become unspecified until the next successful call
239
Clients should always call
240
.PN XSetLocaleModifiers
241
with a non-NULL modifier_list after setting the locale
242
before they call any locale-dependent Xlib routine.
244
The only standard modifier category currently defined is ``im'',
245
which identifies the desired input method.
246
The values for input method are not standardized.
247
A single locale may use multiple input methods,
248
switching input method under user control.
249
The modifier may specify the initial input method in effect
250
or an ordered list of input methods.
251
Multiple input methods may be specified in a single im value string
252
in an implementation-dependent manner.
254
The returned modifiers string is owned by Xlib and should not be modified or
256
It may be freed by Xlib after the current locale or modifiers are changed.
257
Until freed, it will not be modified by Xlib.
259
The recommended procedure for clients initializing their locale and modifiers
260
is to obtain locale and modifier announcers separately from
261
one of the following prioritized sources:
263
A command line option
267
The empty string ("\^")
269
The first of these that is defined should be used.
270
Note that when a locale command line option or locale resource is defined,
271
the effect should be to set all categories to the specified locale,
272
overriding any category-specific settings in the local host environment.
274
Locale and Modifier Dependencies
276
\*(SN Locale and Modifier Dependencies
279
The internationalized Xlib functions operate in the current locale
280
configured by the host environment and X locale modifiers set by
281
.PN XSetLocaleModifiers
282
or in the locale and modifiers configured at the time
283
some object supplied to the function was created.
284
For each locale-dependent function,
285
the following table describes the locale (and modifiers) dependency:
287
lw(1.25i) lw(2.5i) lw(2i).
291
Locale from Affects the Function In
297
Locale Query/Configuration:
307
.PN XSetLocaleModifiers
317
.PN XrmGetFileDatabase
323
.PN XrmGetStringDatabase
328
.PN XrmPutFileDatabase
334
.PN XrmLocaleOfDatabase
337
Setting Standard Properties:
342
.PN XmbSetWMProperties
344
Encoding of supplied/returned
346
text (some WM_ property
347
text in environment locale)
352
.PN XmbTextPropertyToTextList
354
Encoding of supplied/returned text
357
.PN XwcTextPropertyToTextList
360
.PN XmbTextListToTextProperty
363
.PN XwcTextListToTextProperty
373
XIM input method selection
376
.PN XRegisterIMInstantiateCallback
381
.PN XUnregisterIMInstantiateCallback
390
XIC input method configuration
408
Encoding of returned text
418
XOM output method selection
431
XOC output method configuration
444
Locale of supplied text
450
Locale of supplied text
453
.PN XExtentsOfFontSet ,
456
Locale-dependent metrics
471
.PN XGetErrorDatabaseText
473
Locale of error message
482
Clients may assume that a locale-encoded text string returned
483
by an X function can be passed to a C library routine, or vice versa,
484
if the locale is the same at the two calls.
486
All text strings processed by internationalized Xlib functions are assumed
487
to begin in the initial state of the encoding of the locale, if the encoding
490
All Xlib functions behave as if they do not change the current locale
491
or X modifier setting.
492
(This means that if they do change locale or call
493
.PN XSetLocaleModifiers
494
with a non-NULL argument, they must save and restore the current state on
496
Also, Xlib functions on implementations that conform to the ANSI C library do
497
not alter the global state associated with the ANSI C functions
504
Variable Argument Lists
506
\*(SN Variable Argument Lists
509
Various functions in this chapter have arguments that conform
510
to the ANSI C variable argument list calling convention.
511
Each function denoted with an argument of the form ``...'' takes
512
a variable-length list of name and value pairs,
513
where each name is a string and each value is of type
515
A name argument that is NULL identifies the end of the list.
517
A variable-length argument list may contain a nested list.
520
is specified in place of an argument name,
521
then the following value is interpreted as an
523
value that specifies a list of values logically inserted into the
524
original list at the point of declaration.
525
A NULL identifies the end of a nested list.
528
To allocate a nested variable argument list dynamically, use
529
.PN XVaCreateNestedList .
530
.IN "XVaCreateNestedList" "" @DEF@"
533
typedef void * XVaNestedList;
535
XVaNestedList XVaCreateNestedList\^(\^\fIdummy\fP\^, ...)
540
Specifies an unused argument (required by ANSI C).
543
Specifies the variable length argument list\*(Al.
547
.PN XVaCreateNestedList
548
function allocates memory and copies its arguments into
549
a single list pointer,
550
which may be used as a value for arguments requiring a list value.
551
Any entries are copied as specified.
552
Data passed by reference is not copied;
553
the caller must ensure data remains valid for the lifetime
555
The list should be freed using
557
when it is no longer needed.
564
This section provides discussions of the following X Output Method
567
Output method overview
569
Output method functions
573
Output context functions
575
Output context values
577
Creating and freeing a font set
579
Obtaining font set metrics
581
Drawing text using font sets
583
Output Method Overview
585
\*(SN Output Method Overview
588
Locale-dependent text may include one or more text components, each of
589
which may require different fonts and character set encodings.
590
In some languages, each component might have a different
591
drawing direction, and some components might contain
592
context-dependent characters that change shape based on
593
relationships with neighboring characters.
595
When drawing such locale-dependent text, some locale-specific
596
knowledge is required;
597
for example, what fonts are required to draw the text,
598
how the text can be separated into components, and which
599
fonts are selected to draw each component.
600
Further, when bidirectional text must be drawn,
601
the internal representation order of the text must be changed
602
into the visual representation order to be drawn.
604
An X Output Method provides a functional interface so that clients
605
do not have to deal directly with such locale-dependent details.
606
Output methods provide the following capabilities:
608
Creating a set of fonts required to draw locale-dependent text.
610
Drawing locale-dependent text with a font set without the caller
611
needing to be aware of locale dependencies.
613
Obtaining the escapement and extents in pixels of locale-dependent text.
615
Determining if bidirectional or context-dependent drawing is required
616
in a specific locale with a specific font set.
618
Two different abstractions are used in the representation of
619
the output method for clients.
621
The abstraction used to communicate with an output method
622
is an opaque data structure represented by the
625
The abstraction for representing the state of a particular output thread
626
is called an \fIoutput context\fP.
627
The Xlib representation of an output context is an
629
which is compatible with
631
in terms of its functional interface, but is
632
a broader, more generalized abstraction.
634
Output Method Functions
636
\*(SN Output Method Functions
639
To open an output method, use
641
.IN "XOpenOM" "" "@DEF@"
644
XOM XOpenOM\^(\^\fIdisplay\fP\^, \fIdb\fP\^, \fIres_name\fP\^, \fIres_class\fP\^)
646
Display *\fIdisplay\fP\^;
648
XrmDatabase \fIdb\fP\^;
650
char *\fIres_name\fP\^;
652
char *\fIres_class\fP\^;
655
Specifies the connection to the X server.
657
Specifies a pointer to the resource database.
658
.IP \fIres_name\fP 1i
659
Specifies the full resource name of the application.
660
.IP \fIres_class\fP 1i
661
Specifies the full class name of the application.
666
function opens an output method
667
matching the current locale and modifiers specification.
668
The current locale and modifiers are bound to the output method
672
The locale associated with an output method cannot be changed.
674
The specific output method to which this call will be routed
675
is identified on the basis of the current locale and modifiers.
677
will identify a default output method corresponding to the
679
That default can be modified using
680
.PN XSetLocaleModifiers
681
to set the output method modifier.
683
The db argument is the resource database to be used by the output method
684
for looking up resources that are private to the output method.
685
It is not intended that this database be used to look
686
up values that can be set as OC values in an output context.
688
no database is passed to the output method.
690
The res_name and res_class arguments specify the resource name
691
and class of the application.
692
They are intended to be used as prefixes by the output method
693
when looking up resources that are common to all output contexts
694
that may be created for this output method.
695
The characters used for resource names and classes must be in the
696
X Portable Character Set.
697
The resources looked up are not fully specified
698
if res_name or res_class is NULL.
700
The res_name and res_class arguments are not assumed to exist beyond
703
The specified resource database is assumed to exist for the lifetime
704
of the output method.
707
returns NULL if no output method could be opened.
710
To close an output method, use
712
.IN "XCloseOM" "" "@DEF@"
715
Status XCloseOM\^(\^\fIom\fP\^)
720
Specifies the output method.
725
function closes the specified output method.
728
To set output method attributes, use
730
.IN "XSetOMValues" "" "@DEF@"
733
char * XSetOMValues\^(\^\fIom\fP\^, ...)
738
Specifies the output method.
739
.ds Al \ to set XOM values
741
Specifies the variable-length argument list\*(Al.
746
function presents a variable argument list programming interface
747
for setting properties or features of the specified output method.
748
This function returns NULL if it succeeds;
750
it returns the name of the first argument that could not be obtained.
752
No standard arguments are currently defined by Xlib.
755
To query an output method, use
757
.IN "XGetOMValues" "" "@DEF@"
760
char * XGetOMValues\^(\^\fIom\fP\^, ...)
765
Specifies the output method.
766
.ds Al \ to get XOM values
768
Specifies the variable-length argument list\*(Al.
773
function presents a variable argument list programming interface
774
for querying properties or features of the specified output method.
775
This function returns NULL if it succeeds;
777
it returns the name of the first argument that could not be obtained.
779
To obtain the display associated with an output method, use
781
.IN "XDisplayOfOM" "" "@DEF@"
784
Display * XDisplayOfOM\^(\^\fIom\fP\^)
789
Specifies the output method.
794
function returns the display associated with the specified output method.
797
To get the locale associated with an output method, use
799
.IN "XLocaleOfOM" "" "@DEF@"
802
char * XLocaleOfOM\^(\^\fIom\fP\^)
807
Specifies the output method.
812
returns the locale associated with the specified output method.
814
X Output Method Values
816
\*(SN X Output Method Values
819
The following table describes how XOM values are interpreted by an
821
The first column lists the XOM values. The second column indicates
822
how each of the XOM values are treated by a particular output style.
825
The following key applies to this table.
838
This value may be read using
858
.PN XNRequiredCharSet
863
.PN XNQueryOrientation
868
.PN XNDirectionalDependentDrawing
873
.PN XNContextualDrawing
884
\*(SN Required Char Set
888
.PN XNRequiredCharSet
889
argument returns the list of charsets that are required for loading the fonts
890
needed for the locale.
891
The value of the argument is a pointer to a structure of type
896
structure is defined as follows:
897
.IN "XOMCharSetList" "" "@DEF@"
910
The charset_list member is a list of one or more null-terminated
911
charset names, and the charset_count member is the number of
914
The required charset list is owned by Xlib and should not be modified or
916
It will be freed by a call to
920
Until freed, its contents will not be modified by Xlib.
925
\*(SN Query Orientation
929
.PN XNQueryOrientation
930
argument returns the global orientation of text when drawn.
932
.PN XOMOrientation_LTR_TTB ,
933
the set of orientations supported is locale-dependent.
934
The value of the argument is a pointer to a structure of type
936
Clients are responsible for freeing the
940
this also frees the contents of the structure.
948
XOrientation *orientation; /* Input Text description */
952
XOMOrientation_LTR_TTB,
953
XOMOrientation_RTL_TTB,
954
XOMOrientation_TTB_LTR,
955
XOMOrientation_TTB_RTL,
956
XOMOrientation_Context
961
The possible value for XOrientation may be:
963
.PN XOMOrientation_LTR_TTB
964
left-to-right, top-to-bottom global orientation
966
.PN XOMOrientation_RTL_TTB
967
right-to-left, top-to-bottom global orientation
969
.PN XOMOrientation_TTB_LTR
970
top-to-bottom, left-to-right global orientation
972
.PN XOMOrientation_TTB_RTL
973
top-to-bottom, right-to-left global orientation
975
.PN XOMOrientation_Context
976
contextual global orientation
979
Directional Dependent Drawing
981
\*(SN Directional Dependent Drawing
985
.PN XNDirectionalDependentDrawing
986
argument indicates whether the text rendering functions
987
implement implicit handling of directional text. If this value
990
the output method has knowledge of directional
991
dependencies and reorders text as necessary when
992
rendering text. If this value is
994
the output method does not implement any directional text
995
handling, and all character directions are assumed to be left-to-right.
997
Regardless of the rendering order of characters,
998
the origins of all characters are on the primary draw direction side
999
of the drawing origin.
1001
This OM value presents functionality identical to the
1002
.PN XDirectionalDependentDrawing
1005
Context Dependent Drawing
1007
\*(SN Context Dependent Drawing
1011
.PN XNContextualDrawing
1012
argument indicates whether the text rendering functions
1013
implement implicit context-dependent drawing. If this value is
1015
the output method has knowledge of context dependencies and
1016
performs character shape editing, combining glyphs to present
1017
a single character as necessary. The actual shape editing is
1018
dependent on the locale implementation and the font set used.
1020
This OM value presents functionality identical to the
1021
.PN XContextualDrawing
1024
Output Context Functions
1026
\*(SN Output Context Functions
1029
An output context is an abstraction that contains both the data
1030
required by an output method and the information required
1031
to display that data.
1032
There can be multiple output contexts for one output method.
1033
The programming interfaces for creating, reading, or modifying
1034
an output context use a variable argument list.
1035
The name elements of the argument lists are referred to as XOC values.
1036
It is intended that output methods be controlled by these XOC values.
1037
As new XOC values are created,
1038
they should be registered with the X Consortium.
1041
can be used anywhere an
1043
can be used, and vice versa;
1045
is retained for compatibility with previous releases.
1046
The concepts of output methods and output contexts include broader,
1047
more generalized abstraction than font set,
1048
supporting complex and more intelligent text display, and dealing not only
1049
with multiple fonts but also with context dependencies.
1052
is widely used in several interfaces, so
1054
is defined as an upward compatible type of
1058
To create an output context, use
1060
.IN "XCreateOC" "" "@DEF@"
1063
XOC XCreateOC\^(\^\fIom\fP\^, ...)
1068
Specifies the output method.
1069
.ds Al \ to set XOC values
1071
Specifies the variable-length argument list\*(Al.
1076
function creates an output context within the specified output method.
1078
The base font names argument is mandatory at creation time, and
1079
the output context will not be created unless it is provided.
1080
All other output context values can be set later.
1083
returns NULL if no output context could be created.
1084
NULL can be returned for any of the following reasons:
1086
A required argument was not set.
1088
A read-only argument was set.
1090
An argument name is not recognized.
1092
The output method encountered an output method implementation-dependent error.
1100
To destroy an output context, use
1102
.IN "XDestroyOC" "" "@DEF@"
1105
void XDestroyOC\^(\^\fIoc\fP\^)
1110
Specifies the output context.
1115
function destroys the specified output context.
1118
To get the output method associated with an output context, use
1120
.IN "XOMOfOC" "" "@DEF@"
1123
XOM XOMOfOC\^(\^\fIoc\fP\^)
1128
Specifies the output context.
1133
function returns the output method associated with the
1134
specified output context.
1137
Xlib provides two functions for setting and reading output context values,
1142
Both functions have a variable-length argument list.
1143
In that argument list, any XOC value's name must be denoted
1144
with a character string using the X Portable Character Set.
1147
To set XOC values, use
1149
.IN "XSetOCValues" "" "@DEF@"
1152
char * XSetOCValues\^(\^\fIoc\fP\^, ...)
1157
Specifies the output context.
1158
.ds Al \ to set XOC values
1160
Specifies the variable-length argument list\*(Al.
1165
function returns NULL if no error occurred;
1167
it returns the name of the first argument that could not be set.
1168
An argument might not be set for any of the following reasons:
1170
The argument is read-only.
1172
The argument name is not recognized.
1174
An implementation-dependent error occurs.
1176
Each value to be set must be an appropriate datum,
1177
matching the data type imposed by the semantics of the argument.
1185
To obtain XOC values, use
1187
.IN "XGetOCValues" "" "@DEF@"
1190
char * XGetOCValues\^(\^\fIoc\fP\^, ...)
1195
Specifies the output context.
1196
.ds Al \ to get XOC values
1198
Specifies the variable-length argument list\*(Al.
1203
function returns NULL if no error occurred; otherwise,
1204
it returns the name of the first argument that could not be obtained.
1205
An argument might not be obtained for any of the following reasons:
1207
The argument name is not recognized.
1209
An implementation-dependent error occurs.
1212
following a name must point to a location where the value is to be stored.
1214
Output Context Values
1216
\*(SN Output Context Values
1219
The following table describes how XOC values are interpreted
1220
by an output method.
1221
The first column lists the XOC values.
1222
The second column indicates the alternative interfaces that function
1223
identically and are provided for compatibility with previous releases.
1224
The third column indicates how each of the XOC values is treated.
1226
The following keys apply to this table.
1238
This value must be set with
1242
This value may be set using
1246
a default is provided.
1249
This value may be read using
1253
This value must be set using
1266
XOC Value Alternative Interface Key
1335
\*(SN Base Font Name
1340
argument is a list of base font names that Xlib uses
1341
to load the fonts needed for the locale.
1342
The base font names are a comma-separated list. The string is null-terminated
1343
and is assumed to be in the Host Portable Character Encoding;
1344
otherwise, the result is implementation-dependent.
1345
White space immediately on either side of a separating comma is ignored.
1347
Use of XLFD font names permits Xlib to obtain the fonts needed for a
1348
variety of locales from a single locale-independent base font name.
1349
The single base font name should name a family of fonts whose members
1350
are encoded in the various charsets needed by the locales of interest.
1352
An XLFD base font name can explicitly name a charset needed for the locale.
1353
This allows the user to specify an exact font for use with a charset required
1354
by a locale, fully controlling the font selection.
1356
If a base font name is not an XLFD name,
1357
Xlib will attempt to obtain an XLFD name from the font properties
1359
If Xlib is successful, the
1361
function will return this XLFD name instead of the client-supplied name.
1363
This argument must be set at creation time
1364
and cannot be changed.
1365
If no fonts exist for any of the required charsets,
1366
or if the locale definition in Xlib requires that a font exist
1367
for a particular charset and a font is not found for that charset,
1371
When querying for the
1375
returns a null-terminated string identifying the base font names that
1376
Xlib used to load the fonts needed for the locale.
1377
This string is owned by Xlib and should not be modified or freed by
1379
The string will be freed by a call to
1383
Until freed, the string contents will not be modified by Xlib.
1387
\*(SN Missing CharSet
1391
.PN XNMissingCharSet
1392
argument returns the list of required charsets that are missing from the
1394
The value of the argument is a pointer to a structure of type
1395
.PN XOMCharSetList .
1397
If fonts exist for all of the charsets required by the current locale,
1398
charset_list is set to NULL and charset_count is set to zero.
1399
If no fonts exist for one or more of the required charsets,
1400
charset_list is set to a list of one or more null-terminated charset names
1401
for which no fonts exist, and charset_count is set to the number of
1403
The charsets are from the list of the required charsets for
1404
the encoding of the locale and do not include any charsets to which Xlib
1405
may be able to remap a required charset.
1407
The missing charset list is owned by Xlib and should not be modified or
1408
freed by the client.
1409
It will be freed by a call to
1413
Until freed, its contents will not be modified by Xlib.
1417
\*(SN Default String
1420
When a drawing or measuring function is called with an
1422
that has missing charsets, some characters in the locale will not be
1426
argument returns a pointer to a string that represents the glyphs
1427
that are drawn with this
1429
when the charsets of the available fonts do not include all glyphs
1430
required to draw a character.
1431
The string does not necessarily consist of valid characters
1432
in the current locale and is not necessarily drawn with
1433
the fonts loaded for the font set,
1434
but the client can draw or measure the default glyphs
1435
by including this string in a string being drawn or measured with the
1440
argument returned the empty string ("\^"),
1441
no glyphs are drawn and the escapement is zero.
1442
The returned string is null-terminated.
1443
It is owned by Xlib and should not be modified or freed by the client.
1444
It will be freed by a call to
1448
Until freed, its contents will not be modified by Xlib.
1457
argument specifies the current orientation of text when drawn. The value of
1458
this argument is one of the values returned by the
1461
.PN XNQueryOrientation
1462
argument specified in the
1465
The value of the argument is of type
1469
is queried, the value specifies the current orientation.
1472
is set, a value is used to set the current orientation.
1475
.PN XOMOrientation_Context
1476
is set, the text orientation of the
1477
text is determined according to an implementation-defined method
1478
(for example, ISO 6429 control sequences), and the initial text orientation for
1479
locale-dependent Xlib functions is assumed to
1481
.PN XOMOrientation_LTR_TTB .
1485
value does not change the prime drawing direction
1486
for Xlib drawing functions.
1488
Resource Name and Class
1490
\*(SN Resource Name and Class
1497
arguments are strings that specify the full name and class
1498
used by the client to obtain resources for the display of the output context.
1499
These values should be used as prefixes for name and class
1500
when looking up resources that may vary according to the output context.
1501
If these values are not set,
1502
the resources will not be fully specified.
1504
It is not intended that values that can be set as XOM values be
1507
When querying for the
1513
returns a null-terminated string.
1514
This string is owned by Xlib and should not be modified or freed by
1516
The string will be freed by a call to
1520
or when the associated value is changed via
1522
Until freed, the string contents will not be modified by Xlib.
1531
argument specifies a list of one or more
1534
and font names for the fonts used for drawing by the given output context.
1535
The value of the argument is a pointer to a structure of type
1544
XFontStruct **font_struct_list;
1545
char **font_name_list;
1550
A list of pointers to the
1552
structures is returned to font_struct_list.
1553
A list of pointers to null-terminated, fully-specified font name strings
1554
in the locale of the output context is returned to font_name_list.
1555
The font_name_list order corresponds to the font_struct_list order.
1558
structures and font names is returned to num_font.
1560
Because it is not guaranteed that a given character will be imaged using a
1562
there is no provision for mapping a character or default string
1563
to the font properties, font ID, or direction hint for the font
1565
The client may access the
1567
list to obtain these values for all the fonts currently in use.
1569
Xlib does not guarantee that fonts are loaded from the server
1570
at the creation of an
1572
Xlib may choose to cache font data, loading it only as needed to draw text
1573
or compute text dimensions.
1574
Therefore, existence of the per_char metrics in the
1579
Also, note that all properties in the
1581
structures are in the STRING encoding.
1583
The client must not free the
1585
struct itself; it will be freed when the
1596
argument returns whether the associated output context was created by
1600
function not only destroys the output context but also closes the implicit
1601
output method associated with it,
1603
should be used with any output context created by
1604
.PN XCreateFontSet .
1605
However, it is possible that a client does not know how the output context
1607
Before a client destroys the output context,
1608
it can query whether
1610
is set to determine whether
1614
should be used to destroy the output context.
1616
Creating and Freeing a Font Set
1618
\*(SN Creating and Freeing a Font Set
1621
Xlib international text drawing is done using a set of one or more fonts,
1622
as needed for the locale of the text.
1623
Fonts are loaded according to a list of base font names
1624
supplied by the client and the charsets required by the locale.
1627
is an opaque type representing the state of a particular output thread
1628
and is equivalent to the type
1634
function is a convenience function for creating an output context using
1635
only default values. The returned
1637
has an implicitly created
1643
automatically set to
1645
so that the output context self indicates whether it was created by
1648
.PN XCreateFontSet .
1649
.IN "XCreateFontSet" "" "@DEF@"
1652
XFontSet XCreateFontSet\^(\^\fIdisplay\fP\^, \fIbase_font_name_list\fP\^, \fImissing_charset_list_return\fP\^,
1654
\fImissing_charset_count_return\fP\^, \fIdef_string_return\fP\^)
1656
Display *\fIdisplay\fP\^;
1658
char *\fIbase_font_name_list\fP\^;
1660
char ***\fImissing_charset_list_return\fP\^;
1662
int *\fImissing_charset_count_return\fP\^;
1664
char **\fIdef_string_return\fP\^;
1666
.IP \fIdisplay\fP 1i
1667
Specifies the connection to the X server.
1668
.IP \fIbase_font_name_list\fP 1i
1669
Specifies the base font names.
1670
.IP \fImissing_charset_list_return\fP 1i
1671
Returns the missing charsets.
1672
.IP \fImissing_charset_count_return\fP 1i
1673
Returns the number of missing charsets.
1674
.IP \fIdef_string_return\fP 1i
1675
Returns the string drawn for missing charsets.
1680
function creates a font set for the specified display.
1681
The font set is bound to the current locale when
1684
The font set may be used in subsequent calls to obtain font
1685
and character information and to image text in the locale of the font set.
1687
The base_font_name_list argument is a list of base font names
1688
that Xlib uses to load the fonts needed for the locale.
1689
The base font names are a comma-separated list.
1690
The string is null-terminated
1691
and is assumed to be in the Host Portable Character Encoding;
1692
otherwise, the result is implementation-dependent.
1693
White space immediately on either side of a separating comma is ignored.
1695
Use of XLFD font names permits Xlib to obtain the fonts needed for a
1696
variety of locales from a single locale-independent base font name.
1697
The single base font name should name a family of fonts whose members
1698
are encoded in the various charsets needed by the locales of interest.
1700
An XLFD base font name can explicitly name a charset needed for the locale.
1701
This allows the user to specify an exact font for use with a charset required
1702
by a locale, fully controlling the font selection.
1704
If a base font name is not an XLFD name,
1705
Xlib will attempt to obtain an XLFD name from the font properties
1707
If this action is successful in obtaining an XLFD name, the
1708
.PN XBaseFontNameListOfFontSet
1709
function will return this XLFD name instead of the client-supplied name.
1711
Xlib uses the following algorithm to select the fonts
1712
that will be used to display text with the
1715
For each font charset required by the locale,
1716
the base font name list is searched for the first appearance of one
1717
of the following cases that names a set of fonts that exist at the server:
1719
The first XLFD-conforming base font name that specifies the required
1720
charset or a superset of the required charset in its
1725
The implementation may use a base font name whose specified charset
1726
is a superset of the required charset, for example,
1727
an ISO8859-1 font for an ASCII charset.
1729
The first set of one or more XLFD-conforming base font names
1730
that specify one or more charsets that can be remapped to support the
1732
The Xlib implementation may recognize various mappings
1733
from a required charset to one or more other charsets
1734
and use the fonts for those charsets.
1735
For example, JIS Roman is ASCII with tilde and backslash replaced
1737
Xlib may load an ISO8859-1 font to support this character set
1738
if a JIS Roman font is not available.
1740
The first XLFD-conforming font name or the first non-XLFD font name
1741
for which an XLFD font name can be obtained, combined with the
1742
required charset (replacing the
1746
fields in the XLFD font name).
1748
the implementation may use a charset that is a superset
1749
of the required charset.
1751
The first font name that can be mapped in some implementation-dependent
1752
manner to one or more fonts that support imaging text in the charset.
1754
For example, assume that a locale required the charsets:
1763
The user could supply a base_font_name_list that explicitly specifies the
1764
charsets, ensuring that specific fonts are used if they exist.
1768
"-JIS-Fixed-Medium-R-Normal--26-180-100-100-C-240-JISX0208.1983-0,\\
1769
-JIS-Fixed-Medium-R-Normal--26-180-100-100-C-120-JISX0201.1976-0,\\
1770
-GB-Fixed-Medium-R-Normal--26-180-100-100-C-240-GB2312-1980.0,\\
1771
-Adobe-Courier-Bold-R-Normal--25-180-75-75-M-150-ISO8859-1"
1774
Alternatively, the user could supply a base_font_name_list
1775
that omits the charsets,
1776
letting Xlib select font charsets required for the locale.
1780
"-JIS-Fixed-Medium-R-Normal--26-180-100-100-C-240,\\
1781
-JIS-Fixed-Medium-R-Normal--26-180-100-100-C-120,\\
1782
-GB-Fixed-Medium-R-Normal--26-180-100-100-C-240,\\
1783
-Adobe-Courier-Bold-R-Normal--25-180-100-100-M-150"
1786
Alternatively, the user could simply supply a single base font name
1787
that allows Xlib to select from all available fonts
1788
that meet certain minimum XLFD property requirements.
1792
"-*-*-*-R-Normal--*-180-100-100-*-*"
1797
is unable to create the font set,
1798
either because there is insufficient memory or because the current locale
1801
returns NULL, missing_charset_list_return is set to NULL,
1802
and missing_charset_count_return
1804
If fonts exist for all of the charsets required by the current locale,
1808
missing_charset_list_return is set to NULL,
1809
and missing_charset_count_return is set to zero.
1811
If no font exists for one or more of the required charsets,
1813
sets missing_charset_list_return to a
1814
list of one or more null-terminated charset names for which no font exists
1815
and sets missing_charset_count_return to the number of missing fonts.
1816
The charsets are from the list of the required charsets for
1817
the encoding of the locale and do not include any charsets to which Xlib
1818
may be able to remap a required charset.
1820
If no font exists for any of the required charsets
1821
or if the locale definition in Xlib requires that a font exist
1822
for a particular charset and a font is not found for that charset,
1831
When an Xmb/wc drawing or measuring function is called with an
1833
that has missing charsets, some characters in the locale will not be
1835
If def_string_return is non-NULL,
1837
returns a pointer to a string that represents the glyphs
1838
that are drawn with this
1840
when the charsets of the available fonts do not include all font glyphs
1841
required to draw a codepoint.
1842
The string does not necessarily consist of valid characters
1843
in the current locale and is not necessarily drawn with
1844
the fonts loaded for the font set,
1845
but the client can draw and measure the default glyphs
1846
by including this string in a string being drawn or measured with the
1849
If the string returned to def_string_return is the empty string ("\^"),
1850
no glyphs are drawn, and the escapement is zero.
1851
The returned string is null-terminated.
1852
It is owned by Xlib and should not be modified or freed by the client.
1853
It will be freed by a call to
1857
Until freed, its contents will not be modified by Xlib.
1859
The client is responsible for constructing an error message from the
1860
missing charset and default string information and may choose to continue
1861
operation in the case that some fonts did not exist.
1865
and missing charset list should be freed with
1868
.PN XFreeStringList ,
1870
The client-supplied base_font_name_list may be freed
1871
by the client after calling
1872
.PN XCreateFontSet .
1877
structures and full font names given an
1880
.PN XFontsOfFontSet .
1881
.IN "XFontsOfFontSet" "" "@DEF@"
1884
int XFontsOfFontSet\^(\^\fIfont_set\fP\^, \fIfont_struct_list_return\fP\^, \fIfont_name_list_return\fP\^)
1886
XFontSet \fIfont_set\fP\^;
1888
XFontStruct ***\fIfont_struct_list_return\fP\^;
1890
char ***\fIfont_name_list_return\fP\^;
1892
.IP \fIfont_set\fP 1i
1893
Specifies the font set.
1894
.IP \fIfont_struct_list_return\fP 1i
1895
Returns the list of font structs.
1896
.IP \fIfont_name_list_return\fP 1i
1897
Returns the list of font names.
1902
function returns a list of one or more
1904
and font names for the fonts used by the Xmb and Xwc layers
1905
for the given font set.
1906
A list of pointers to the
1908
structures is returned to font_struct_list_return.
1909
A list of pointers to null-terminated, fully specified font name strings
1910
in the locale of the font set is returned to font_name_list_return.
1911
The font_name_list order corresponds to the font_struct_list order.
1914
structures and font names is returned as the value of the function.
1916
Because it is not guaranteed that a given character will be imaged using a
1918
there is no provision for mapping a character or default string
1919
to the font properties, font ID, or direction hint for the font
1921
The client may access the
1923
list to obtain these values for all the fonts currently in use.
1925
Xlib does not guarantee that fonts are loaded from the server
1926
at the creation of an
1928
Xlib may choose to cache font data, loading it only as needed to draw text
1929
or compute text dimensions.
1930
Therefore, existence of the per_char metrics in the
1935
Also, note that all properties in the
1937
structures are in the STRING encoding.
1941
and font name lists are owned by Xlib
1942
and should not be modified or freed by the client.
1943
They will be freed by a call to
1947
Until freed, their contents will not be modified by Xlib.
1950
To obtain the base font name list and the selected font name list given an
1953
.PN XBaseFontNameListOfFontSet .
1954
.IN "XBaseFontNameListOfFontSet" "" "@DEF@"
1957
char *XBaseFontNameListOfFontSet\^(\^\fIfont_set\fP\^)
1959
XFontSet \fIfont_set\fP\^;
1961
.IP \fIfont_set\fP 1i
1962
Specifies the font set.
1966
.PN XBaseFontNameListOfFontSet
1967
function returns the original base font name list supplied
1968
by the client when the
1971
A null-terminated string containing a list of
1972
comma-separated font names is returned
1973
as the value of the function.
1974
White space may appear immediately on either side of separating commas.
1978
obtained an XLFD name from the font properties for the font specified
1979
by a non-XLFD base name, the
1980
.PN XBaseFontNameListOfFontSet
1981
function will return the XLFD name instead of the non-XLFD base name.
1983
The base font name list is owned by Xlib and should not be modified or
1984
freed by the client.
1985
It will be freed by a call to
1989
Until freed, its contents will not be modified by Xlib.
1992
To obtain the locale name given an
1995
.PN XLocaleOfFontSet .
1996
.IN "XLocaleOfFontSet" "" "@DEF@"
1999
char *XLocaleOfFontSet\^(\^\fIfont_set\fP\^)
2001
XFontSet \fIfont_set\fP\^;
2003
.IP \fIfont_set\fP 1i
2004
Specifies the font set.
2008
.PN XLocaleOfFontSet
2010
returns the name of the locale bound to the specified
2012
as a null-terminated string.
2014
The returned locale name string is owned by Xlib
2015
and should not be modified or freed by the client.
2016
It may be freed by a call to
2020
Until freed, it will not be modified by Xlib.
2025
function is a convenience function for freeing an output context.
2027
also frees its associated
2029
if the output context was created by
2030
.PN XCreateFontSet .
2031
.IN "XFreeFontSet" "" "@DEF@"
2034
void XFreeFontSet\^(\^\fIdisplay\fP\^, \fIfont_set\fP\^)
2036
Display *\fIdisplay\fP\^;
2038
XFontSet \fIfont_set\fP\^;
2040
.IP \fIdisplay\fP 1i
2041
Specifies the connection to the X server.
2042
.IP \fIfont_set\fP 1i
2043
Specifies the font set.
2048
function frees the specified font set.
2049
The associated base font name list, font name list,
2052
.PN XFontSetExtents ,
2055
Obtaining Font Set Metrics
2057
\*(SN Obtaining Font Set Metrics
2060
Metrics for the internationalized text drawing functions
2061
are defined in terms of a primary draw direction,
2062
which is the default direction in which the character origin advances
2063
for each succeeding character in the string.
2064
The Xlib interface is currently defined to support only a left-to-right
2065
primary draw direction.
2066
The drawing origin is the position passed to the drawing function
2067
when the text is drawn.
2068
The baseline is a line drawn through the drawing origin parallel
2069
to the primary draw direction.
2070
Character ink is the pixels painted in the foreground color
2071
and does not include interline or intercharacter spacing
2072
or image text background pixels.
2074
The drawing functions are allowed to implement implicit text
2075
directionality control, reversing the order in which characters are
2076
rendered along the primary draw direction in response to locale-specific
2077
lexical analysis of the string.
2079
Regardless of the character rendering order,
2080
the origins of all characters are on the primary draw direction side
2081
of the drawing origin.
2082
The screen location of a particular character image may be determined with
2083
.PN XmbTextPerCharExtents
2085
.PN XwcTextPerCharExtents .
2087
The drawing functions are allowed to implement context-dependent
2088
rendering, where the glyphs drawn for a string are not simply a
2089
concatenation of the glyphs that represent each individual character.
2090
A string of two characters drawn with
2092
may render differently than if the two characters
2093
were drawn with separate calls to
2095
If the client appends or inserts a character
2096
in a previously drawn string,
2097
the client may need to redraw some adjacent characters
2098
to obtain proper rendering.
2101
To find out about direction-dependent rendering, use
2102
.PN XDirectionalDependentDrawing .
2103
.IN "XDirectionalDependentDrawing" "" "@DEF@"
2106
Bool XDirectionalDependentDrawing\^(\^\fIfont_set\fP\^)
2108
XFontSet \fIfont_set\fP\^;
2110
.IP \fIfont_set\fP 1i
2111
Specifies the font set.
2115
.PN XDirectionalDependentDrawing
2118
if the drawing functions implement implicit text directionality;
2119
otherwise, it returns
2123
To find out about context-dependent rendering, use
2124
.PN XContextualDrawing .
2125
.IN "XContextualDrawing" "" "@DEF@"
2128
Bool XContextualDrawing\^(\^\fIfont_set\fP\^)
2130
XFontSet \fIfont_set\fP\^;
2132
.IP \fIfont_set\fP 1i
2133
Specifies the font set.
2137
.PN XContextualDrawing
2140
if text drawn with the font set might include context-dependent drawing;
2141
otherwise, it returns
2145
To find out about context-dependent or direction-dependent rendering, use
2146
.PN XContextDependentDrawing .
2147
.IN "XContextDependentDrawing" "" "@DEF@"
2150
Bool XContextDependentDrawing\^(\^\fIfont_set\fP\^)
2152
XFontSet \fIfont_set\fP\^;
2154
.IP \fIfont_set\fP 1i
2155
Specifies the font set.
2159
.PN XContextDependentDrawing
2162
if the drawing functions implement implicit text directionality or
2163
if text drawn with the font_set might include context-dependent drawing;
2164
otherwise, it returns
2167
The drawing functions do not interpret newline, tab, or other control
2169
The behavior when nonprinting characters other than space are drawn
2170
is implementation-dependent.
2171
It is the client's responsibility to interpret control characters
2174
The maximum character extents for the fonts that are used by the text
2175
drawing layers can be accessed by the
2178
.IN "XFontSetExtents" "" "@DEF@"
2184
XRectangle max_ink_extent; /* over all drawable characters */
2185
XRectangle max_logical_extent; /* over all drawable characters */
2191
structures used to return font set metrics are the usual Xlib screen-oriented
2193
with x, y giving the upper left corner, and width and height always positive.
2195
The max_ink_extent member gives the maximum extent, over all drawable characters, of
2196
the rectangles that bound the character glyph image drawn in the
2197
foreground color, relative to a constant origin.
2202
for detailed semantics.
2204
The max_logical_extent member gives the maximum extent,
2205
over all drawable characters, of the rectangles
2206
that specify minimum spacing to other graphical features,
2207
relative to a constant origin.
2208
Other graphical features drawn by the client, for example,
2209
a border surrounding the text, should not intersect this rectangle.
2210
The max_logical_extent member should be used to compute minimum
2211
interline spacing and the minimum area that must be allowed
2212
in a text field to draw a given number of arbitrary characters.
2214
Due to context-dependent rendering,
2215
appending a given character to a string may change
2216
the string's extent by an amount other than that character's
2219
The rectangles for a given character in a string can be obtained from
2220
.PN XmbPerCharExtents
2222
.PN XwcPerCharExtents .
2225
To obtain the maximum extents structure given an
2228
.PN XExtentsOfFontSet .
2229
.IN "XExtentsOfFontSet" "" "@DEF@"
2232
XFontSetExtents *XExtentsOfFontSet\^(\^\fIfont_set\fP\^)
2234
XFontSet \fIfont_set\fP\^;
2236
.IP \fIfont_set\fP 1i
2237
Specifies the font set.
2241
.PN XExtentsOfFontSet
2244
structure for the fonts used by the Xmb and Xwc layers
2245
for the given font set.
2249
structure is owned by Xlib and should not be modified
2250
or freed by the client.
2251
It will be freed by a call to
2255
Until freed, its contents will not be modified by Xlib.
2258
To obtain the escapement in pixels of the specified text as a value,
2260
.PN XmbTextEscapement
2262
.PN XwcTextEscapement .
2263
.IN "XmbTextEscapement" "" "@DEF@"
2264
.IN "XwcTextEscapement" "" "@DEF@"
2267
int XmbTextEscapement\^(\^\fIfont_set\fP\^, \fIstring\fP\^, \fInum_bytes\fP\^)
2269
XFontSet \fIfont_set\fP\^;
2271
char *\fIstring\fP\^;
2273
int \fInum_bytes\fP\^;
2276
int XwcTextEscapement\^(\^\fIfont_set\fP\^, \fIstring\fP\^, \fInum_wchars\fP\^)
2278
XFontSet \fIfont_set\fP\^;
2280
wchar_t *\fIstring\fP\^;
2282
int \fInum_wchars\fP\^;
2284
.IP \fIfont_set\fP 1i
2285
Specifies the font set.
2287
Specifies the character string.
2288
.IP \fInum_bytes\fP 1i
2289
Specifies the number of bytes in the string argument.
2290
.IP \fInum_wchars\fP 1i
2291
Specifies the number of characters in the string argument.
2295
.PN XmbTextEscapement
2297
.PN XwcTextEscapement
2298
functions return the escapement in pixels of the specified string as a value,
2299
using the fonts loaded for the specified font set.
2300
The escapement is the distance in pixels in the primary draw
2301
direction from the drawing origin to the origin of the next character to
2302
be drawn, assuming that the rendering of the next character is not
2303
dependent on the supplied string.
2305
Regardless of the character rendering order,
2306
the escapement is always positive.
2309
To obtain the overall_ink_return and overall_logical_return arguments,
2310
the overall bounding box of the string's image, and a logical bounding box,
2314
.PN XwcTextExtents .
2315
.IN "XmbTextExtents" "" "@DEF@"
2316
.IN "XwcTextExtents" "" "@DEF@"
2319
int XmbTextExtents\^(\^\fIfont_set\fP\^, \fIstring\fP\^, \fInum_bytes\fP\^, \fIoverall_ink_return\fP\^, \fIoverall_logical_return\fP\^)
2321
XFontSet \fIfont_set\fP\^;
2323
char *\fIstring\fP\^;
2325
int \fInum_bytes\fP\^;
2327
XRectangle *\fIoverall_ink_return\fP\^;
2329
XRectangle *\fIoverall_logical_return\fP\^;
2332
int XwcTextExtents\^(\^\fIfont_set\fP\^, \fIstring\fP\^, \fInum_wchars\fP\^,
2333
\fIoverall_ink_return\fP\^, \fIoverall_logical_return\fP\^)
2335
XFontSet \fIfont_set\fP\^;
2337
wchar_t *\fIstring\fP\^;
2339
int \fInum_wchars\fP\^;
2341
XRectangle *\fIoverall_ink_return\fP\^;
2343
XRectangle *\fIoverall_logical_return\fP\^;
2345
.IP \fIfont_set\fP 1i
2346
Specifies the font set.
2348
Specifies the character string.
2349
.IP \fInum_bytes\fP 1i
2350
Specifies the number of bytes in the string argument.
2351
.IP \fInum_wchars\fP 1i
2352
Specifies the number of characters in the string argument.
2354
.IP \fIoverall_ink_return\fP 1i
2355
Returns the overall ink \*(Ov.
2356
.IP \fIoverall_logical_return\fP 1i
2357
Returns the overall logical \*(Ov.
2364
functions set the components of the specified overall_ink_return and
2365
overall_logical_return
2366
arguments to the overall bounding box of the string's image
2367
and a logical bounding box for spacing purposes, respectively.
2368
They return the value returned by
2369
.PN XmbTextEscapement
2371
.PN XwcTextEscapement .
2372
These metrics are relative to the drawing origin of the string,
2373
using the fonts loaded for the specified font set.
2375
If the overall_ink_return argument is non-NULL,
2376
it is set to the bounding box of the string's character ink.
2377
The overall_ink_return for a nondescending, horizontally drawn
2378
Latin character is conventionally entirely above the baseline;
2379
that is, overall_ink_return.height <= \-overall_ink_return.y.
2380
The overall_ink_return for a nonkerned character
2381
is entirely at, and to the right of, the origin;
2382
that is, overall_ink_return.x >= 0.
2383
A character consisting of a single pixel at the origin would set
2384
overall_ink_return fields y = 0, x = 0, width = 1, and height = 1.
2386
If the overall_logical_return argument is non-NULL,
2387
it is set to the bounding box that provides minimum spacing
2388
to other graphical features for the string.
2389
Other graphical features, for example, a border surrounding the text,
2390
should not intersect this rectangle.
2394
has missing charsets,
2395
metrics for each unavailable character are taken
2396
from the default string returned by
2398
so that the metrics represent the text as it will actually be drawn.
2399
The behavior for an invalid codepoint is undefined.
2401
To determine the effective drawing origin for a character in a drawn string,
2402
the client should call
2403
.PN XmbTextPerCharExtents
2404
on the entire string, then on the character,
2405
and subtract the x values of the returned
2406
rectangles for the character.
2407
This is useful to redraw portions of a line of text
2408
or to justify words, but for context-dependent rendering,
2409
the client should not assume that it can redraw the character by itself
2410
and get the same rendering.
2413
To obtain per-character information for a text string,
2415
.PN XmbTextPerCharExtents
2417
.PN XwcTextPerCharExtents .
2418
.IN "XmbTextPerCharExtents" "" "@DEF@"
2419
.IN "XwcTextPerCharExtents" "" "@DEF@"
2422
Status XmbTextPerCharExtents\^(\^\fIfont_set\fP\^, \fIstring\fP\^, \fInum_bytes\fP\^, \fIink_array_return\fP\^,
2424
\fIlogical_array_return\fP\^, \fIarray_size\fP\^, \fInum_chars_return\fP\^, \fIoverall_ink_return\fP\^, \fIoverall_logical_return\fP\^)
2426
XFontSet \fIfont_set\fP\^;
2428
char *\fIstring\fP\^;
2430
int \fInum_bytes\fP\^;
2432
XRectangle *\fIink_array_return\fP\^;
2434
XRectangle *\fIlogical_array_return\fP\^;
2436
int \fIarray_size\fP\^;
2438
int *\fInum_chars_return\fP\^;
2440
XRectangle *\fIoverall_ink_return\fP\^;
2442
XRectangle *\fIoverall_logical_return\fP\^;
2445
Status XwcTextPerCharExtents\^(\^\fIfont_set\fP\^, \fIstring\fP\^, \fInum_wchars\fP\^, \fIink_array_return\fP\^,
2447
\fIlogical_array_return\fP\^, \fIarray_size\fP\^, \fInum_chars_return\fP\^, \fIoverall_ink_return\fP\^, \fIoverall_ink_return\fP\^)
2449
XFontSet \fIfont_set\fP\^;
2451
wchar_t *\fIstring\fP\^;
2453
int \fInum_wchars\fP\^;
2455
XRectangle *\fIink_array_return\fP\^;
2457
XRectangle *\fIlogical_array_return\fP;
2459
int \fIarray_size\fP\^;
2461
int *\fInum_chars_return\fP\^;
2463
XRectangle *\fIoverall_ink_return\fP\^;
2465
XRectangle *\fIoverall_logical_return\fP\^;
2467
.IP \fIfont_set\fP 1i
2468
Specifies the font set.
2470
Specifies the character string.
2471
.IP \fInum_bytes\fP 1i
2472
Specifies the number of bytes in the string argument.
2473
.IP \fInum_wchars\fP 1i
2474
Specifies the number of characters in the string argument.
2475
.IP \fIink_array_return\fP 1i
2476
Returns the ink dimensions for each character.
2477
.IP \fIlogical_array_return\fP 1i
2478
Returns the logical dimensions for each character.
2479
.IP \fIarray_size\fP 1i
2480
Specifies the size of ink_array_return and logical_array_return.
2481
The caller must pass in arrays of this size.
2482
.IP \fInum_chars_return\fP 1i
2483
Returns the number of characters in the string argument.
2484
.ds Ov extents of the entire string
2485
.IP \fIoverall_ink_return\fP 1i
2486
Returns the overall ink \*(Ov.
2487
.IP \fIoverall_logical_return\fP 1i
2488
Returns the overall logical \*(Ov.
2492
.PN XmbTextPerCharExtents
2494
.PN XwcTextPerCharExtents
2495
functions return the text dimensions of each character of the specified text,
2496
using the fonts loaded for the specified font set.
2497
Each successive element of ink_array_return and logical_array_return
2498
is set to the successive character's drawn metrics,
2499
relative to the drawing origin of the string and one
2501
for each character in the supplied text string.
2502
The number of elements of ink_array_return and logical_array_return
2503
that have been set is returned to num_chars_return.
2505
Each element of ink_array_return is set to the bounding box
2506
of the corresponding character's drawn foreground color.
2507
Each element of logical_array_return is set to the bounding box
2508
that provides minimum spacing to other graphical features
2509
for the corresponding character.
2510
Other graphical features should not intersect any of the
2511
logical_array_return rectangles.
2515
represents the effective drawing dimensions of the character,
2516
regardless of the number of font glyphs that are used to draw
2517
the character or the direction in which the character is drawn.
2518
If multiple characters map to a single character glyph,
2519
the dimensions of all the
2521
of those characters are the same.
2525
has missing charsets, metrics for each unavailable
2526
character are taken from the default string returned by
2528
so that the metrics represent the text as it will actually be drawn.
2529
The behavior for an invalid codepoint is undefined.
2531
If the array_size is too small for the number of characters in the
2532
supplied text, the functions return zero
2533
and num_chars_return is set to the number of rectangles required.
2534
Otherwise, the functions return a nonzero value.
2536
If the overall_ink_return or overall_logical_return argument is non-NULL,
2537
.PN XmbTextPerCharExtents
2539
.PN XwcTextPerCharExtents
2540
return the maximum extent of the string's metrics to overall_ink_return
2541
or overall_logical_return, as returned by
2544
.PN XwcTextExtents .
2546
Drawing Text Using Font Sets
2548
\*(SN Drawing Text Using Font Sets
2551
The functions defined in this section
2552
draw text at a specified location in a drawable.
2553
They are similar to the functions
2557
.PN XDrawImageString
2558
except that they work with font sets instead of single fonts
2559
and interpret the text based on the locale of the font set
2560
instead of treating the bytes of the string as direct font indexes.
2561
See section 8.6 for details of the use of Graphics Contexts (GCs)
2562
and possible protocol errors.
2566
characters prior to the offending character may have been drawn.
2568
The text is drawn using the fonts loaded for the specified font set;
2569
the font in the GC is ignored and may be modified by the functions.
2570
No validation that all fonts conform to some width rule is performed.
2576
use the following structures:
2578
.IN "XmbTextItem" "" "@DEF@"
2584
char *chars; /* pointer to string */
2585
int nchars; /* number of bytes */
2586
int delta; /* pixel delta between strings */
2587
XFontSet font_set; /* fonts, None means don't change */
2591
.IN "XwcTextItem" "" "@DEF@"
2596
wchar_t *chars; /* pointer to wide char string */
2597
int nchars; /* number of wide characters */
2598
int delta; /* pixel delta between strings */
2599
XFontSet font_set; /* fonts, None means don't change */
2605
To draw text using multiple font sets in a given drawable, use
2609
.IN "XmbDrawText" "" "@DEF@"
2610
.IN "XwcDrawText" "" "@DEF@"
2613
void XmbDrawText\^(\^\fIdisplay\fP\^, \fId\fP\^, \fIgc\fP\^, \fIx\fP\^, \fIy\fP\^, \fIitems\fP\^, \fInitems\fP\^)
2615
Display *\fIdisplay\fP\^;
2621
int \fIx\fP\^, \fIy\fP\^;
2623
XmbTextItem *\fIitems\fP\^;
2628
void XwcDrawText\^(\^\fIdisplay\fP\^, \fId\fP\^, \fIgc\fP\^, \fIx\fP\^, \fIy\fP\^, \fIitems\fP\^, \fInitems\fP\^)
2630
Display *\fIdisplay\fP\^;
2636
int \fIx\fP\^, \fIy\fP\^;
2638
XwcTextItem *\fIitems\fP\^;
2642
.IP \fIdisplay\fP 1i
2643
Specifies the connection to the X server.
2645
Specifies the drawable.
2653
Specify the x and y coordinates\*(Xy.
2655
Specifies an array of text items.
2657
Specifies the number of text items in the array.
2664
functions allow complex spacing and font set shifts between text strings.
2665
Each text item is processed in turn, with the origin of a text
2666
element advanced in the primary draw direction by the escapement of the
2668
A text item delta specifies an additional escapement of the text item
2669
drawing origin in the primary draw direction.
2670
A font_set member other than
2672
in an item causes the font set to be used for this and subsequent text items
2673
in the text_items list.
2674
Leading text items with a font_set member set to
2681
do not perform any context-dependent rendering between text segments.
2682
Clients may compute the drawing metrics by passing each text segment to
2687
.PN XmbTextPerCharExtents
2689
.PN XwcTextPerCharExtents .
2692
has missing charsets, each unavailable character is drawn
2693
with the default string returned by
2694
.PN XCreateFontSet .
2695
The behavior for an invalid codepoint is undefined.
2698
To draw text using a single font set in a given drawable, use
2702
.IN "XmbDrawString" "" "@DEF@"
2703
.IN "XwcDrawString" "" "@DEF@"
2706
void XmbDrawString\^(\^\fIdisplay\fP\^, \fId\fP\^, \fIfont_set\fP\^, \fIgc\fP\^, \fIx\fP\^, \fIy\fP\^, \fIstring\fP\^, \fInum_bytes\fP\^)
2708
Display *\fIdisplay\fP\^;
2712
XFontSet \fIfont_set\fP\^;
2716
int \fIx\fP\^, \fIy\fP\^;
2718
char *\fIstring\fP\^;
2720
int \fInum_bytes\fP\^;
2723
void XwcDrawString\^(\^\fIdisplay\fP\^, \fId\fP\^, \fIfont_set\fP\^, \fIgc\fP\^, \fIx\fP\^, \fIy\fP\^, \fIstring\fP\^, \fInum_wchars\fP\^)
2725
Display *\fIdisplay\fP\^;
2729
XFontSet \fIfont_set\fP\^;
2733
int \fIx\fP\^, \fIy\fP\^;
2735
wchar_t *\fIstring\fP\^;
2737
int \fInum_wchars\fP\^;
2739
.IP \fIdisplay\fP 1i
2740
Specifies the connection to the X server.
2742
Specifies the drawable.
2743
.IP \fIfont_set\fP 1i
2744
Specifies the font set.
2752
Specify the x and y coordinates\*(Xy.
2754
Specifies the character string.
2755
.IP \fInum_bytes\fP 1i
2756
Specifies the number of bytes in the string argument.
2757
.IP \fInum_wchars\fP 1i
2758
Specifies the number of characters in the string argument.
2765
functions draw the specified text with the foreground pixel.
2768
has missing charsets, each unavailable character is drawn
2769
with the default string returned by
2770
.PN XCreateFontSet .
2771
The behavior for an invalid codepoint is undefined.
2774
To draw image text using a single font set in a given drawable, use
2775
.PN XmbDrawImageString
2777
.PN XwcDrawImageString .
2778
.IN "XmbDrawImageString" "" "@DEF@"
2779
.IN "XwcDrawImageString" "" "@DEF@"
2782
void XmbDrawImageString\^(\^\fIdisplay\fP\^, \fId\fP\^, \fIfont_set\fP\^, \fIgc\fP\^, \fIx\fP\^, \fIy\fP\^, \fIstring\fP\^, \fInum_bytes\fP\^)
2784
Display *\fIdisplay\fP\^;
2788
XFontSet \fIfont_set\fP\^;
2792
int \fIx\fP\^, \fIy\fP\^;
2794
char *\fIstring\fP\^;
2796
int \fInum_bytes\fP\^;
2799
void XwcDrawImageString\^(\^\fIdisplay\fP\^, \fId\fP\^, \fIfont_set\fP\^, \fIgc\fP\^, \fIx\fP\^, \fIy\fP\^, \fIstring\fP\^, \fInum_wchars\fP\^)
2801
Display *\fIdisplay\fP\^;
2805
XFontSet \fIfont_set\fP\^;
2809
int \fIx\fP\^, \fIy\fP\^;
2811
wchar_t *\fIstring\fP\^;
2813
int \fInum_wchars\fP\^;
2815
.IP \fIdisplay\fP 1i
2816
Specifies the connection to the X server.
2818
Specifies the drawable.
2819
.IP \fIfont_set\fP 1i
2820
Specifies the font set.
2828
Specify the x and y coordinates\*(Xy.
2830
Specifies the character string.
2831
.IP \fInum_bytes\fP 1i
2832
Specifies the number of bytes in the string argument.
2833
.IP \fInum_wchars\fP 1i
2834
Specifies the number of characters in the string argument.
2838
.PN XmbDrawImageString
2840
.PN XwcDrawImageString
2841
functions fill a destination rectangle with the background pixel defined
2842
in the GC and then paint the text with the foreground pixel.
2843
The filled rectangle is the rectangle returned to overall_logical_return by
2847
for the same text and
2852
has missing charsets, each unavailable character is drawn
2853
with the default string returned by
2854
.PN XCreateFontSet .
2855
The behavior for an invalid codepoint is undefined.
2862
This section provides discussions of the following X Input Method
2865
Input method overview
2867
Input method management
2869
Input method functions
2873
Input context functions
2875
Input context values
2877
Input method callback semantics
2881
Getting keyboard input
2883
Input method conventions
2885
Input Method Overview
2887
\*(SN Input Method Overview
2890
This section provides definitions for terms and concepts used
2891
for internationalized text input and a brief overview of the
2892
intended use of the mechanisms provided by Xlib.
2894
A large number of languages in the world use alphabets
2895
consisting of a small set of symbols (letters) to form words.
2896
To enter text into a computer in an alphabetic language,
2897
a user usually has a keyboard on which there exist key symbols corresponding
2899
Sometimes, a few characters of an alphabetic language are missing
2901
Many computer users who speak a Latin-alphabet-based language
2902
only have an English-based keyboard.
2903
They need to hit a combination of keystrokes
2904
to enter a character that does not exist directly on the keyboard.
2905
A number of algorithms have been developed for entering such characters.
2906
These are known as European input methods, compose input methods,
2907
or dead-key input methods.
2909
Japanese is an example of a language with a phonetic symbol set,
2910
where each symbol represents a specific sound.
2911
There are two phonetic symbol sets in Japanese: Katakana and Hiragana.
2913
Katakana is used for words that are of foreign origin,
2914
and Hiragana is used for writing native Japanese words.
2915
Collectively, the two systems are called Kana.
2916
Each set consists of 48 characters.
2918
Korean also has a phonetic symbol set, called Hangul.
2919
Each of the 24 basic phonetic symbols (14 consonants and 10 vowels)
2920
represents a specific sound.
2921
A syllable is composed of two or three parts:
2922
the initial consonants, the vowels, and the optional last consonants.
2924
syllables can be treated as the basic units on which text processing is done.
2926
a delete operation may work on a phonetic symbol or a syllable.
2927
Korean code sets include several thousands of these syllables.
2928
A user types the phonetic symbols that make up the syllables of the words
2930
The display may change as each phonetic symbol is entered.
2932
when the second phonetic symbol of a syllable is entered,
2933
the first phonetic symbol may change its shape and size.
2934
Likewise, when the third phonetic symbol is entered,
2935
the first two phonetic symbols may change their shape and size.
2937
Not all languages rely solely on alphabetic or phonetic systems.
2938
Some languages, including Japanese and Korean, employ an
2939
ideographic writing system.
2940
In an ideographic system, rather than taking a small set of
2941
symbols and combining them in different ways to create words,
2942
each word consists of one unique symbol (or, occasionally, several symbols).
2943
The number of symbols can be very large:
2944
approximately 50,000 have been identified in Hanzi,
2945
the Chinese ideographic system.
2947
Two major aspects of ideographic systems impact their use with computers.
2948
First, the standard computer character sets in Japan, China, and Korea
2949
include roughly 8,000 characters,
2950
while sets in Taiwan have between 15,000 and 30,000 characters.
2951
This makes it necessary to use more than one byte to represent a character.
2952
Second, it obviously is impractical to have a keyboard that includes
2953
all of a given language's ideographic symbols.
2954
Therefore, a mechanism is required for entering characters
2955
so that a keyboard with a reasonable number of keys can be used.
2956
Those input methods are usually based on phonetics,
2957
but there also exist methods based on the graphical properties of
2960
In Japan, both Kana and the ideographic system Kanji are used.
2961
In Korea, Hangul and sometimes the ideographic system Hanja are used.
2962
Now consider entering ideographs in Japan, Korea, China, and Taiwan.
2964
In Japan, either Kana or English characters are typed and then a region
2965
is selected (sometimes automatically) for conversion to Kanji.
2966
Several Kanji characters may have the same phonetic representation.
2967
If that is the case with the string entered,
2968
a menu of characters is presented and
2969
the user must choose the appropriate one.
2970
If no choice is necessary or a preference has been established,
2971
the input method does the substitution directly.
2972
When Latin characters are converted to Kana or Kanji,
2973
it is called a romaji conversion.
2975
In Korea, it is usually acceptable to keep Korean text in Hangul form,
2976
but some people may choose to write Hanja-originated words in Hanja
2977
rather than in Hangul.
2978
To change Hangul to Hanja,
2979
the user selects a region for conversion
2980
and then follows the same basic method as that described for Japanese.
2982
Probably because there are well-accepted phonetic writing systems
2983
for Japanese and Korean,
2984
computer input methods in these countries for entering ideographs
2985
are fairly standard.
2986
Keyboard keys have both English characters and phonetic symbols
2987
engraved on them, and the user can switch between the two sets.
2989
The situation is different for Chinese.
2990
While there is a phonetic system called Pinyin promoted by authorities,
2991
there is no consensus for entering Chinese text.
2992
Some vendors use a phonetic decomposition (Pinyin or another),
2993
others use ideographic decomposition of Chinese words,
2994
with various implementations and keyboard layouts.
2995
There are about 16 known methods, none of which is a clear standard.
2997
Also, there are actually two ideographic sets used:
2998
Traditional Chinese (the original written Chinese)
2999
and Simplified Chinese.
3001
the People's Republic of China launched a campaign to simplify
3002
some ideographic characters and eliminate redundancies altogether.
3004
characters would be streamlined every five years.
3005
Characters have been revised several times now,
3006
resulting in the smaller, simpler set that makes up Simplified Chinese.
3008
Input Method Architecture
3010
\*(SN Input Method Architecture
3013
As shown in the previous section,
3014
there are many different input methods in use today,
3015
each varying with language, culture, and history.
3016
A common feature of many input methods is that the user may type
3017
multiple keystrokes to compose a single character (or set
3019
The process of composing characters from keystrokes is called
3021
It may require complex algorithms and large dictionaries
3022
involving substantial computer resources.
3024
Input methods may require one or more areas in which to show the
3025
feedback of the actual keystrokes, to propose disambiguation to the
3026
user, to list dictionaries, and so on.
3027
The input method areas of concern are as follows:
3029
The \fIstatus\fP area is a logical extension of the
3030
LEDs that exist on the physical keyboard.
3031
It is a window that is intended to present the internal state
3032
of the input method that is critical to the user.
3033
The status area may consist of text data and bitmaps or some combination.
3035
The \fIpreedit\fP area displays the
3036
intermediate text for those languages that are composing prior to
3037
the client handling the data.
3039
The \fIauxiliary\fP area is used for pop-up menus and customizing
3040
dialogs that may be required for an input method.
3041
There may be multiple auxiliary areas for an input method.
3042
Auxiliary areas are managed by the input method independent of the client.
3043
Auxiliary areas are assumed to be separate dialogs,
3044
which are maintained by the input method.
3046
There are various user interaction styles used for preediting.
3047
The ones supported by Xlib are as follows:
3049
For \fIon-the-spot\fP input methods,
3050
preediting data will be displayed directly in the application window.
3051
Application data is moved to allow preedit data to appear
3052
at the point of insertion.
3054
\fIOver-the-spot\fP preediting means that the data is displayed in
3055
a preedit window that is placed over the point of insertion.
3057
\fIOff-the-spot\fP preediting means that the preedit window is
3058
inside the application window but not at the point of insertion.
3059
Often, this type of window is placed at the bottom of the application window.
3061
\fIRoot-window\fP preediting refers to input methods that use a preedit
3062
window that is the child of
3065
It would require a lot of computing resources if portable applications
3066
had to include input methods for all the languages in the world.
3068
a goal of the Xlib design is to allow an application
3069
to communicate with an input method placed in a separate process.
3070
Such a process is called an \fIinput server\fP.
3071
The server to which the application should connect is dependent on
3072
the environment when the application is started up,
3073
that is, the user language and the actual encoding to be used for it.
3074
The input method connection is said to be \fIlocale-dependent\fP.
3075
It is also user-dependent.
3076
For a given language, the user can choose, to some extent,
3077
the user interface style of input method (if choice is possible among
3080
Using an input server implies communication overhead,
3081
but applications can be migrated without relinking.
3082
Input methods can be implemented either as a
3083
stub communicating to an input server or as a local library.
3085
An input method may be based on a \fIfront-end\fP or a \fIback-end\fP
3087
In a front-end architecture,
3088
there are two separate connections to the X server:
3089
keystrokes go directly from the X server to the input method on
3090
one connection and other events to the regular client connection.
3091
The input method is then acting as a filter and sends composed strings
3093
A front-end architecture requires synchronization between the
3094
two connections to avoid lost key events or locking issues.
3096
In a back-end architecture,
3097
a single X server connection is used.
3098
A dispatching mechanism must decide on this channel to delegate appropriate
3099
keystrokes to the input method.
3101
it may retain a Help keystroke for its own purpose.
3102
In the case where the input method is a separate process (that is, a server),
3103
there must be a special communication protocol between the back-end client
3104
and the input server.
3106
A front-end architecture introduces synchronization issues
3107
and a filtering mechanism for noncharacter keystrokes
3108
(Function keys, Help, and so on).
3109
A back-end architecture sometimes implies more communication overhead
3110
and more process switching.
3111
If all three processes (X server, input server, client)
3112
are running on a single workstation,
3113
there are two process switches for each keystroke in a back-end
3115
but there is only one in a front-end architecture.
3117
The abstraction used by a client to communicate with an input method
3118
is an opaque data structure represented by the
3121
This data structure is returned by the
3123
function, which opens an input method on a given display.
3124
Subsequent operations on this data structure encapsulate all communication
3125
between client and input method.
3126
There is no need for an X client to use any networking library
3127
or natural language package to use an input method.
3129
A single input server may be used for one or more languages,
3130
supporting one or more encoding schemes.
3131
But the strings returned from an input method will always be encoded
3132
in the (single) locale associated with the
3138
\*(SN Input Contexts
3141
Xlib provides the ability to manage a multi-threaded state for text input.
3142
A client may be using multiple windows,
3143
each window with multiple text entry areas,
3144
and the user possibly switching among them at any time.
3145
The abstraction for representing the state of a particular input thread
3146
is called an \fIinput context\fP.
3147
The Xlib representation of an input context is an
3150
An input context is the abstraction retaining the state, properties,
3151
and semantics of communication between a client and an input method.
3152
An input context is a combination of an input method, a locale
3153
specifying the encoding of the character strings to be returned,
3154
a client window, internal state information,
3155
and various layout or appearance characteristics.
3156
The input context concept somewhat matches for input the graphics context
3157
abstraction defined for graphics output.
3159
One input context belongs to exactly one input method.
3160
Different input contexts may be associated with the same input method,
3161
possibly with the same client window.
3166
function, providing an
3168
argument and affiliating the input context to the input method
3170
When an input method is closed with
3172
all of its affiliated input contexts should not be used any more
3173
(and should preferably be destroyed before closing the input method).
3175
Considering the example of a client window with multiple text entry areas,
3176
the application programmer could, for example, choose to implement as follows:
3178
As many input contexts are created as text entry areas, and the client
3179
will get the input accumulated on each context each time it looks up
3182
A single context is created for a top-level window in the application.
3183
If such a window contains several text entry areas,
3184
each time the user moves to another text entry area,
3185
the client has to indicate changes in the context.
3187
A range of choices can be made by application designers to use
3188
either a single or multiple input contexts,
3189
according to the needs of their application.
3191
Getting Keyboard Input
3193
\*(SN Getting Keyboard Input
3196
To obtain characters from an input method,
3197
a client must call the function
3201
with an input context created from that input method.
3202
Both a locale and display are bound to an input method when it is opened,
3203
and an input context inherits this locale and display.
3204
Any strings returned by
3208
will be encoded in that locale.
3212
\*(SN Focus Management
3215
For each text entry area in which the
3220
there will be an associated input context.
3222
When the application focus moves to a text entry area,
3223
the application must set the input context focus to the
3224
input context associated with that area.
3225
The input context focus is set by calling
3227
with the appropriate input context.
3229
Also, when the application focus moves out of a text entry area, the
3230
application should unset the focus for the associated input context
3233
As an optimization, if
3235
is called successively on two different input contexts,
3236
setting the focus on the second
3237
will automatically unset the focus on the first.
3239
To set and unset the input context focus correctly,
3240
it is necessary to track application-level focus changes.
3241
Such focus changes do not necessarily correspond to X server focus changes.
3243
If a single input context
3244
is being used to do input for
3245
multiple text entry areas, it will also be necessary
3246
to set the focus window of the
3247
input context whenever the focus window changes
3248
(see section 13.5.6.3).
3252
\*(SN Geometry Management
3255
In most input method architectures
3256
(on-the-spot being the notable exception),
3257
the input method will perform the display of its own data.
3258
To provide better visual locality,
3259
it is often desirable to have the input method areas embedded within a client.
3261
the client may need to allocate space for an input method.
3262
Xlib provides support that allows the size and position of input method
3263
areas to be provided by a client.
3264
The input method areas that are supported for geometry management
3265
are the status area and the preedit area.
3267
The fundamental concept on which geometry management for input method windows
3268
is based is the proper division of responsibilities between the
3269
client (or toolkit) and the input method.
3270
The division of responsibilities is as follows:
3272
The client is responsible for the geometry of the input method window.
3274
The input method is responsible for the contents of the input method window.
3276
An input method is able to suggest a size to the client,
3277
but it cannot suggest a placement.
3278
Also the input method can only suggest a size.
3279
It does not determine the size,
3280
and it must accept the size it is given.
3282
Before a client provides geometry management for an input method,
3283
it must determine if geometry management is needed.
3284
The input method indicates the need for geometry management
3293
When a client has decided that it will provide geometry management
3294
for an input method,
3295
it indicates that decision by setting the
3300
After a client has established with the input method
3301
that it will do geometry management,
3302
the client must negotiate the geometry with the input method.
3303
The geometry is negotiated by the following steps:
3305
The client suggests an area to the input method by setting the
3307
value for that area.
3308
If the client has no constraints for the input method,
3309
it either will not suggest an area or will set the width and height to zero.
3310
Otherwise, it will set one of the values.
3312
The client will get the XIC value
3314
The input method will return its suggested size in this value.
3315
The input method should pay attention to any constraints suggested
3318
The client sets the XIC value
3320
to inform the input method of the geometry of its window.
3321
The client should try to honor the geometry requested by the input method.
3322
The input method must accept this geometry.
3324
Clients doing geometry management must be aware that setting other
3325
XIC values may affect the geometry desired by an input method.
3330
may change the geometry desired by the input method.
3332
The table of XIC values (see section 13.5.6)
3333
indicates the values that can cause the desired geometry to change
3335
It is the responsibility of the client to renegotiate the geometry
3336
of the input method window when it is needed.
3339
a geometry management callback is provided
3340
by which an input method can initiate a geometry change.
3344
\*(SN Event Filtering
3347
A filtering mechanism is provided to allow input methods
3348
to capture X events transparently to clients.
3349
It is expected that toolkits (or clients) using
3353
will call this filter at some point in the event processing mechanism
3354
to make sure that events needed by an input method can be filtered
3355
by that input method.
3357
If there were no filter,
3358
a client could receive and discard events that are necessary
3359
for the proper functioning of an input method.
3360
The following provides a few examples of such events:
3362
Expose events on preedit window in local mode.
3364
Events may be used by an input method to communicate with an input server.
3365
Such input server protocol-related events have to be intercepted
3366
if one does not want to disturb client code.
3368
Key events can be sent to a filter before they are bound
3369
to translations such as those the X Toolkit Intrinsics library provides.
3371
Clients are expected to get the XIC value
3373
and augment the event mask for the client window with that event mask.
3374
This mask may be zero.
3381
When an on-the-spot input method is implemented,
3382
only the client can insert or delete preedit data in place
3383
and possibly scroll existing text.
3384
This means that the echo of the keystrokes has to be achieved
3385
by the client itself, tightly coupled with the input method logic.
3387
When the user enters a keystroke,
3391
.PN XwcLookupString .
3392
At this point, in the on-the-spot case,
3393
the echo of the keystroke in the preedit has not yet been done.
3394
Before returning to the client logic that handles the input characters,
3395
the look-up function
3396
must call the echoing logic to insert the new keystroke.
3397
If the keystrokes entered so far make up a character,
3398
the keystrokes entered need to be deleted,
3399
and the composed character will be returned.
3400
Hence, what happens is that, while being called by client code,
3401
the input method logic has to call back to the client before it returns.
3402
The client code, that is, a callback procedure,
3403
is called from the input method logic.
3405
There are a number of cases where the input method logic has to
3406
call back the client.
3407
Each of those cases is associated with a well-defined callback action.
3408
It is possible for the client to specify, for each input context,
3409
what callback is to be called for each action.
3411
There are also callbacks provided for feedback of status information
3412
and a callback to initiate a geometry request for an input method.
3414
Visible Position Feedback Masks
3416
\*(SN Visible Position Feedback Masks
3419
In the on-the-spot input style, there is a problem when
3420
attempting to draw preedit strings that are longer than the
3421
available space. Once the display area is exceeded, it is not
3422
clear how best to display the preedit string.
3423
The visible position feedback masks of
3425
help resolve this problem by allowing the input method to specify hints that
3426
indicate the essential portions of the preedit string.
3427
For example, such hints can help developers implement
3428
scrolling of a long preedit string within a short preedit display area.
3430
Preedit String Management
3432
\*(SN Preedit String Management
3435
As highlighted before, the input method architecture provides
3436
preediting, which supports a type of preprocessor input composition.
3437
In this case, composition consists of interpreting a sequence
3438
of key events and returning a committed string via
3441
.PN XwcLookupString .
3442
This provides the basics for input methods.
3444
In addition to preediting based on key events, a general framework
3445
is provided to give a client that desires it more advanced preediting based
3446
on the text within the client. This framework is called
3447
\fIstring conversion\fP and is provided using XIC values.
3448
The fundamental concept of string conversion
3449
is to allow the input method to manipulate the client's
3450
text independent of any user preediting operation.
3452
The need for string conversion is based on
3453
language needs and input method capabilities.
3454
The following are some examples of string conversion:
3456
Transliteration conversion provides language-specific conversions
3457
within the input method.
3458
In the case of Korean input, users wish to convert a Hangul string
3459
into a Hanja string while in preediting, after preediting,
3460
or in other situations (for example, on a selected string).
3461
The conversion is triggered when the user
3462
presses a Hangul-to-Hanja key sequence (which may be input method specific).
3463
Sometimes the user may want to invoke the conversion after finishing
3464
preediting or on a user-selected string.
3465
Thus, the string to be converted is in an application buffer, not in
3466
the preedit area of the input method. The string conversion services
3467
allow the client to request this transliteration conversion from the
3469
There are many other transliteration conversions defined for
3470
various languages, for example, Kana-to-Kanji conversion in Japanese.
3472
The key to remember is that transliteration conversions are triggered
3473
at the request of the user and returned to the client
3474
immediately without affecting the preedit area of the input method.
3476
Reconversion of a previously committed string or
3477
a selected string is supported by many input methods as a
3478
convenience to the user.
3479
For example, a user tends to mistype the commit key while
3480
preediting. In that case, some input methods provide a special
3481
key sequence to request a ``reconvert'' operation on the
3482
committed string, similiar to the undo facility provided by most
3484
Another example is where the user is proofreading a document
3485
that has some misconversions from preediting and wants to correct
3486
the misconverted text. Such reconversion is again triggered
3487
by the user invoking some special action, but reconversions should
3488
not affect the state of the preedit area.
3490
Context-sensitive conversion is required for some languages
3491
and input methods that need to retrieve text that surrounds the
3492
current spot location (cursor position) of the client's buffer.
3493
Such text is needed when the preediting operation depends on
3494
some surrounding characters (usually preceding the spot location).
3496
in Thai language input, certain character sequences may be invalid and
3497
the input method may want to check whether characters constitute a
3498
valid word. Input methods that do such context-dependent
3499
checking need to retrieve the characters surrounding the current
3500
cursor position to obtain complete words.
3502
Unlike other conversions, this conversion is not explicitly
3503
requested by the user.
3504
Input methods that provide such context-sensitive conversion
3505
continuously need to request context from the client, and any change
3506
in the context of the spot location may affect such conversions.
3507
The client's context would be needed if the user moves the cursor
3508
and starts editing again.
3510
For this reason, an input method supporting this type of conversion
3511
should take notice of when the client calls
3515
which is usually an indication of a context change.
3517
Context-sensitive conversions just need a copy of the client's text,
3518
while other conversions replace the client's text with new text
3519
to achieve the reconversion or transliteration. Yet in all
3520
cases the result of a conversion, either immediately or via preediting,
3527
String conversion support is dependent on the availability of the
3528
.PN XNStringConversion
3530
.PN XNStringConversionCallback
3532
Because the input method may not support string conversions,
3533
clients have to query the availability of string conversion
3534
operations by checking the supported XIC values list by calling
3537
.PN XNQueryICValuesList
3540
The difference between these two values is whether the
3541
conversion is invoked by the client or the input method.
3543
.PN XNStringConversion
3544
XIC value is used by clients to request
3545
a string conversion from the input method. The client
3546
is responsible for determining which events are used
3547
to trigger the string conversion and whether the string to be
3548
converted should be copied or deleted. The type of conversion
3549
is determined by the input method; the client can only
3550
pass the string to be converted. The client is guaranteed that
3552
.PN XNStringConversionCallback
3553
will be issued when this value is set; thus, the client need
3554
only set one of these values.
3557
.PN XNStringConversionCallback
3558
XIC value is used by the client to notify the input method that
3559
it will accept requests from the input method for string conversion.
3560
If this value is set,
3561
it is the input method's responsibility to determine which
3562
events are used to trigger the string conversion.
3563
When such events occur, the input method issues a call to the
3564
client-supplied procedure to retrieve the string to be converted. The client's
3565
callback procedure is notified whether to copy or delete the string and
3566
is provided with hints as to the amount of text needed.
3568
.PN XIMStringConversionCallbackStruct
3569
specifies which text should be passed back to the input method.
3571
Finally, the input method may call the client's
3572
.PN XNStringConversionCallback
3573
procedure multiple times if the string returned from the callback is
3574
not sufficient to perform a successful conversion. The arguments
3575
to the client's procedure allow the input method to define a
3576
position (in character units) relative to the client's cursor position
3577
and the size of the text needed. By varying the position and size of
3578
the desired text in subsequent callbacks, the input method can retrieve
3582
Input Method Management
3584
\*(SN Input Method Management
3587
The interface to input methods might appear to be simply creating
3590
and freeing an input method
3592
However, input methods may
3593
require complex communication with input method servers (IM servers),
3596
If the X server, IM server, and X clients are started asynchronously,
3597
some clients may attempt to connect to the IM server before it is
3598
fully operational, and fail.
3599
Therefore, some mechanism is needed to allow clients to detect when an IM
3602
It is up to clients to decide what should be done when an IM server is
3603
not available (for example, wait, or use some other IM server).
3606
Some input methods may allow the underlying IM server to be switched.
3607
Such customization may be desired without restarting the entire client.
3609
To support management of input methods in these cases, the following
3610
functions are provided:
3614
.PN XRegisterIMInstantiateCallback
3616
This function allows clients to register a callback procedure
3617
to be called when Xlib detects that an IM server is up and available.
3622
A client calls this function as a result of the callback procedure
3629
These functions use the XIM and XIC values,
3630
.PN XNDestroyCallback ,
3632
to register a callback procedure to be called when Xlib detects that
3633
an IM server that was associated with an opened
3634
input method is no longer available.
3636
In addition, this function can be used to switch IM servers for those input
3637
methods that support such functionality. The IM value for switching IM
3638
servers is implementation-dependent; see the description below about
3639
switching IM servers.
3642
.PN XUnregisterIMInstantiateCallback
3644
This function removes a callback procedure registered by the client.
3648
Input methods that support switching of IM servers may exhibit some
3651
The input method will ensure that any new IM server supports any of the
3652
input styles being used by input contexts already associated with the
3654
However, the list of supported input styles may be different.
3657
Geometry management requests on previously created input contexts
3658
may be initiated by the new IM server.
3666
Some clients need to guarantee which keys can be used to escape from the
3667
input method, regardless of the input method state;
3668
for example, the client-specific Help key or the keys to move the
3670
The HotKey mechanism allows clients
3671
to specify a set of keys for this purpose. However, the input
3672
method might not allow clients to specify hot keys.
3673
Therefore, clients have to query support of hot keys by checking the
3674
supported XIC values list by calling
3677
.PN XNQueryICValuesList
3679
When the hot keys specified conflict with the key bindings of the
3680
input method, hot keys take precedence over the key bindings of the input
3684
Preedit State Operation
3686
\*(SN Preedit State Operation
3689
An input method may have several internal states, depending on its
3690
implementation and the locale. However, one state that is
3691
independent of locale and implementation is whether the input method
3692
is currently performing a preediting operation.
3693
Xlib provides the ability for an application to manage the preedit state
3694
programmatically. Two methods are provided for
3695
retrieving the preedit state of an input context.
3696
One method is to query the state by calling
3701
Another method is to receive notification whenever
3702
the preedit state is changed. To receive such notification,
3703
an application needs to register a callback by calling
3706
.PN XNPreeditStateNotifyCallback
3708
In order to change the preedit state programmatically, an application
3714
Availability of the preedit state is input method dependent. The input
3715
method may not provide the ability to set the state or to
3716
retrieve the state programmatically. Therefore, clients have to
3717
query availability of preedit state operations by checking the
3718
supported XIC values list by calling
3721
.PN XNQueryICValuesList
3724
Input Method Functions
3726
\*(SN Input Method Functions
3729
To open a connection, use
3731
.IN "XOpenIM" "" "@DEF@"
3734
XIM XOpenIM\^(\^\fIdisplay\fP\^, \fIdb\fP\^, \fIres_name\fP\^, \fIres_class\fP\^)
3736
Display *\fIdisplay\fP\^;
3738
XrmDatabase \fIdb\fP\^;
3740
char *\fIres_name\fP\^;
3742
char *\fIres_class\fP\^;
3744
.IP \fIdisplay\fP 1i
3745
Specifies the connection to the X server.
3747
Specifies a pointer to the resource database.
3748
.IP \fIres_name\fP 1i
3749
Specifies the full resource name of the application.
3750
.IP \fIres_class\fP 1i
3751
Specifies the full class name of the application.
3756
function opens an input method,
3757
matching the current locale and modifiers specification.
3758
Current locale and modifiers are bound to the input method at opening time.
3759
The locale associated with an input method cannot be changed dynamically.
3760
This implies that the strings returned by
3763
.PN XwcLookupString ,
3764
for any input context affiliated with a given input method,
3765
will be encoded in the locale current at the time the input method is opened.
3767
The specific input method to which this call will be routed
3768
is identified on the basis of the current locale.
3770
will identify a default input method corresponding to the
3772
That default can be modified using
3773
.PN XSetLocaleModifiers
3774
for the input method modifier.
3776
The db argument is the resource database to be used by the input method
3777
for looking up resources that are private to the input method.
3778
It is not intended that this database be used to look
3779
up values that can be set as IC values in an input context.
3781
no database is passed to the input method.
3783
The res_name and res_class arguments specify the resource name
3784
and class of the application.
3785
They are intended to be used as prefixes by the input method
3786
when looking up resources that are common to all input contexts
3787
that may be created for this input method.
3788
The characters used for resource names and classes must be in the
3789
X Portable Character Set.
3790
The resources looked up are not fully specified
3791
if res_name or res_class is NULL.
3793
The res_name and res_class arguments are not assumed to exist beyond
3796
The specified resource database is assumed to exist for the lifetime
3797
of the input method.
3800
returns NULL if no input method could be opened.
3803
To close a connection, use
3805
.IN "XCloseIM" "" "@DEF@"
3808
Status XCloseIM\^(\^\fIim\fP\^)
3813
Specifies the input method.
3818
function closes the specified input method.
3821
To set input method attributes, use
3823
.IN "XSetIMValues" "" "@DEF@"
3826
char * XSetIMValues\^(\^\fIim\fP\^, ...)
3831
Specifies the input method.
3832
.ds Al \ to set XIM values
3834
Specifies the variable-length argument list\*(Al.
3839
function presents a variable argument list programming interface
3840
for setting attributes of the specified input method.
3841
It returns NULL if it succeeds;
3843
it returns the name of the first argument that could not be set.
3844
Xlib does not attempt to set arguments from the supplied list that
3845
follow the failed argument;
3846
all arguments in the list preceding the failed argument have been set
3850
To query an input method, use
3852
.IN "XGetIMValues" "" "@DEF@"
3855
char * XGetIMValues\^(\^\fIim\fP\^, ...)
3860
Specifies the input method.
3861
.ds Al \ to get XIM values
3863
Specifies the variable length argument list\*(Al.
3868
function presents a variable argument list programming interface
3869
for querying properties or features of the specified input method.
3870
This function returns NULL if it succeeds;
3872
it returns the name of the first argument that could not be obtained.
3874
Each XIM value argument (following a name) must point to
3875
a location where the XIM value is to be stored.
3876
That is, if the XIM value is of type T,
3877
the argument must be of type T*.
3878
If T itself is a pointer type,
3881
allocates memory to store the actual data,
3882
and the client is responsible for freeing this data by calling
3884
with the returned pointer.
3887
To obtain the display associated with an input method, use
3889
.IN "XDisplayOfIM" "" "@DEF@"
3892
Display * XDisplayOfIM\^(\^\fIim\fP\^)
3897
Specifies the input method.
3902
function returns the display associated with the specified input method.
3905
To get the locale associated with an input method, use
3907
.IN "XLocaleOfIM" "" "@DEF@"
3910
char * XLocaleOfIM\^(\^\fIim\fP\^)
3915
Specifies the input method.
3920
function returns the locale associated with the specified input method.
3923
To register an input method instantiate callback, use
3924
.PN XRegisterIMInstantiateCallback .
3925
.IN "XRegisterIMInstantiateCallback" "" "@DEF@"
3928
Bool XRegisterIMInstantiateCallback\^(\^\fIdisplay\fP\^, \fIdb\fP\^, \fIres_name\fP\^, \fIres_class\fP\^, \fIcallback\fP\^, \fIclient_data\fP\^)
3930
Display *\fIdisplay\fP\^;
3932
XrmDatabase \fIdb\fP\^;
3934
char *\fIres_name\fP\^;
3936
char *\fIres_class\fP\^;
3938
XIMProc \fIcallback\fP\^;
3940
XPointer *\fIclient_data\fP\^;
3942
.IP \fIdisplay\fP 1i
3943
Specifies the connection to the X server.
3945
Specifies a pointer to the resource database.
3946
.IP \fIres_name\fP 1i
3947
Specifies the full resource name of the application.
3948
.IP \fIres_class\fP 1i
3949
Specifies the full class name of the application.
3950
.IP \fIcallback\fP 1i
3951
Specifies a pointer to the input method instantiate callback.
3952
.IP \fIclient_data\fP 1i
3953
Specifies the additional client data.
3957
.PN XRegisterIMInstantiateCallback
3958
function registers a callback to be invoked whenever a new input method
3959
becomes available for the specified display that matches the current
3960
locale and modifiers.
3962
The function returns
3964
if it succeeds; otherwise, it returns
3967
The generic prototype is as follows:
3968
.IN "IMInstantiateCallback" "" "@DEF@"
3971
void IMInstantiateCallback\^(\^\fIdisplay\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
3973
Display *\fIdisplay\fP\^;
3975
XPointer \fIclient_data\fP\^;
3977
XPointer \fIcall_data\fP\^;
3979
.IP \fIdisplay\fP 1i
3980
Specifies the connection to the X server.
3981
.IP \fIclient_data\fP 1i
3982
Specifies the additional client data.
3983
.IP \fIcall_data\fP 1i
3984
Not used for this callback and always passed as NULL.
3987
To unregister an input method instantiation callback, use
3988
.PN XUnregisterIMInstantiateCallback .
3989
.IN "XUnregisterIMInstantiateCallback" "" "@DEF@"
3992
Bool XUnregisterIMInstantiateCallback\^(\^\fIdisplay\fP\^, \fIdb\fP\^, \fIres_name\fP\^, \fIres_class\fP\^, \fIcallback\fP\^, \fIclient_data\fP\^)
3994
Display *\fIdisplay\fP\^;
3996
XrmDatabase \fIdb\fP\^;
3998
char *\fIres_name\fP\^;
4000
char *\fIres_class\fP\^;
4002
XIMProc \fIcallback\fP\^;
4004
XPointer *\fIclient_data\fP\^;
4006
.IP \fIdisplay\fP 1i
4007
Specifies the connection to the X server.
4009
Specifies a pointer to the resource database.
4010
.IP \fIres_name\fP 1i
4011
Specifies the full resource name of the application.
4012
.IP \fIres_class\fP 1i
4013
Specifies the full class name of the application.
4014
.IP \fIcallback\fP 1i
4015
Specifies a pointer to the input method instantiate callback.
4016
.IP \fIclient_data\fP 1i
4017
Specifies the additional client data.
4021
.PN XUnregisterIMInstantiateCallback
4022
function removes an input method instantiation callback previously
4024
The function returns
4026
if it succeeds; otherwise, it returns
4031
\*(SN Input Method Values
4034
The following table describes how XIM values are interpreted
4036
The first column lists the XIM values.
4037
The second column indicates how each of the XIM values
4038
are treated by that input style.
4041
The following keys apply to this table.
4053
This value may be set using
4057
a default is provided.
4060
This value may be set using
4064
This value may be read using
4084
.PN XNQueryInputStyle
4099
.PN XNDestroyCallback
4104
.PN XNQueryIMValuesList
4109
.PN XNQueryICValuesList
4114
.PN XNVisiblePosition
4119
.PN XNR6PreeditCallbackBehavior
4127
.PN XNR6PreeditCallbackBehavior
4128
is obsolete and its use is not recommended (see section 13.5.4.6).
4133
\*(SN Query Input Style
4136
A client should always query the input method to determine which input
4137
styles are supported.
4138
The client should then find an input style it is capable of supporting.
4140
If the client cannot find an input style that it can support,
4141
it should negotiate with the user the continuation of the program
4142
(exit, choose another input method, and so on).
4144
The argument value must be a pointer to a location
4145
where the returned value will be stored.
4146
The returned value is a pointer to a structure of type
4148
Clients are responsible for freeing the
4156
structure is defined as follows:
4158
.IN "XIMStyle" "" "@DEF@"
4159
.IN "XIMPreeditArea" "" "@DEF@"
4160
.IN "XIMPreeditCallbacks" "" "@DEF@"
4161
.IN "XIMPreeditPosition" "" "@DEF@"
4162
.IN "XIMPreeditNothing" "" "@DEF@"
4163
.IN "XIMPreeditNone" "" "@DEF@"
4164
.IN "XIMStatusArea" "" "@DEF@"
4165
.IN "XIMStatusCallbacks" "" "@DEF@"
4166
.IN "XIMStatusNothing" "" "@DEF@"
4167
.IN "XIMStatusNone" "" "@DEF@"
4168
.IN "XIMStyles" "" "@DEF@"
4171
typedef unsigned long XIMStyle;
4174
lw(.5i) lw(2i) lw(2.5i).
4185
.PN XIMPreeditCallbacks
4192
.PN XIMPreeditPosition
4199
.PN XIMPreeditNothing
4221
.PN XIMStatusCallbacks
4228
.PN XIMStatusNothing
4244
unsigned short count_styles;
4245
XIMStyle * supported_styles;
4252
structure contains the number of input styles supported
4253
in its count_styles field.
4254
This is also the size of the supported_styles array.
4256
The supported styles is a list of bitmask combinations,
4257
which indicate the combination of styles for each of the areas supported.
4258
These areas are described later.
4259
Each element in the list should select one of the bitmask values for
4261
The list describes the complete set of combinations supported.
4262
Only these combinations are supported by the input method.
4264
The preedit category defines what type of support is provided
4265
by the input method for preedit information.
4266
.IN "XIMPreeditArea" "" "@DEF@"
4267
.IN "XIMPreeditPosition" "" "@DEF@"
4268
.IN "XIMPreeditCallbacks" "" "@DEF@"
4269
.IN "XIMPreeditNothing" "" "@DEF@"
4270
.IN "XIMPreeditNone" "" "@DEF@"
4277
the input method would require the client to provide some area values
4278
for it to do its preediting.
4285
.PN XIMPreeditPosition
4288
the input method would require the client to provide positional values.
4295
.PN XIMPreeditCallbacks
4298
the input method would require the client to define the set of preedit callbacks.
4300
.PN XNPreeditStartCallback ,
4301
.PN XNPreeditDoneCallback ,
4302
.PN XNPreeditDrawCallback ,
4304
.PN XNPreeditCaretCallback .
4307
.PN XIMPreeditNothing
4309
If chosen, the input method can function without any preedit values.
4314
The input method does not provide any preedit feedback.
4315
Any preedit value is ignored.
4316
This style is mutually exclusive with the other preedit styles.
4320
The status category defines what type of support is provided
4321
by the input method for status information.
4322
.IN "XIMStatusArea" "" "@DEF@"
4323
.IN "XIMStatusCallbacks" "" "@DEF@"
4324
.IN "XIMStatusNothing" "" "@DEF@"
4325
.IN "XIMStatusNone" "" "@DEF@"
4331
The input method requires the client to provide
4332
some area values for it to do its status feedback.
4339
.PN XIMStatusCallbacks
4341
The input method requires the client to define the set of status callbacks,
4342
.PN XNStatusStartCallback ,
4343
.PN XNStatusDoneCallback ,
4345
.PN XNStatusDrawCallback .
4348
.PN XIMStatusNothing
4350
The input method can function without any status values.
4355
The input method does not provide any status feedback.
4356
If chosen, any status value is ignored.
4357
This style is mutually exclusive with the other status styles.
4361
Resource Name and Class
4363
\*(SN Resource Name and Class
4370
arguments are strings that specify the full name and class
4371
used by the input method.
4372
These values should be used as prefixes for the name and class
4373
when looking up resources that may vary according to the input method.
4374
If these values are not set,
4375
the resources will not be fully specified.
4377
It is not intended that values that can be set as XIM values be
4383
\*(SN Destroy Callback
4387
.PN XNDestroyCallback
4388
argument is a pointer to a structure of type
4390
.PN XNDestroyCallback
4391
is triggered when an input method stops its service for any reason.
4392
After the callback is invoked, the input method is closed and the
4393
associated input context(s) are destroyed by Xlib.
4394
Therefore, the client should not call
4399
The generic prototype of this callback function is as follows:
4400
.IN "DestroyCallback" "" "@DEF@"
4403
void DestroyCallback\^(\^\fIim\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
4407
XPointer \fIclient_data\fP\^;
4409
XPointer \fIcall_data\fP\^;
4412
Specifies the input method.
4413
.IP \fIclient_data\fP 1i
4414
Specifies the additional client data.
4415
.IP \fIcall_data\fP 1i
4416
Not used for this callback and always passed as NULL.
4419
A DestroyCallback is always called with a NULL call_data argument.
4422
Query IM/IC Values List
4424
\*(SN Query IM/IC Values List
4427
.PN XNQueryIMValuesList
4429
.PN XNQueryICValuesList
4430
are used to query about XIM and XIC values supported by the input method.
4432
The argument value must be a pointer to a location where the returned
4433
value will be stored. The returned value is a pointer to a structure
4436
Clients are responsible for freeing the
4444
structure is defined as follows:
4450
unsigned short count_values;
4451
char **supported_values;
4459
\*(SN Visible Position
4463
.PN XNVisiblePosition
4464
argument indicates whether the visible position masks of
4470
The argument value must be a pointer to a location where the returned
4471
value will be stored. The returned value is of type
4473
If the returned value is
4475
the input method uses the visible position masks of
4479
otherwise, the input method does not use the masks.
4481
Because this XIM value is optional, a client should call
4485
before using this argument.
4487
.PN XNVisiblePosition
4488
does not exist in the IM values list returned from
4489
.PN XNQueryIMValues ,
4490
the visible position masks of
4494
are not used to indicate the visible position.
4497
Preedit Callback Behavior
4499
\*(SN Preedit Callback Behavior
4503
.PN XNR6PreeditCallbackBehavior
4504
argument originally included in the X11R6 specification has been
4506
.\" If XNR6PreeditCallbackBehavior is not deprecated, then its type
4507
.\" should be changed from *Bool to Bool.
4509
During formulation of the X11R6 specification, the behavior of
4510
the R6 PreeditDrawCallbacks was going to differ significantly from
4511
that of the R5 callbacks.
4512
Late changes to the specification converged the R5 and R6 behaviors,
4513
eliminating the need for
4514
.PN XNR6PreeditCallbackBehavior .
4515
Unfortunately, this argument was not removed from the R6 specification
4516
before it was published.
4520
.PN XNR6PreeditCallbackBehavior
4521
argument indicates whether the behavior of preedit callbacks regarding
4522
.PN XIMPreeditDrawCallbackStruct
4523
values follows Release 5 or Release 6 semantics.
4525
The value is of type
4528
.PN XNR6PreeditCallbackBehavior ,
4529
if the returned value is
4531
the input method uses the Release 6 behavior;
4532
otherwise, it uses the Release 5 behavior.
4533
The default value is
4535
In order to use Release 6 semantics, the value of
4536
.PN XNR6PreeditCallbackBehavior
4540
Because this XIM value is optional, a client should call
4544
before using this argument.
4546
.PN XNR6PreeditCallbackBehavior
4547
does not exist in the IM values list returned from
4548
.PN XNQueryIMValues ,
4549
the PreeditCallback behavior is Release 5 semantics.
4552
Input Context Functions
4554
\*(SN Input Context Functions
4557
An input context is an abstraction that is used to contain both the data
4558
required (if any) by an input method and the information required
4559
to display that data.
4560
There may be multiple input contexts for one input method.
4561
The programming interfaces for creating, reading, or modifying
4562
an input context use a variable argument list.
4563
The name elements of the argument lists are referred to as XIC values.
4564
It is intended that input methods be controlled by these XIC values.
4565
As new XIC values are created,
4566
they should be registered with the X Consortium.
4569
To create an input context, use
4571
.IN "XCreateIC" "" "@DEF@"
4574
XIC XCreateIC\^(\^\fIim\fP\^, ...)
4579
Specifies the input method.
4580
.ds Al \ to set XIC values
4582
Specifies the variable length argument list\*(Al.
4587
function creates a context within the specified input method.
4589
Some of the arguments are mandatory at creation time, and
4590
the input context will not be created if those arguments are not provided.
4591
The mandatory arguments are the input style and the set of text callbacks
4592
(if the input style selected requires callbacks).
4593
All other input context values can be set later.
4596
returns a NULL value if no input context could be created.
4597
A NULL value could be returned for any of the following reasons:
4599
A required argument was not set.
4601
A read-only argument was set (for example,
4602
.PN XNFilterEvents ).
4604
The argument name is not recognized.
4606
The input method encountered an input method implementation-dependent error.
4618
To destroy an input context, use
4620
.IN "XDestroyIC" "" "@DEF@"
4623
void XDestroyIC\^(\^\fIic\fP\^)
4628
Specifies the input context.
4632
destroys the specified input context.
4635
To communicate to and synchronize with input method
4636
for any changes in keyboard focus from the client side,
4641
.IN "XSetICFocus" "" "@DEF@"
4644
void XSetICFocus\^(\^\fIic\fP\^)
4649
Specifies the input context.
4654
function allows a client to notify an input method that the focus window
4655
attached to the specified input context has received keyboard focus.
4656
The input method should take action to provide appropriate feedback.
4657
Complete feedback specification is a matter of user interface policy.
4661
does not affect the focus window value.
4664
.IN "XUnsetICFocus" "" "@DEF@"
4667
void XUnsetICFocus\^(\^\fIic\fP\^)
4672
Specifies the input context.
4677
function allows a client to notify an input method that the specified input context
4678
has lost the keyboard focus and that no more input is expected on the focus window
4679
attached to that input context.
4680
The input method should take action to provide appropriate feedback.
4681
Complete feedback specification is a matter of user interface policy.
4685
does not affect the focus window value;
4686
the client may still receive
4687
events from the input method that are directed to the focus window.
4690
To reset the state of an input context to its initial state, use
4694
.IN "XmbResetIC" "" "@DEF@"
4695
.IN "XwcResetIC" "" "@DE@"
4698
char * XmbResetIC\^(\^\fIic\fP\^)
4703
wchar_t * XwcResetIC\^(\^\fIic\fP\^)
4708
Specifies the input context.
4714
.PN XIMInitialState ,
4718
reset an input context to its initial state;
4722
.PN XIMPreserveState ,
4723
the current input context state is preserved.
4724
In both cases, any input pending on that context is deleted.
4725
The input method is required to clear the preedit area, if any,
4726
and update the status accordingly.
4731
does not change the focus.
4735
is its current preedit string as a multibyte string.
4736
If there is any preedit text drawn or visible to the user,
4737
then these procedures must return a non-NULL string.
4738
If there is no visible preedit text,
4739
then it is input method implementation-dependent
4740
whether these procedures return a non-NULL string or NULL.
4742
The client should free the returned string by calling
4746
To get the input method associated with an input context, use
4748
.IN "XIMOfIC" "" "@DEF@"
4751
XIM XIMOfIC\^(\^\fIic\fP\^)
4756
Specifies the input context.
4761
function returns the input method associated with the specified input context.
4764
Xlib provides two functions for setting and reading XIC values, respectively,
4768
Both functions have a variable-length argument list.
4769
In that argument list, any XIC value's name must be denoted
4770
with a character string using the X Portable Character Set.
4773
To set XIC values, use
4775
.IN "XSetICValues" "" "@DEF@"
4778
char * XSetICValues\^(\^\fIic\fP\^, ...)
4783
Specifies the input context.
4784
.ds Al \ to set XIC values
4786
Specifies the variable length argument list\*(Al.
4791
function returns NULL if no error occurred;
4793
it returns the name of the first argument that could not be set.
4794
An argument might not be set for any of the following reasons:
4796
The argument is read-only (for example,
4797
.PN XNFilterEvents ).
4799
The argument name is not recognized.
4801
An implementation-dependent error occurs.
4803
Each value to be set must be an appropriate datum,
4804
matching the data type imposed by the semantics of the argument.
4817
To obtain XIC values, use
4819
.IN "XGetICValues" "" "@DEF@"
4822
char * XGetICValues\^(\^\fIic\fP\^, ...)
4827
Specifies the input context.
4828
.ds Al \ to get XIC values
4830
Specifies the variable length argument list\*(Al.
4835
function returns NULL if no error occurred; otherwise,
4836
it returns the name of the first argument that could not be obtained.
4837
An argument could not be obtained for any of the following reasons:
4839
The argument name is not recognized.
4841
The input method encountered an implementation-dependent error.
4843
Each IC attribute value argument (following a name) must point to
4844
a location where the IC value is to be stored.
4845
That is, if the IC value is of type T,
4846
the argument must be of type T*.
4847
If T itself is a pointer type,
4850
allocates memory to store the actual data,
4851
and the client is responsible for freeing this data by calling
4853
with the returned pointer.
4854
The exception to this rule is for an IC value of type
4856
(for preedit and status attributes).
4857
In this case, the argument must also be of type
4859
Then, the rule of changing type T to T* and freeing the allocated data
4860
applies to each element of the nested list.
4862
Input Context Values
4864
\*(SN Input Context Values
4867
The following tables describe how XIC values are interpreted
4868
by an input method depending on the input style chosen by the
4871
The first column lists the XIC values.
4872
The second column indicates which values are involved in affecting,
4873
negotiating, and setting the geometry of the input method windows.
4874
The subentries under the third column indicate the different
4875
input styles that are supported.
4876
Each of these columns indicates how each of the XIC values
4877
are treated by that input style.
4879
The following keys apply to these tables.
4891
This value must be set with
4895
This value may be set using
4898
a default is provided.
4901
This value may be read using
4905
This value may cause geometry negotiation when its value is set by means of
4911
This value will be the response of the input method when any
4912
GN value is changed.
4915
This value will cause the geometry of the input method window to be set.
4918
This value must be set once and only once.
4919
It need not be set at create time.
4922
This value may be set with
4926
This value is ignored by the input method for the given input style.
4941
XIC Value Geometry Preedit Preedit Preedit Preedit Preedit
4942
Management Callback Position Area Nothing None
4948
Input Style C-G C-G C-G C-G C-G
4949
Client Window O-G O-G O-G O-G Ignored
4950
Focus Window GN D-S-G D-S-G D-S-G D-S-G Ignored
4951
Resource Name Ignored D-S-G D-S-G D-S-G Ignored
4952
Resource Class Ignored D-S-G D-S-G D-S-G Ignored
4953
Geometry Callback Ignored Ignored D-S-G Ignored Ignored
4954
Filter Events G G G G Ignored
4955
Destroy Callback D-S-G D-S-G D-S-G D-S-G D-S-G
4956
String Conversion Callback S-G S-G S-G S-G S-G
4957
String Conversion D-S-G D-S-G D-S-G D-S-G D-S-G
4958
Reset State D-S-G D-S-G D-S-G D-S-G Ignored
4959
HotKey S-G S-G S-G S-G Ignored
4960
HotKeyState D-S-G D-S-G D-S-G D-S-G Ignored
4963
Area GS Ignored D-S-G D-S-G Ignored Ignored
4964
Area Needed GN-GR Ignored Ignored S-G Ignored Ignored
4965
Spot Location Ignored D-S-G Ignored Ignored Ignored
4966
Colormap Ignored D-S-G D-S-G D-S-G Ignored
4967
Foreground Ignored D-S-G D-S-G D-S-G Ignored
4968
Background Ignored D-S-G D-S-G D-S-G Ignored
4969
Background Pixmap Ignored D-S-G D-S-G D-S-G Ignored
4970
Font Set GN Ignored D-S-G D-S-G D-S-G Ignored
4971
Line Spacing GN Ignored D-S-G D-S-G D-S-G Ignored
4972
Cursor Ignored D-S-G D-S-G D-S-G Ignored
4973
Preedit State D-S-G D-S-G D-S-G D-S-G Ignored
4974
Preedit State Notify Callback S-G S-G S-G S-G Ignored
4975
Preedit Callbacks C-S-G Ignored Ignored Ignored Ignored
4989
XIC Value Geometry Status Status Status Status
4990
Management Callback Area Nothing None
4996
Input Style C-G C-G C-G C-G
4997
Client Window O-G O-G O-G Ignored
4998
Focus Window GN D-S-G D-S-G D-S-G Ignored
4999
Resource Name Ignored D-S-G D-S-G Ignored
5000
Resource Class Ignored D-S-G D-S-G Ignored
5001
Geometry Callback Ignored D-S-G Ignored Ignored
5002
Filter Events G G G G
5005
Area GS Ignored D-S-G Ignored Ignored
5006
Area Needed GN-GR Ignored S-G Ignored Ignored
5007
Colormap Ignored D-S-G D-S-G Ignored
5008
Foreground Ignored D-S-G D-S-G Ignored
5009
Background Ignored D-S-G D-S-G Ignored
5010
Background Pixmap Ignored D-S-G D-S-G Ignored
5011
Font Set GN Ignored D-S-G D-S-G Ignored
5012
Line Spacing GN Ignored D-S-G D-S-G Ignored
5013
Cursor Ignored D-S-G D-S-G Ignored
5014
Status Callbacks C-S-G Ignored Ignored Ignored
5026
argument specifies the input style to be used.
5027
The value of this argument must be one of the values returned by the
5030
.PN XNQueryInputStyle
5031
argument specified in the supported_styles list.
5033
Note that this argument must be set at creation time
5034
and cannot be changed.
5041
.IN "XNClientWindow" "" "@DEF@"
5044
argument specifies to the input method the client window in
5045
which the input method
5046
can display data or create subwindows.
5047
Geometry values for input method areas are given with respect to the client
5049
Dynamic change of client window is not supported.
5050
This argument may be set only once and
5051
should be set before any input is done using this input context.
5053
the input method may not operate correctly.
5055
If an attempt is made to set this value a second time with
5061
and the client window will not be changed.
5063
If the client window is not a valid window ID on the display
5064
attached to the input method,
5067
error can be generated when this value is used by the input method.
5074
.IN "XNFocusWindow" "" "@DEF@"
5077
argument specifies the focus window.
5078
The primary purpose of the
5080
is to identify the window that will receive the key event when input
5082
In addition, the input method may possibly affect the focus window
5089
Modify its properties
5091
Grab the keyboard within that window
5093
The associated value must be of type
5095
If the focus window is not a valid window ID on the display
5096
attached to the input method,
5099
error can be generated when this value is used by the input method.
5101
When this XIC value is left unspecified,
5102
the input method will use the client window as the default focus window.
5104
Resource Name and Class
5106
\*(SN Resource Name and Class
5109
.IN "XNResourceName" "" "@DEF@"
5110
.IN "XNResourceClass" "" "@DEF@"
5115
arguments are strings that specify the full name and class
5116
used by the client to obtain resources for the client window.
5117
These values should be used as prefixes for name and class
5118
when looking up resources that may vary according to the input context.
5119
If these values are not set,
5120
the resources will not be fully specified.
5122
It is not intended that values that can be set as XIC values be
5127
\*(SN Geometry Callback
5130
.IN "XNGeometryCallback" "" "@DEF@"
5132
.PN XNGeometryCallback
5133
argument is a structure of type
5135
(see section 13.5.6.13.12).
5138
.PN XNGeometryCallback
5139
argument specifies the geometry callback that a client can set.
5140
This callback is not required for correct operation of either
5141
an input method or a client.
5142
It can be set for a client whose user interface policy permits
5143
an input method to request the dynamic change of that input
5145
An input method that does dynamic change will need to filter any
5146
events that it uses to initiate the change.
5153
.IN "XNFilterEvents" "" "@DEF@"
5156
argument returns the event mask that an input method needs
5157
to have selected for.
5158
The client is expected to augment its own event mask
5159
for the client window with this one.
5161
This argument is read-only, is set by the input method at create time,
5162
and is never changed.
5164
The type of this argument is
5167
Setting this value will cause an error.
5171
\*(SN Destroy Callback
5175
.PN XNDestroyCallback
5176
argument is a pointer to a structure of type
5178
(see section 13.5.6.13.12). This callback is triggered when the input method
5179
stops its service for any reason; for example, when a connection to an IM
5180
server is broken. After the destroy callback is called,
5181
the input context is destroyed and the input method is closed.
5182
Therefore, the client should not call
5188
String Conversion Callback
5190
\*(SN String Conversion Callback
5194
.PN XNStringConversionCallback
5195
argument is a structure of type
5197
(see section 13.5.6.13.12).
5200
.PN XNStringConversionCallback
5201
argument specifies a string conversion callback. This callback
5202
is not required for correct operation of
5203
either the input method or the client. It can be set by a client
5204
to support string conversions that may be requested
5205
by the input method. An input method that does string conversions
5206
will filter any events that it uses to initiate the conversion.
5208
Because this XIC value is optional, a client should call
5211
.PN XNQueryICValuesList
5212
before using this argument.
5217
\*(SN String Conversion
5221
.PN XNStringConversion
5222
argument is a structure of type
5223
.PN XIMStringConversionText .
5226
.PN XNStringConversion
5227
argument specifies the string to be converted by an input method.
5228
This argument is not required for correct operation of either
5229
the input method or the client.
5231
String conversion facilitates the manipulation of text independent
5233
It is essential for some input methods and clients to manipulate
5234
text by performing context-sensitive conversion,
5235
reconversion, or transliteration conversion on it.
5237
Because this XIC value is optional, a client should call
5240
.PN XNQueryICValuesList
5241
before using this argument.
5244
.PN XIMStringConversionText
5245
structure is defined as follows:
5250
typedef struct _XIMStringConversionText {
5251
unsigned short length;
5252
XIMStringConversionFeedback *feedback;
5253
Bool encoding_is_wchar;
5258
} XIMStringConversionText;
5260
typedef unsigned long XIMStringConversionFeedback;
5264
The feedback member is reserved for future use. The text to be
5265
converted is defined by the string and length members. The length
5266
is indicated in characters. To prevent the library from freeing memory
5267
pointed to by an uninitialized pointer, the client should set the feedback
5278
argument specifies the state the input context will return to after calling
5283
The XIC state may be set to its initial state, as specified by the
5287
was called, or it may be set to preserve the current state.
5293
.IN "XIMInitialState" "" "@DEF@"
5294
.IN "XINPreserveState" "" "@DEF@"
5298
typedef unsigned long XIMResetState;
5301
lw(.5i) lw(2i) lw(2i).
5312
.PN XIMPreserveState
5325
will return to the initial
5330
.PN XIMPreserveState
5335
will preserve the current state of the XIC.
5339
is left unspecified, the default is
5340
.PN XIMInitialState .
5343
values other than those specified above will default to
5344
.PN XIMInitialState .
5346
Because this XIC value is optional, a client should call
5349
.PN XNQueryICValuesList
5350
before using this argument.
5360
argument specifies the hot key list to the XIC.
5361
The hot key list is a pointer to the structure of type
5362
.PN XIMHotKeyTriggers ,
5363
which specifies the key events that must be received
5364
without any interruption of the input method.
5365
For the hot key list set with this argument to be utilized, the client
5369
.PN XIMHotKeyStateON .
5371
Because this XIC value is optional, a client should call
5374
.PN XNQueryICValuesList
5375
before using this functionality.
5377
The value of the argument is a pointer to a structure of type
5378
.PN XIMHotKeyTriggers .
5380
If an event for a key in the hot key list is found, then the process will
5381
receive the event and it will be processed inside the client.
5389
unsigned int modifier;
5390
unsigned int modifier_mask;
5395
XIMHotKeyTrigger *key;
5396
} XIMHotKeyTriggers;
5401
The combination of modifier and modifier_mask are used to represent one of
5402
three states for each modifier:
5403
either the modifier must be on, or the modifier must be off, or the modifier
5404
is a ``don't care'' \- it may be on or off.
5405
When a modifier_mask bit is set to 0, the state of the associated modifier
5406
is ignored when evaluating whether the key is hot or not.
5408
lw(1i) lw(1i) lw(3i).
5412
Modifier Bit Mask Bit Meaning
5423
The modifier must be off.
5430
The modifier must be on.
5437
Do not care if the modifier is on or off.
5450
argument specifies the hot key state of the input method.
5451
This is usually used to switch the input method between hot key
5452
operation and normal input processing.
5454
The value of the argument is a pointer to a structure of type
5461
typedef unsigned long XIMHotKeyState;
5464
lw(.5i) lw(3i) lw(2i).
5468
.PN XIMHotKeyStateON
5475
.PN XIMHotKeyStateOFF
5483
If not specified, the default is
5484
.PN XIMHotKeyStateOFF .
5487
Preedit and Status Attributes
5489
\*(SN Preedit and Status Attributes
5492
.IN "XNPreeditAttributes" "" "@DEF@"
5493
.IN "XNStatusAttributes" "" "@DEF@"
5495
.PN XNPreeditAttributes
5497
.PN XNStatusAttributes
5498
arguments specify to an input method the attributes to be used for the
5499
preedit and status areas,
5501
Those attributes are passed to
5505
as a nested variable-length list.
5506
The names to be used in these lists are described in the following sections.
5513
.IN "XNArea" "" "@DEF@"
5516
argument must be a pointer to a structure of type
5518
The interpretation of the
5520
argument is dependent on the input method style that has been set.
5522
If the input method style is
5523
.PN XIMPreeditPosition ,
5525
specifies the clipping region within which preediting will take place.
5526
If the focus window has been set,
5527
the coordinates are assumed to be relative to the focus window.
5528
Otherwise, the coordinates are assumed to be relative to the client window.
5529
If neither has been set,
5530
the results are undefined.
5534
is not specified, is set to NULL, or is invalid,
5535
the input method will default the clipping region
5536
to the geometry of the
5538
If the area specified is NULL or invalid,
5539
the results are undefined.
5541
If the input style is
5546
specifies the geometry provided by the client to the input method.
5547
The input method may use this area to display its data,
5548
either preedit or status depending on the area designated.
5549
The input method may create a window as a child of the client window
5550
with dimensions that fit the
5552
The coordinates are relative to the client window.
5553
If the client window has not been set yet,
5554
the input method should save these values
5555
and apply them when the client window is set.
5558
is not specified, is set to NULL, or is invalid,
5559
the results are undefined.
5566
.IN "XNAreaNeeded" "" "@DEF@"
5569
argument specifies the geometry suggested by the client for this area
5570
(preedit or status).
5571
The value associated with the argument must be a pointer to a
5574
Note that the x, y values are not used
5575
and that nonzero values for width or height are the constraints
5576
that the client wishes the input method to respect.
5580
argument specifies the preferred geometry desired by the input method
5583
This argument is only valid if the input style is
5587
It is used for geometry negotiation between the client and the input method
5588
and has no other effect on the input method
5589
(see section 13.5.1.5).
5596
.IN "XNSpotLocation" "" "@DEF@"
5599
argument specifies to the input method the coordinates of the spot
5600
to be used by an input method executing with
5603
.PN XIMPreeditPosition .
5604
When specified to any input method other than
5605
.PN XIMPreeditPosition ,
5606
this XIC value is ignored.
5608
The x coordinate specifies the position where the next character
5610
The y coordinate is the position of the baseline used
5611
by the current text line in the focus window.
5612
The x and y coordinates are relative to the focus window, if it has been set;
5613
otherwise, they are relative to the client window.
5614
If neither the focus window nor the client window has been set,
5615
the results are undefined.
5617
The value of the argument is a pointer to a structure of type
5625
Two different arguments can be used to indicate what colormap the input method
5626
should use to allocate colors, a colormap ID, or a standard colormap name.
5628
.IN "XNColormap" "" "@DEF@"
5631
argument is used to specify a colormap ID.
5632
The argument value is of type
5634
An invalid argument may generate a
5636
error when it is used by the input method.
5638
.IN "XNStdColormap" "" "@DEF@"
5641
argument is used to indicate the name of the standard colormap
5642
in which the input method should allocate colors.
5643
The argument value is an
5645
that should be a valid atom for calling
5646
.PN XGetRGBColormaps .
5647
An invalid argument may generate a
5649
error when it is used by the input method.
5651
If the colormap is left unspecified,
5652
the client window colormap becomes the default.
5654
Foreground and Background
5656
\*(SN Foreground and Background
5659
.IN "XNForeground" "" "@DEF@"
5660
.IN "XNBackground" "" "@DEF@"
5665
arguments specify the foreground and background pixel, respectively.
5666
The argument value is of type
5669
It must be a valid pixel in the input method colormap.
5671
If these values are left unspecified,
5672
the default is determined by the input method.
5676
\*(SN Background Pixmap
5680
.PN XNBackgroundPixmap
5681
argument specifies a background pixmap to be used as the background of the
5683
The value must be of type
5685
An invalid argument may generate a
5687
error when it is used by the input method.
5689
If this value is left unspecified,
5690
the default is determined by the input method.
5697
.IN "XNFontSet" "" "@DEF@"
5700
argument specifies to the input method what font set is to be used.
5701
The argument value is of type
5704
If this value is left unspecified,
5705
the default is determined by the input method.
5714
argument specifies to the input method what line spacing is to be used
5715
in the preedit window if more than one line is to be used.
5716
This argument is of type
5719
If this value is left unspecified,
5720
the default is determined by the input method.
5727
.IN "XNCursor" "" "DEF@"
5730
argument specifies to the input method what cursor is to be used
5731
in the specified window.
5732
This argument is of type
5735
An invalid argument may generate a
5737
error when it is used by the input method.
5738
If this value is left unspecified,
5739
the default is determined by the input method.
5748
argument specifies the state of input preediting for the input method.
5749
Input preediting can be on or off.
5751
The valid mask names for
5755
.IN "XIMPreeditUnknown" "" "@DEV@"
5756
.IN "XIMPreeditEnable" "" "@DEF@"
5757
.IN "XIMPreeditDisable" "" "@DEV@"
5761
typedef unsigned long XIMPreeditState;
5764
lw(.5i) lw(2i) lw(2i).
5768
.PN XIMPreeditUnknown
5775
.PN XIMPreeditEnable
5782
.PN XIMPreeditDisable
5790
.PN XIMPreeditEnable
5791
is set, then input preediting is turned on by the input method.
5794
.PN XIMPreeditDisable
5795
is set, then input preediting is turned off by the input method.
5799
is left unspecified, then the state will be implementation-dependent.
5804
.PN XIMInitialState ,
5807
value specified at the creation time will be reflected as the initial state for
5812
Because this XIC value is optional, a client should call
5815
.PN XNQueryICValuesList
5816
before using this argument.
5818
Preedit State Notify Callback
5820
\*(SN Preedit State Notify Callback
5823
The preedit state notify callback is triggered by the input method
5824
when the preediting state has changed.
5826
.PN XNPreeditStateNotifyCallback
5827
argument is a pointer to a structure of type
5829
The generic prototype is as follows:
5830
.IN "PreeditStateNotifyCallback" "" "@DEF@"
5833
void PreeditStateNotifyCallback\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
5837
XPointer \fIclient_data\fP\^;
5839
XIMPreeditStateNotifyCallbackStruct *\fIcall_data\fP\^;
5842
Specifies the input context.
5843
.IP \fIclient_data\fP 1i
5844
Specifies the additional client data.
5845
.IP \fIcall_data\fP 1i
5846
Specifies the current preedit state.
5850
.PN XIMPreeditStateNotifyCallbackStruct
5851
structure is defined as follows:
5853
.IN "XIMPreeditStateNotifyCallbackStruct" "" "@DEF@"
5858
typedef struct _XIMPreeditStateNotifyCallbackStruct {
5859
XIMPreeditState state;
5860
} XIMPreeditStateNotifyCallbackStruct;
5865
Because this XIC value is optional, a client should call
5868
.PN XNQueryICValuesList
5869
before using this argument.
5871
Preedit and Status Callbacks
5873
\*(SN Preedit and Status Callbacks
5876
A client that wants to support the input style
5877
.PN XIMPreeditCallbacks
5878
must provide a set of preedit callbacks to the input method.
5879
The set of preedit callbacks is as follows:
5880
.IN "XNPreeditStartCallback" "" "@DEF@"
5881
.IN "XNPreeditDoneCallback" "" "@DEF@"
5882
.IN "XNPreeditDrawCallback" "" "@DEF@"
5883
.IN "XNPreeditCaretCallback" "" "@DEF@"
5887
.PN XNPreeditStartCallback
5889
This is called when the input method starts preedit.
5892
.PN XNPreeditDoneCallback
5894
This is called when the input method stops preedit.
5897
.PN XNPreeditDrawCallback
5899
This is called when a number of preedit keystrokes should be echoed.
5902
.PN XNPreeditCaretCallback
5904
This is called to move the text insertion point within the preedit string.
5908
A client that wants to support the input style
5909
.PN XIMStatusCallbacks
5910
must provide a set of status callbacks to the input method.
5911
The set of status callbacks is as follows:
5912
.IN "XNStatusStartCallback" "" "@DEF@"
5913
.IN "XNStatusDoneCallback" "" "@DEF@"
5914
.IN "XNStatusDrawCallback" "" "@DEF@"
5918
.PN XNStatusStartCallback
5920
This is called when the input method initializes the status area.
5923
.PN XNStatusDoneCallback
5925
This is called when the input method no longer needs the status area.
5928
.PN XNStatusDrawCallback
5930
This is called when updating of the status area is required.
5934
The value of any status or preedit argument is a pointer
5935
to a structure of type
5937
.IN "XIMProc" "" "@DEF@"
5938
.IN "XIMCallback" "" "@DEF@"
5944
typedef void (*XIMProc)();
5947
XPointer client_data;
5953
Each callback has some particular semantics and will carry the data
5954
that expresses the environment necessary to the client
5955
into a specific data structure.
5956
This paragraph only describes the arguments to be used to set
5959
Setting any of these values while doing preedit
5960
may cause unexpected results.
5962
Input Method Callback Semantics
5964
\*(SN Input Method Callback Semantics
5967
XIM callbacks are procedures defined by clients or text drawing packages
5968
that are to be called from the input method when selected events occur.
5969
Most clients will use a text editing package or a toolkit
5970
and, hence, will not need to define such callbacks.
5971
This section defines the callback semantics, when they are triggered,
5972
and what their arguments are.
5973
This information is mostly useful for X toolkit implementors.
5975
Callbacks are mostly provided so that clients (or text editing
5976
packages) can implement on-the-spot preediting in their own window.
5978
the input method needs to communicate and synchronize with the client.
5979
The input method needs to communicate changes in the preedit window
5980
when it is under control of the client.
5981
Those callbacks allow the client to initialize the preedit area,
5982
display a new preedit string,
5983
move the text insertion point during preedit,
5984
terminate preedit, or update the status area.
5986
All callback procedures follow the generic prototype:
5987
.IN "CallbackPrototype" "" "@DEF@"
5990
void CallbackPrototype\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
5994
XPointer \fIclient_data\fP\^;
5996
SomeType \fIcall_data\fP\^;
5999
Specifies the input context.
6000
.IP \fIclient_data\fP 1i
6001
Specifies the additional client data.
6002
.IP \fIcall_data\fP 1i
6003
Specifies data specific to the callback.
6006
The call_data argument is a structure that expresses the arguments needed
6007
to achieve the semantics;
6009
it is a specific data structure appropriate to the callback.
6010
In cases where no data is needed in the callback,
6011
this call_data argument is NULL.
6012
The client_data argument is a closure that has been initially specified
6013
by the client when specifying the callback and passed back.
6014
It may serve, for example, to inherit application context in the callback.
6016
The following paragraphs describe the programming semantics
6017
and specific data structure associated with the different reasons.
6021
\*(SN Geometry Callback
6024
The geometry callback is triggered by the input method
6025
to indicate that it wants the client to negotiate geometry.
6026
The generic prototype is as follows:
6027
.IN "GeometryCallback" "" "@DEF@"
6030
void GeometryCallback\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
6034
XPointer \fIclient_data\fP\^;
6036
XPointer \fIcall_data\fP\^;
6039
Specifies the input context.
6040
.IP \fIclient_data\fP 1i
6041
Specifies the additional client data.
6042
.IP \fIcall_data\fP 1i
6043
Not used for this callback and always passed as NULL.
6046
The callback is called with a NULL call_data argument.
6050
\*(SN Destroy Callback
6053
The destroy callback is triggered by the input method
6054
when it stops service for any reason.
6055
After the callback is invoked, the input context will be freed by Xlib.
6056
The generic prototype is as follows:
6057
.IN "DestroyCallback" "" "@DEF@"
6060
void DestroyCallback\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
6064
XPointer \fIclient_data\fP\^;
6066
XPointer \fIcall_data\fP\^;
6069
Specifies the input context.
6070
.IP \fIclient_data\fP 1i
6071
Specifies the additional client data.
6072
.IP \fIcall_data\fP 1i
6073
Not used for this callback and always passed as NULL.
6076
The callback is called with a NULL call_data argument.
6078
String Conversion Callback
6080
\*(SN String Conversion Callback
6083
The string conversion callback is triggered by the input method
6084
to request the client to return the string to be converted. The
6085
returned string may be either a multibyte or wide character string,
6086
with an encoding matching the locale bound to the input context.
6087
The callback prototype is as follows:
6088
.IN "StringConversionCallback" "" "@DEF@"
6091
void StringConversionCallback\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
6095
XPointer \fIclient_data\fP\^;
6097
XIMStringConversionCallbackStruct *\fIcall_data\fP\^;
6100
Specifies the input method.
6101
.IP \fIclient_data\fP 1i
6102
Specifies the additional client data.
6103
.IP \fIcall_data\fP 1i
6104
Specifies the amount of the string to be converted.
6107
The callback is passed an
6108
.PN XIMStringConversionCallbackStruct
6109
structure in the call_data argument.
6110
The text member is an
6111
.PN XIMStringConversionText
6112
structure (see section 13.5.6.9) to be filled in by the client
6113
and describes the text to be sent to the input method.
6114
The data pointed to by the
6115
string and feedback elements of the
6116
.PN XIMStringConversionText
6117
structure will be freed using
6120
after the callback returns. So the client should not point to
6121
internal buffers that are critical to the client.
6122
Similarly, because the feedback element is currently reserved for future
6123
use, the client should set feedback to NULL to prevent the library from
6124
freeing memory at some random location due to an uninitialized pointer.
6127
.PN XIMStringConversionCallbackStruct
6128
structure is defined as follows:
6130
.IN "XIMStringConversionCallbackStruct" "" "@DEF@"
6134
typedef struct _XIMStringConversionCallbackStruct {
6135
XIMStringConversionPosition position;
6136
XIMCaretDirection direction;
6138
XIMStringConversionOperation operation;
6139
XIMStringConversionText *text;
6140
} XIMStringConversionCallbackStruct;
6142
typedef short XIMStringConversionPosition;
6144
typedef unsigned short XIMStringConversionOperation;
6149
lw(.5i) lw(3i) lw(2i).
6153
.PN XIMStringConversionSubstitution
6160
.PN XIMStringConversionRetrieval
6167
.PN XIMStringConversionPosition
6168
specifies the starting position of the string to be returned
6170
.PN XIMStringConversionText
6171
structure. The value identifies a position, in units of characters,
6172
relative to the client's cursor position in the client's buffer.
6174
The ending position of the text buffer is determined by
6175
the direction and factor members. Specifically, it is the character position
6176
relative to the starting point as defined by the
6177
.PN XIMCaretDirection .
6178
The factor member of
6179
.PN XIMStringConversionCallbackStruct
6180
specifies the number of
6181
.PN XIMCaretDirection
6182
positions to be applied. For example, if the direction specifies
6184
and factor is 1, then all characters from the starting position to
6185
the end of the current display line are returned. If the direction
6189
.PN XIMBackwardChar ,
6190
then the factor specifies a relative position, indicated in characters,
6191
from the starting position.
6193
.PN XIMStringConversionOperation
6194
specifies whether the string to be converted should be
6195
deleted (substitution) or copied (retrieval) from the client's
6197
.PN XIMStringConversionOperation
6199
.PN XIMStringConversionSubstitution ,
6200
the client must delete the string to be converted from its own buffer.
6202
.PN XIMStringConversionOperation
6204
.PN XIMStringConversionRetrieval ,
6205
the client must not delete the string to be converted from its buffer.
6206
The substitute operation is typically used for reconversion and
6207
transliteration conversion,
6208
while the retrieval operation is typically used for context-sensitive
6211
Preedit State Callbacks
6213
\*(SN Preedit State Callbacks
6216
When the input method turns preediting on or off, a
6217
.PN PreeditStartCallback
6219
.PN PreeditDoneCallback
6220
callback is triggered to let the toolkit do the setup
6221
or the cleanup for the preedit region.
6222
.IN "PreeditStartCallback" "" "@DEF@"
6225
int PreeditStartCallback\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
6229
XPointer \fIclient_data\fP\^;
6231
XPointer \fIcall_data\fP\^;
6234
Specifies the input context.
6235
.IP \fIclient_data\fP 1i
6236
Specifies the additional client data.
6237
.IP \fIcall_data\fP 1i
6238
Not used for this callback and always passed as NULL.
6241
When preedit starts on the specified input context,
6242
the callback is called with a NULL call_data argument.
6243
.PN PreeditStartCallback
6244
will return the maximum size of the preedit string.
6245
A positive number indicates the maximum number of bytes allowed
6246
in the preedit string,
6247
and a value of \-1 indicates there is no limit.
6248
.IN "PreeditDoneCallback" "" "@DEF@"
6251
void PreeditDoneCallback\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
6255
XPointer \fIclient_data\fP\^;
6257
XPointer \fIcall_data\fP\^;
6260
Specifies the input context.
6261
.IP \fIclient_data\fP 1i
6262
Specifies the additional client data.
6263
.IP \fIcall_data\fP 1i
6264
Not used for this callback and always passed as NULL.
6267
When preedit stops on the specified input context,
6268
the callback is called with a NULL call_data argument.
6269
The client can release the data allocated by
6270
.PN PreeditStartCallback .
6272
.PN PreeditStartCallback
6273
should initialize appropriate data needed for
6274
displaying preedit information and for handling further
6275
.PN PreeditDrawCallback
6278
.PN PreeditStartCallback
6279
is called, it will not be called again before
6280
.PN PreeditDoneCallback
6283
Preedit Draw Callback
6285
\*(SN Preedit Draw Callback
6288
This callback is triggered to draw and insert, delete or replace,
6289
preedit text in the preedit region.
6290
The preedit text may include unconverted input text such as Japanese Kana,
6291
converted text such as Japanese Kanji characters, or characters of both kinds.
6292
That string is either a multibyte or wide character string,
6293
whose encoding matches the locale bound to the input context.
6294
The callback prototype
6296
.IN "PreeditDrawCallback" "" "@DEF@"
6299
void PreeditDrawCallback\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
6303
XPointer \fIclient_data\fP\^;
6305
XIMPreeditDrawCallbackStruct *\fIcall_data\fP\^;
6308
Specifies the input context.
6309
.IP \fIclient_data\fP 1i
6310
Specifies the additional client data.
6311
.IP \fIcall_data\fP 1i
6312
Specifies the preedit drawing information.
6315
The callback is passed an
6316
.PN XIMPreeditDrawCallbackStruct
6317
structure in the call_data argument.
6318
The text member of this structure contains the text to be drawn.
6319
After the string has been drawn,
6320
the caret should be moved to the specified location.
6323
.PN XIMPreeditDrawCallbackStruct
6324
structure is defined as follows:
6326
.IN "XIMPreeditDrawCallbackStruct" "" "@DEF@"
6331
typedef struct _XIMPreeditDrawCallbackStruct {
6332
int caret; /* Cursor offset within preedit string */
6333
int chg_first; /* Starting change position */
6334
int chg_length; /* Length of the change in character count */
6336
} XIMPreeditDrawCallbackStruct;
6340
The client must keep updating a buffer of the preedit text
6341
and the callback arguments referring to indexes in that buffer.
6342
The call_data fields have specific meanings according to the operation,
6345
To indicate text deletion,
6346
the call_data member specifies a NULL text field.
6347
The text to be deleted is then the current text in the buffer
6348
from position chg_first (starting at zero) on a character length
6351
When text is non-NULL,
6352
it indicates insertion or replacement of text in the buffer.
6354
The chg_length member
6355
identifies the number of characters in the current preedit buffer
6356
that are affected by this call.
6357
A positive chg_length indicates that chg_length number of characters, starting
6358
at chg_first, must be deleted or must be replaced by text, whose length is
6363
A chg_length value of zero indicates that text must be inserted
6364
right at the position specified by chg_first.
6365
A value of zero for chg_first specifies the first character in the buffer.
6367
chg_length and chg_first combine to identify the modification required to
6368
the preedit buffer; beginning at chg_first, replace chg_length number of
6369
characters with the text in the supplied
6371
structure. For example, suppose the preedit buffer contains the string "ABCDE".
6377
CharPos: 0 1 2 3 4 5
6381
The CharPos in the diagram shows the location of the character position
6382
relative to the character.
6384
If the value of chg_first is 1 and the value of chg_length is 3, this
6385
says to replace 3 characters beginning at character position 1 with the
6389
Hence, BCD would be replaced by the value in the structure.
6391
Though chg_length and chg_first are both signed integers they will
6392
never have a negative value.
6395
identifies the character position before which the cursor should
6396
be placed \- after modification to the preedit buffer has been completed.
6397
For example, if caret is zero, the cursor is at
6398
the beginning of the buffer. If the caret is one, the cursor is between
6399
the first and second character.
6401
.IN "XIMText" "" @DEF@"
6405
typedef struct _XIMText {
6406
unsigned short length;
6407
XIMFeedback * feedback;
6408
Bool encoding_is_wchar;
6411
wchar_t * wide_char;
6417
The text string passed is actually a structure specifying as follows:
6419
The length member is the text length in characters.
6421
The encoding_is_wchar member is a value that indicates
6422
if the text string is encoded in wide character or multibyte format.
6423
The text string may be passed either as multibyte or as wide character;
6424
the input method controls in which form data is passed.
6426
callback routine must be able to handle data passed in either form.
6428
The string member is the text string.
6430
The feedback member indicates rendering type for each character in the
6432
If string is NULL (indicating that only highlighting of the existing
6433
preedit buffer should be updated), feedback points to length highlight
6434
elements that should be applied to the existing preedit buffer, beginning
6437
The feedback member expresses the types of rendering feedback
6438
the callback should apply when drawing text.
6439
Rendering of the text to be drawn is specified either in generic ways
6440
(for example, primary, secondary) or in specific ways (reverse, underline).
6441
When generic indications are given,
6442
the client is free to choose the rendering style.
6443
It is necessary, however, that primary and secondary be mapped
6444
to two distinct rendering styles.
6446
If an input method wants to control display of the preedit string, an
6447
input method can indicate the visibility hints using feedbacks in
6450
.PN XIMVisibleToForward ,
6451
.PN XIMVisibleToBackward ,
6453
.PN XIMVisibleCenter
6454
masks are exclusively used for these visibility hints.
6456
.PN XIMVisibleToForward
6458
indicates that the preedit text is preferably displayed in the
6459
primary draw direction from the
6460
caret position in the preedit area forward.
6462
.PN XIMVisibleToBackward
6464
indicates that the preedit text is preferably displayed from
6465
the caret position in the preedit area backward, relative to the primary
6468
.PN XIMVisibleCenter
6470
indicates that the preedit text is preferably displayed with
6471
the caret position in the preedit area centered.
6473
The insertion point of the preedit string could exist outside of
6474
the visible area when visibility hints are used.
6477
is valid for the entire preedit string, and only one character
6478
can hold one of these feedbacks for a given input context at one time.
6479
This feedback may be OR'ed together with another highlight (such as
6481
Only the most recently set feedback is valid, and any previous
6482
feedback is automatically canceled. This is a hint to the client, and
6483
the client is free to choose how to display the preedit string.
6485
The feedback member also specifies how rendering of the text argument
6486
should be performed.
6487
If the feedback is NULL,
6488
the callback should apply the same feedback as is used for the surrounding
6489
characters in the preedit buffer; if chg_first is at a highlight boundary,
6490
the client can choose which of the two highlights to use.
6491
If feedback is not NULL, feedback specifies an array defining the
6493
character of the string, and the length of the array is thus length.
6495
If an input method wants to indicate that it is only updating the feedback of
6496
the preedit text without changing the content of it,
6499
structure will contain a NULL value for the string field,
6500
the number of characters affected (relative to chg_first)
6501
will be in the length field,
6502
and the feedback field will point to an array of
6505
Each element in the feedback array is a bitmask represented by a value of type
6507
The valid mask names are as follows:
6509
.IN "XIMReverse" "" "@DEF@"
6510
.IN "XIMUnderline" "" "@DEF@"
6511
.IN "XIMHighlight" "" "@DEF@"
6512
.IN "XIMPrimary" "" "@DEF@"
6513
.IN "XIMSecondary" "" "@DEF@"
6514
.IN "XIMTertiary" "" "@DEF@"
6515
.IN "XIMVisibleToForward" "" "@DEF@"
6516
.IN "XIMVisibleToBackward" "" "@DEF@"
6517
.IN "XIMVisibleCenter" "" "@DEF@"
6521
typedef unsigned long XIMFeedback;
6524
lw(.5i) lw(2i) lw(2i).
6570
.PN XIMVisibleToForward
6577
.PN XIMVisibleToBackward
6584
.PN XIMVisibleCenter
6592
Characters drawn with the
6594
highlight should be drawn by swapping the foreground and background colors
6595
used to draw normal, unhighlighted characters.
6596
Characters drawn with the
6598
highlight should be underlined.
6599
Characters drawn with the
6605
highlights should be drawn in some unique manner that must be different
6616
were incorrectly defined in the R5 specification.
6617
The X Consortium's X11R5
6618
implementation correctly implemented the values for these highlights.
6619
The value of these highlights has been corrected in this specification
6620
to agree with the values in the Consortium's X11R5 and X11R6 implementations.
6623
Preedit Caret Callback
6625
\*(SN Preedit Caret Callback
6628
An input method may have its own navigation keys to allow the user
6629
to move the text insertion point in the preedit area
6630
(for example, to move backward or forward).
6631
Consequently, input method needs to indicate to the client that it
6632
should move the text insertion point.
6633
It then calls the PreeditCaretCallback.
6634
.IN "PreeditCaretCallback" "" "@DEF@"
6637
void PreeditCaretCallback\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
6641
XPointer \fIclient_data\fP\^;
6643
XIMPreeditCaretCallbackStruct *\fIcall_data\fP\^;
6646
Specifies the input context.
6647
.IP \fIclient_data\fP 1i
6648
Specifies the additional client data.
6649
.IP \fIcall_data\fP 1i
6650
Specifies the preedit caret information.
6653
The input method will trigger PreeditCaretCallback
6654
to move the text insertion point during preedit.
6655
The call_data argument contains a pointer to an
6656
.PN XIMPreeditCaretCallbackStruct
6658
which indicates where the caret should be moved.
6659
The callback must move the insertion point to its new location
6660
and return, in field position, the new offset value from the initial position.
6663
.PN XIMPreeditCaretCallbackStruct
6664
structure is defined as follows:
6665
.IN "XIMPreeditCaretCallbackStruct" "" "@DEF@"
6671
typedef struct _XIMPreeditCaretCallbackStruct {
6672
int position; /* Caret offset within preedit string */
6673
XIMCaretDirection direction; /* Caret moves direction */
6674
XIMCaretStyle style; /* Feedback of the caret */
6675
} XIMPreeditCaretCallbackStruct;
6681
structure is defined as follows:
6683
.IN "XIMCaretStyle" "" "@DEF@"
6689
XIMIsInvisible, /* Disable caret feedback */
6690
XIMIsPrimary, /* UI defined caret feedback */
6691
XIMIsSecondary, /* UI defined caret feedback */
6697
.PN XIMCaretDirection
6698
structure is defined as follows:
6699
.IN "XIMCaretDirection" "" "@DEF@"
6706
XIMForwardChar, XIMBackwardChar,
6707
XIMForwardWord, XIMBackwardWord,
6708
XIMCaretUp, XIMCaretDown,
6709
XIMNextLine, XIMPreviousLine,
6710
XIMLineStart, XIMLineEnd,
6711
XIMAbsolutePosition,
6713
} XIMCaretDirection;
6717
These values are defined as follows:
6718
.IN "XIMForwardChar" "" "@DEF@"
6719
.IN "XIMBackwardChar" "" "@DEF@"
6720
.IN "XIMForwardWord" "" "@DEF@"
6721
.IN "XIMBackwardWord" "" "@DEF@"
6722
.IN "XIMCaretUp" "" "@DEF@"
6723
.IN "XIMCaretDown" "" "@DEF@"
6729
Move the caret forward one character position.
6734
Move the caret backward one character position.
6739
Move the caret forward one word.
6744
Move the caret backward one word.
6749
Move the caret up one line keeping the current horizontal offset.
6754
Move the caret down one line keeping the current horizontal offset.
6759
Move the caret to the beginning of the previous line.
6764
Move the caret to the beginning of the next line.
6769
Move the caret to the beginning of the current display line
6770
that contains the caret.
6775
Move the caret to the end of the current display line
6776
that contains the caret.
6779
.PN XIMAbsolutePosition
6781
The callback must move to the location specified by the position field
6782
of the callback data, indicated in characters, starting from the beginning
6783
of the preedit text.
6784
Hence, a value of zero means move back to the beginning of the preedit text.
6789
The caret position does not change.
6792
.IN "XIMNextLine" "" "@DEF@"
6793
.IN "XIMPreviousLine" "" "@DEF@"
6794
.IN "XIMLineStart" "" "@DEF@"
6795
.IN "XIMLineEnd" "" "@DEF@"
6796
.IN "XIMAbsolutePosition" "" "@DEF@"
6797
.IN "XIMDontChange" "" "@DEF@"
6801
\*(SN Status Callbacks
6804
An input method may communicate changes in the status of an input context
6805
(for example, created, destroyed, or focus changes) with three status
6806
callbacks: StatusStartCallback, StatusDoneCallback, and StatusDrawCallback.
6809
When the input context is created or gains focus,
6810
the input method calls the StatusStartCallback callback.
6811
.IN "StatusStartCallback" "" "@DEF@"
6814
void StatusStartCallback\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
6818
XPointer \fIclient_data\fP\^;
6820
XPointer \fIcall_data\fP\^;
6823
Specifies the input context.
6824
.IP \fIclient_data\fP 1i
6825
Specifies the additional client data.
6826
.IP \fIcall_data\fP 1i
6827
Not used for this callback and always passed as NULL.
6830
The callback should initialize appropriate data for displaying status
6831
and for responding to StatusDrawCallback calls.
6832
Once StatusStartCallback is called,
6833
it will not be called again before StatusDoneCallback has been called.
6836
When an input context
6837
is destroyed or when it loses focus, the input method calls StatusDoneCallback.
6838
.IN "StatusDoneCallback" "" "@DEF@"
6841
void StatusDoneCallback\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
6845
XPointer \fIclient_data\fP\^;
6847
XPointer \fIcall_data\fP\^;
6850
Specifies the input context.
6851
.IP \fIclient_data\fP 1i
6852
Specifies the additional client data.
6853
.IP \fIcall_data\fP 1i
6854
Not used for this callback and always passed as NULL.
6857
The callback may release any data allocated on
6861
When an input context status has to be updated, the input method calls
6863
.IN "StatusDrawCallback" "" "@DEF@"
6866
void StatusDrawCallback\^(\^\fIic\fP\^, \fIclient_data\fP\^, \fIcall_data\fP\^)
6870
XPointer \fIclient_data\fP\^;
6872
XIMStatusDrawCallbackStruct *\fIcall_data\fP\^;
6875
Specifies the input context.
6876
.IP \fIclient_data\fP 1i
6877
Specifies the additional client data.
6878
.IP \fIcall_data\fP 1i
6879
Specifies the status drawing information.
6882
The callback should update the status area by either drawing a string
6883
or imaging a bitmap in the status area.
6886
.PN XIMStatusDataType
6888
.PN XIMStatusDrawCallbackStruct
6889
structures are defined as follows:
6890
.IN "XIMStatusDataType" "" "@DEF@"
6891
.IN "XIMStatusDrawCallbackStruct" "" "@DEF@"
6900
} XIMStatusDataType;
6902
typedef struct _XIMStatusDrawCallbackStruct {
6903
XIMStatusDataType type;
6908
} XIMStatusDrawCallbackStruct;
6914
.PN XIMVisibleToForward ,
6915
.PN XIMVisibleToBackward ,
6917
.PN XIMVisibleToCenter
6918
are not relevant and will not appear in the
6927
\*(SN Event Filtering
6930
Xlib provides the ability for an input method
6931
to register a filter internal to Xlib.
6932
This filter is called by a client (or toolkit) by calling
6936
Any client that uses the
6938
interface should call
6940
to allow input methods to process their events without knowledge
6941
of the client's dispatching mechanism.
6942
A client's user interface policy may determine the priority
6943
of event filters with respect to other event-handling mechanisms
6944
(for example, modal grabs).
6946
Clients may not know how many filters there are, if any,
6948
They may only know if an event has been filtered on return of
6950
Clients should discard filtered events.
6953
To filter an event, use
6955
.IN "XFilterEvent" "" "@DEF@"
6958
Bool XFilterEvent\^(\^\fIevent\fP\^, \fIw\fP\^)
6960
XEvent *\fIevent\fP\^;
6964
.ds Ev event to filter
6966
Specifies the \*(Ev.
6967
.ds Wi for which the filter is to be applied
6969
Specifies the window \*(Wi.
6972
If the window argument is
6975
applies the filter to the window specified in the
6978
The window argument is provided so that layers above Xlib
6979
that do event redirection can indicate to which window an event
6980
has been redirected.
6986
then some input method has filtered the event,
6987
and the client should discard the event.
6992
then the client should continue processing the event.
6994
If a grab has occurred in the client and
6998
the client should ungrab the keyboard.
7000
Getting Keyboard Input
7002
\*(SN Getting Keyboard Input
7005
To get composed input from an input method,
7009
.PN XwcLookupString .
7010
.IN "XmbLookupString" "" "@DEF@"
7011
.IN "XwcLookupString" "" "@DEF@"
7014
int XmbLookupString\^(\^\fIic\fP\^, \fIevent\fP\^, \fIbuffer_return\fP\^, \fIbytes_buffer\fP\^, \fIkeysym_return\fP\^, \fIstatus_return\fP\^)
7018
XKeyPressedEvent *\fIevent\fP;
7020
char *\fIbuffer_return\fP\^;
7022
int \fIbytes_buffer\fP\^;
7024
KeySym *\fIkeysym_return\fP\^;
7026
Status *\fIstatus_return\fP\^;
7029
int XwcLookupString\^(\^\fIic\fP\^, \fIevent\fP\^, \fIbuffer_return\fP\^, \fIbytes_buffer\fP\^, \fIkeysym_return\fP\^, \fIstatus_return\fP\^)
7033
XKeyPressedEvent *\fIevent\fP\^;
7035
wchar_t *\fIbuffer_return\fP\^;
7037
int \fIwchars_buffer\fP\^;
7039
KeySym *\fIkeysym_return\fP\^;
7041
Status *\fIstatus_return\fP\^;
7044
Specifies the input context.
7045
.ds Ev key event to be used
7047
Specifies the \*(Ev.
7048
.IP \fIbuffer_return\fP 1i
7049
Returns a multibyte string or wide character string (if any)
7050
from the input method.
7051
.IP \fIbytes_buffer\fP 1i
7054
.IP \fIwchars_buffer\fP 1i
7055
Specifies space available in the return buffer.
7056
.IP \fIkeysym_return\fP 1i
7057
Returns the KeySym computed from the event if this argument is not NULL.
7058
.IP \fIstatus_return\fP 1i
7059
Returns a value indicating what kind of data is returned.
7066
functions return the string from the input method specified
7067
in the buffer_return argument.
7068
If no string is returned,
7069
the buffer_return argument is unchanged.
7071
The KeySym into which the KeyCode from the event was mapped is returned
7072
in the keysym_return argument if it is non-NULL and the status_return
7073
argument indicates that a KeySym was returned.
7074
If both a string and a KeySym are returned,
7075
the KeySym value does not necessarily correspond to the string returned.
7078
returns the length of the string in bytes, and
7080
returns the length of the string in characters.
7085
return text in the encoding of the locale bound to the input method
7086
of the specified input context.
7088
Each string returned by
7092
begins in the initial state of the encoding of the locale
7093
(if the encoding of the locale is state-dependent).
7095
To insure proper input processing,
7096
it is essential that the client pass only
7101
.PN XwcLookupString .
7102
Their behavior when a client passes a
7107
Clients should check the status_return argument before
7108
using the other returned values.
7109
These two functions both return a value to status_return
7110
that indicates what has been returned in the other arguments.
7111
The possible values returned are:
7117
The input string to be returned is too large for the supplied buffer_return.
7119
.Pn ( XmbLookupString
7122
in characters) is returned as the value of the function,
7123
and the contents of buffer_return and keysym_return are not modified.
7124
The client should recall the function with the same event
7125
and a buffer of adequate size to obtain the string.
7130
No consistent input has been composed so far.
7131
The contents of buffer_return and keysym_return are not modified,
7132
and the function returns zero.
7137
Some input characters have been composed.
7138
They are placed in the buffer_return argument,
7139
and the string length is returned as the value of the function.
7140
The string is encoded in the locale bound to the input context.
7141
The content of the keysym_return argument is not modified.
7146
A KeySym has been returned instead of a string
7147
and is returned in keysym_return.
7148
The content of the buffer_return argument is not modified,
7149
and the function returns zero.
7154
Both a KeySym and a string are returned;
7158
occur simultaneously.
7162
It does not make any difference if the input context passed as an argument to
7166
is the one currently in possession of the focus or not.
7167
Input may have been composed within an input context before it lost the focus,
7168
and that input may be returned on subsequent calls to
7172
even though it does not have any more keyboard focus.
7174
Input Method Conventions
7176
\*(SN Input Method Conventions
7179
The input method architecture is transparent to the client.
7180
However, clients should respect a number of conventions in order
7182
Clients must also be aware of possible effects of synchronization
7183
between input method and library in the case of a remote input server.
7187
\*(SN Client Conventions
7190
A well-behaved client (or toolkit) should first query the input method style.
7191
If the client cannot satisfy the requirements of the supported styles
7192
(in terms of geometry management or callbacks),
7193
it should negotiate with the user continuation of the program
7194
or raise an exception or error of some sort.
7196
Synchronization Conventions
7198
\*(SN Synchronization Conventions
7203
event with a KeyCode of zero is used exclusively as a
7204
signal that an input method has composed input that can be returned by
7207
.PN XwcLookupString .
7208
No other use is made of a
7210
event with KeyCode of zero.
7212
Such an event may be generated by either a front-end
7213
or a back-end input method in an implementation-dependent manner.
7214
Some possible ways to generate this event include:
7216
A synthetic event sent by an input method server
7218
An artificial event created by a input method filter and pushed
7219
onto a client's event queue
7223
event whose KeyCode value is modified by an input method filter
7225
When callback support is specified by the client,
7226
input methods will not take action unless they explicitly
7227
called back the client and obtained no response
7228
(the callback is not specified or returned invalid data).
7232
\*(SN String Constants
7235
The following symbols for string constants are defined in
7237
Although they are shown here with particular macro definitions,
7238
they may be implemented as macros, as global symbols, or as a
7239
mixture of the two. The string pointer value itself
7240
is not significant; clients must not assume that inequality of two
7241
values implies inequality of the actual string data.
7242
.IN "XNVaNestedList" "" "@DEF@"
7243
.IN "XNSeparatorofNestedList "" "@DEF@"
7244
.IN "XNQueryInputStyle" "" "@DEF@"
7245
.IN "XNClientWindow" "" "@DEF@"
7246
.IN "XNInputStyle" "" "@DEF@"
7247
.IN "XNFocusWindow" "" "@DEF@"
7248
.IN "XNResourceName" "" "@DEF@"
7249
.IN "XNResourceClass" "" "@DEF@"
7250
.IN "XNGeometryCallback" "" "@DEF@"
7251
.IN "XNDestroyCallback" "" "@DEF@"
7252
.IN "XNFilterEvents" "" "@DEF@"
7253
.IN "XNPreeditStartCallback" "" "@DEF@"
7254
.IN "XNPreeditDoneCallback" "" "@DEF@"
7255
.IN "XNPreeditDrawCallback" "" "@DEF@"
7256
.IN "XNPreeditCaretCallback" "" "@DEF@"
7257
.IN "XNPreeditStateNotifyCallback" "" "@DEF@"
7258
.IN "XNPreeditAttributes" "" "@DEF@"
7259
.IN "XNStatusStartCallback" "" "@DEF@"
7260
.IN "XNStatusDoneCallback" "" "@DEF@"
7261
.IN "XNStatusDrawCallback" "" "@DEF@"
7262
.IN "XNStatusAttributes" "" "@DEF@"
7263
.IN "XNArea" "" "@DEF@"
7264
.IN "XNAreaNeeded" "" "@DEF@"
7265
.IN "XNSpotLocation" "" "@DEF@"
7266
.IN "XNColormap" "" "@DEF@"
7267
.IN "XNStdColormap" "" "@DEF@"
7268
.IN "XNForeground" "" "@DEF@"
7269
.IN "XNBackground" "" "@DEF@"
7270
.IN "XNBackgroundPixmap" "" "@DEF@"
7271
.IN "XNFontSet" "" "@DEF@"
7272
.IN "XNLineSpace" "" "@DEF@"
7273
.IN "XNCursor" "" "@DEF@"
7275
lw(.5i) lw(2.75i) lw(2.5i).
7286
.PN XNSeparatorofNestedList
7288
"separatorofNestedList"
7293
.PN XNQueryInputStyle
7335
.PN XNGeometryCallback
7342
.PN XNDestroyCallback
7356
.PN XNPreeditStartCallback
7358
"preeditStartCallback"
7363
.PN XNPreeditDoneCallback
7365
"preeditDoneCallback"
7370
.PN XNPreeditDrawCallback
7372
"preeditDrawCallback"
7377
.PN XNPreeditCaretCallback
7379
"preeditCaretCallback"
7384
.PN XNPreeditStateNotifyCallback
7386
"preeditStateNotifyCallback"
7391
.PN XNPreeditAttributes
7398
lw(.5i) lw(2.75i) lw(2.5i).
7402
.PN XNStatusStartCallback
7404
"statusStartCallback"
7409
.PN XNStatusDoneCallback
7411
"statusDoneCallback"
7416
.PN XNStatusDrawCallback
7418
"statusDrawCallback"
7423
.PN XNStatusAttributes
7479
.PN XNBackgroundPixmap
7507
lw(.5i) lw(2.75i) lw(2.5i).
7511
.PN XNQueryIMValuesList
7518
.PN XNQueryICValuesList
7525
.PN XNStringConversionCallback
7527
"stringConversionCallback"
7532
.PN XNStringConversion
7567
.PN XNVisiblePosition
7574
.PN XNR6PreeditCallbackBehavior
7580
.IN "XNQueryIMValuesList" "" "@DEF@"
7581
.IN "XNQueryICValuesList" "" "@DEF@"
7582
.IN "XNStringConversionCallback" "" "@DEF@"
7583
.IN "XNStringConversion" "" "@DEF@"
7584
.IN "XNResetState" "" "@DEF@"
7585
.IN "XNHotKey" "" "@DEF@"
7586
.IN "XNHotKeyState" "" "@DEF@"
7587
.IN "XNPreeditState" "" "@DEF@"
7588
.IN "XNVisiblePosition" "" "@DEF@"
7589
.IN "XNR6PreeditCallbackBehavior" "" "@DEF@"
7591
lw(.5i) lw(2.75i) lw(2.5i).
7595
.PN XNRequiredCharSet
7602
.PN XNQueryOrientation
7609
.PN XNDirectionalDependentDrawing
7611
"directionalDependentDrawing"
7616
.PN XNContextualDrawing
7630
.PN XNMissingCharSet
7663
.IN "XNRequiredCharSet" "" "@DEF@"
7664
.IN "XNQueryOrientation" "" "@DEF@"
7665
.IN "XNDirectionalDependentDrawing" "" "@DEF@"
7666
.IN "XNContextualDrawing" "" "@DEF@"
7667
.IN "XNBaseFontName" "" "@DEF@"
7668
.IN "XNMissingCharSet" "" "@DEF@"
7669
.IN "XNDefaultString" "" "@DEF@"
7670
.IN "XNOrientation" "" "@DEF@"
7671
.IN "XNFontInfo" "" "@DEF@"
7672
.IN "XNOMAutomatic" "" "@DEF@"