1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
4
<chapter id="locales_and_internationalized_text_functions">
5
<title>Locales and Internationalized Text Functions</title>
8
An internationalized application is one that is adaptable to the requirements of different native
9
languages, local customs, and character string encodings. The process of adapting the operation
10
to a particular native language, local custom, or string encoding is called localization. A goal of
11
internationalization is to permit localization without program source modifications or recompila-
15
As one of the localization mechanisms, Xlib provides an X Input Method (<acronym>XIM</acronym>) functional inter-
16
face for internationalized text input and an X Output Method (<acronym>XOM</acronym>) functional interface for
17
internationalized text output.
20
Internationalization in X is based on the concept of a locale. A locale defines the localized
21
behavior of a program at run time. Locales affect Xlib in its:
25
<listitem><para>Encoding and processing of input method text</para></listitem>
26
<listitem><para>Encoding of resource files and values</para></listitem>
27
<listitem><para>Encoding and imaging of text strings</para></listitem>
28
<listitem><para>Encoding and decoding for inter-client text communication</para></listitem>
34
Encoding and decoding for inter-client text communication
35
Characters from various languages are represented in a computer using an encoding. Different
36
languages have different encodings, and there are even different encodings for the same charac-
37
ters in the same language.
40
This chapter defines support for localized text imaging and text input and describes the locale
41
mechanism that controls all locale-dependent Xlib functions. Sets of functions are provided for
42
multibyte (char *) text as well as wide character (wchar_t) text in the form supported by the host
43
C language environment. The multibyte and wide character functions are equivalent except for
44
the form of the text argument.
47
The Xlib internationalization functions are not meant to provide support for multilingual applica-
48
tions (mixing multiple languages within a single piece of text), but they make it possible to imple-
49
ment applications that work in limited fashion with more than one language in independent con-
53
The remainder of this chapter discusses:
57
<listitem><para>X locale management</para></listitem>
58
<listitem><para>Locale and modifier dependencies</para></listitem>
59
<listitem><para>Variable argument lists</para></listitem>
60
<listitem><para>Output methods</para></listitem>
61
<listitem><para>Input methods</para></listitem>
62
<listitem><para>String constants</para></listitem>
66
<sect1 id="X_Locale_Management">
67
<title>X Locale Management</title>
69
<!-- (SN X Locale Management -->
73
X supports one or more of the locales defined by the host environment.
74
On implementations that conform to the ANSI C library,
75
the locale announcement method is
76
<function>setlocale</function>.
77
This function configures the locale operation of both
78
the host C library and Xlib.
79
The operation of Xlib is governed by the LC_CTYPE category;
80
this is called the <emphasis remap='I'>current locale</emphasis>.
81
An implementation is permitted to provide implementation-dependent
82
mechanisms for announcing the locale in addition to
83
<function>setlocale</function>.
87
On implementations that do not conform to the ANSI C library,
88
the locale announcement method is Xlib implementation-dependent.
92
The mechanism by which the semantic operation of Xlib is defined
93
for a specific locale is implementation-dependent.
98
X is not required to support all the locales supported by the host.
99
To determine if the current locale is supported by X, use
100
<function>XSupportsLocale</function>.
103
<para>Bool XSupportsLocale()</para>
109
<function>XSupportsLocale</function>
111
<symbol>True</symbol>
112
if Xlib functions are capable of operating under the current locale.
114
<symbol>False</symbol>,
115
Xlib locale-dependent functions for which the
116
<symbol>XLocaleNotSupported</symbol>
117
return status is defined will return
118
<symbol>XLocaleNotSupported</symbol>.
119
Other Xlib locale-dependent routines will operate in the ``C'' locale.
123
The client is responsible for selecting its locale and X modifiers.
124
Clients should provide a means for the user to override the clients'
125
locale selection at client invocation.
126
Most single-display X clients operate in a single locale
127
for both X and the host processing environment.
128
They will configure the locale by calling three functions:
129
the host locale configuration function,
130
<function>XSupportsLocale</function>,
132
<function>XSetLocaleModifiers</function>.
136
The semantics of certain categories of X internationalization capabilities
137
can be configured by setting modifiers.
138
Modifiers are named by implementation-dependent and locale-specific strings.
139
The only standard use for this capability at present
140
is selecting one of several styles of keyboard input method.
145
To configure Xlib locale modifiers for the current locale, use
146
<function>XSetLocaleModifiers</function>.
147
<indexterm significance="preferred"><primary>XSetLocaleModifiers</primary></indexterm>
151
<funcdef>char *<function>XSetLocaleModifiers</function></funcdef>
152
<paramdef>char<parameter> *modifier_list</parameter></paramdef>
159
<emphasis remap='I'>modifier_list</emphasis>
163
Specifies the modifiers.
173
<function>XSetLocaleModifiers</function>
174
function sets the X modifiers for the current locale setting.
175
The modifier_list argument is a null-terminated string of the form
176
``{@<emphasis remap='I'>category</emphasis>=<emphasis remap='I'>value</emphasis>}'', that is,
177
having zero or more concatenated ``@<emphasis remap='I'>category</emphasis>=<emphasis remap='I'>value</emphasis>''
178
entries, where <emphasis remap='I'>category</emphasis> is a category name
179
and <emphasis remap='I'>value</emphasis> is the (possibly empty) setting for that category.
180
The values are encoded in the current locale.
181
Category names are restricted to the <acronym>POSIX</acronym> Portable Filename Character Set.
185
The local host X locale modifiers announcer (on <acronym>POSIX</acronym>-compliant systems,
186
the XMODIFIERS environment variable) is appended to the modifier_list to
187
provide default values on the local host.
188
If a given category appears more than once in the list,
189
the first setting in the list is used.
190
If a given category is not included in the full modifier list,
191
the category is set to an implementation-dependent default
192
for the current locale.
193
An empty value for a category explicitly specifies the
194
implementation-dependent default.
198
If the function is successful, it returns a pointer to a string.
199
The contents of the string are such that a subsequent call with that string
200
(in the same locale) will restore the modifiers to the same settings.
201
If modifier_list is a NULL pointer,
202
<function>XSetLocaleModifiers</function>
203
also returns a pointer to such a string,
204
and the current locale modifiers are not changed.
208
If invalid values are given for one or more modifier categories supported by
209
the locale, a NULL pointer is returned, and none of the
210
current modifiers are changed.
215
the modifiers that are in effect are unspecified until
216
the first successful call to set them. Whenever the locale is changed, the
217
modifiers that are in effect become unspecified until the next successful call
219
Clients should always call
220
<function>XSetLocaleModifiers</function>
221
with a non-NULL modifier_list after setting the locale
222
before they call any locale-dependent Xlib routine.
226
The only standard modifier category currently defined is ``im'',
227
which identifies the desired input method.
228
The values for input method are not standardized.
229
A single locale may use multiple input methods,
230
switching input method under user control.
231
The modifier may specify the initial input method in effect
232
or an ordered list of input methods.
233
Multiple input methods may be specified in a single im value string
234
in an implementation-dependent manner.
238
The returned modifiers string is owned by Xlib and should not be modified or
240
It may be freed by Xlib after the current locale or modifiers are changed.
241
Until freed, it will not be modified by Xlib.
245
The recommended procedure for clients initializing their locale and modifiers
246
is to obtain locale and modifier announcers separately from
247
one of the following prioritized sources:
252
A command line option
262
The empty string ("")
268
The first of these that is defined should be used.
269
Note that when a locale command line option or locale resource is defined,
270
the effect should be to set all categories to the specified locale,
271
overriding any category-specific settings in the local host environment.
274
<sect1 id="Locale_and_Modifier_Dependencies">
275
<title>Locale and Modifier Dependencies</title>
277
<!-- (SN Locale and Modifier Dependencies -->
281
The internationalized Xlib functions operate in the current locale
282
configured by the host environment and X locale modifiers set by
283
<function>XSetLocaleModifiers</function>
284
or in the locale and modifiers configured at the time
285
some object supplied to the function was created.
286
For each locale-dependent function,
287
the following table describes the locale (and modifiers) dependency:
291
<tgroup cols='3' align='center'>
292
<colspec colname='c1'/>
293
<colspec colname='c2'/>
294
<colspec colname='c3'/>
297
<entry>Locale from</entry>
298
<entry>Affects the Function</entry>
305
<entry>Locale Query/Configuration:</entry>
308
<entry><function>setlocale</function></entry>
309
<entry><function>XSupportsLocale</function></entry>
310
<entry>Locale queried</entry>
314
<entry><function>XSetLocaleModifiers</function></entry>
315
<entry>Locale modified</entry>
322
<entry>Resources:</entry>
325
<entry><function>setlocale</function></entry>
326
<entry><function>XrmGetFileDatabase</function></entry>
327
<entry>Locale of <type>XrmDatabase</type></entry>
331
<entry><function>XrmGetStringDatabase</function></entry>
334
<entry><type>XrmDatabase</type></entry>
335
<entry><function>XrmPutFileDatabase</function></entry>
336
<entry>Locale of <type>XrmDatabase</type></entry>
340
<entry><function>XrmLocaleOfDatabase</function></entry>
347
<entry>Setting Standard Properties:</entry>
350
<entry><function>setlocale</function></entry>
351
<entry><function>XmbSetWMProperties</function></entry>
352
<entry>Encoding of supplied/returned
353
text (some WM_ property
354
text in environment locale)</entry>
357
<entry><function>setlocale</function></entry>
358
<entry><function>XmbTextPropertyToTextList</function></entry>
359
<entry>Encoding of supplied/returned text</entry>
363
<entry><function>XwcTextPropertyToTextList</function></entry>
367
<entry><function>XmbTextListToTextProperty</function></entry>
371
<entry><function>XwcTextListToTextProperty</function></entry>
378
<entry>Text Input:</entry>
381
<entry><function>setlocale</function></entry>
382
<entry><function>XOpenIM</function></entry>
383
<entry><acronym>XIM</acronym> input method selection</entry>
387
<entry><function>XRegisterIMInstantiateCallback</function></entry>
388
<entry><acronym>XIM</acronym> selection</entry>
392
<entry><function>XUnregisterIMInstantiateCallback</function></entry>
393
<entry><acronym>XIM</acronym> selection</entry>
396
<entry><type>XIM</type></entry>
397
<entry><function>XCreateIC</function></entry>
398
<entry><acronym>XIC</acronym> input method configuration</entry>
402
<entry><function>XLocaleOfIM</function>, and so on</entry>
403
<entry>Queried locale</entry>
406
<entry><type>XIC</type></entry>
407
<entry><function>XmbLookupString</function></entry>
408
<entry>Keyboard layout</entry>
412
<entry><function>XwcLookupString</function></entry>
413
<entry>Encoding of returned text</entry>
420
<entry>Text Drawing:</entry>
423
<entry><function>setlocale</function></entry>
424
<entry><function>XOpenOM</function></entry>
425
<entry><acronym>XOM</acronym> output method selection</entry>
429
<entry><function>XCreateFontSet</function></entry>
430
<entry>Charsets of fonts in XFontSet</entry>
433
<entry><type>XOM</type></entry>
434
<entry><function>XCreateOC</function></entry>
435
<entry><acronym>XOC</acronym> output method configuration</entry>
439
<entry><function>XLocaleOfOM</function>, and so on</entry>
440
<entry>Queried locale</entry>
443
<entry><type>XFontSet</type></entry>
444
<entry><function>XmbDrawText</function>,</entry>
445
<entry>Locale of supplied text</entry>
449
<entry><function>XwcDrawText</function>, and so on</entry>
450
<entry>Locale of supplied text</entry>
454
<entry><function>XExtentsOfFontSet</function>, and so on</entry>
455
<entry>Locale-dependent metrics</entry>
459
<entry><function>XmbTextExtents</function>,</entry>
463
<entry><function>XwcTextExtents</function>, and so on</entry>
470
<entry>Xlib Errors:</entry>
473
<entry><function>setlocale</function></entry>
474
<entry><function>XGetErrorDatabaseText</function></entry>
475
<entry>Locale of error message</entry>
479
<entry><function>XGetErrorText</function></entry>
487
Clients may assume that a locale-encoded text string returned
488
by an X function can be passed to a C library routine, or vice versa,
489
if the locale is the same at the two calls.
493
All text strings processed by internationalized Xlib functions are assumed
494
to begin in the initial state of the encoding of the locale, if the encoding
499
All Xlib functions behave as if they do not change the current locale
500
or X modifier setting.
501
(This means that if they do change locale or call
502
<function>XSetLocaleModifiers</function>
503
with a non-NULL argument, they must save and restore the current state on
505
Also, Xlib functions on implementations that conform to the ANSI C library do
506
not alter the global state associated with the ANSI C functions
507
<function>mblen</function>,
508
<function>mbtowc</function>,
509
<function>wctomb</function>,
511
<function>strtok</function>.
514
<sect1 id="Variable_Argument_Lists">
515
<title>Variable Argument Lists</title>
517
<!-- (SN Variable Argument Lists -->
521
Various functions in this chapter have arguments that conform
522
to the ANSI C variable argument list calling convention.
523
Each function denoted with an argument of the form ``...'' takes
524
a variable-length list of name and value pairs,
525
where each name is a string and each value is of type
526
<type>XPointer</type>.
527
A name argument that is NULL identifies the end of the list.
531
A variable-length argument list may contain a nested list.
533
<symbol>XNVaNestedList</symbol>
534
is specified in place of an argument name,
535
then the following value is interpreted as an
536
<type>XVaNestedList</type>
537
value that specifies a list of values logically inserted into the
538
original list at the point of declaration.
539
A NULL identifies the end of a nested list.
544
To allocate a nested variable argument list dynamically, use
545
<function>XVaCreateNestedList</function>.
546
<indexterm significance="preferred"><primary>XVaCreateNestedList</primary></indexterm>
550
<funcdef>XVaNestedList <function>XVaCreateNestedList</function></funcdef>
551
<paramdef>int<parameter> dummy</parameter></paramdef>
558
<emphasis remap='I'>dummy</emphasis>
562
Specifies an unused argument (required by ANSI C).
573
Specifies the variable length argument list(Al.
583
<function>XVaCreateNestedList</function>
584
function allocates memory and copies its arguments into
585
a single list pointer,
586
which may be used as a value for arguments requiring a list value.
587
Any entries are copied as specified.
588
Data passed by reference is not copied;
589
the caller must ensure data remains valid for the lifetime
591
The list should be freed using
592
<function>XFree</function>
593
when it is no longer needed.
596
<sect1 id="Output_Methods">
597
<title>Output Methods</title>
599
<!-- (SN Output Methods -->
603
This section provides discussions of the following X Output Method
604
(<acronym>XOM</acronym>) topics:
609
Output method overview
614
Output method functions
624
Output context functions
629
Output context values
634
Creating and freeing a font set
639
Obtaining font set metrics
644
Drawing text using font sets
648
<sect2 id="Output_Method_Overview">
649
<title>Output Method Overview</title>
651
<!-- (SN Output Method Overview -->
655
Locale-dependent text may include one or more text components, each of
656
which may require different fonts and character set encodings.
657
In some languages, each component might have a different
658
drawing direction, and some components might contain
659
context-dependent characters that change shape based on
660
relationships with neighboring characters.
664
When drawing such locale-dependent text, some locale-specific
665
knowledge is required;
666
for example, what fonts are required to draw the text,
667
how the text can be separated into components, and which
668
fonts are selected to draw each component.
669
Further, when bidirectional text must be drawn,
670
the internal representation order of the text must be changed
671
into the visual representation order to be drawn.
675
An X Output Method provides a functional interface so that clients
676
do not have to deal directly with such locale-dependent details.
677
Output methods provide the following capabilities:
682
Creating a set of fonts required to draw locale-dependent text.
687
Drawing locale-dependent text with a font set without the caller
688
needing to be aware of locale dependencies.
693
Obtaining the escapement and extents in pixels of locale-dependent text.
698
Determining if bidirectional or context-dependent drawing is required
699
in a specific locale with a specific font set.
705
Two different abstractions are used in the representation of
706
the output method for clients.
710
The abstraction used to communicate with an output method
711
is an opaque data structure represented by the
714
The abstraction for representing the state of a particular output thread
715
is called an <emphasis remap='I'>output context</emphasis>.
716
The Xlib representation of an output context is an
718
which is compatible with
719
<type>XFontSet</type>
720
in terms of its functional interface, but is
721
a broader, more generalized abstraction.
724
<sect2 id="Output_Method_Functions">
725
<title>Output Method Functions</title>
727
<!-- (SN Output Method Functions -->
731
To open an output method, use
732
<function>XOpenOM</function>.
733
<indexterm significance="preferred"><primary>XOpenOM</primary></indexterm>
737
<funcdef>XOM <function>XOpenOM</function></funcdef>
738
<paramdef>Display<parameter> *display</parameter></paramdef>
739
<paramdef>XrmDatabase<parameter> db</parameter></paramdef>
740
<paramdef>char<parameter> *res_name</parameter></paramdef>
741
<paramdef>char<parameter> *res_class</parameter></paramdef>
748
<emphasis remap='I'>display</emphasis>
752
Specifies the connection to the X server.
758
<emphasis remap='I'>db</emphasis>
762
Specifies a pointer to the resource database.
768
<emphasis remap='I'>res_name</emphasis>
772
Specifies the full resource name of the application.
778
<emphasis remap='I'>res_class</emphasis>
782
Specifies the full class name of the application.
792
<function>XOpenOM</function>
793
function opens an output method
794
matching the current locale and modifiers specification.
795
The current locale and modifiers are bound to the output method
797
<function>XOpenOM</function>
799
The locale associated with an output method cannot be changed.
803
The specific output method to which this call will be routed
804
is identified on the basis of the current locale and modifiers.
805
<function>XOpenOM</function>
806
will identify a default output method corresponding to the
808
That default can be modified using
809
<function>XSetLocaleModifiers</function>
810
to set the output method modifier.
814
The db argument is the resource database to be used by the output method
815
for looking up resources that are private to the output method.
816
It is not intended that this database be used to look
817
up values that can be set as OC values in an output context.
819
no database is passed to the output method.
823
The res_name and res_class arguments specify the resource name
824
and class of the application.
825
They are intended to be used as prefixes by the output method
826
when looking up resources that are common to all output contexts
827
that may be created for this output method.
828
The characters used for resource names and classes must be in the
829
X Portable Character Set.
830
The resources looked up are not fully specified
831
if res_name or res_class is NULL.
835
The res_name and res_class arguments are not assumed to exist beyond
837
<function>XOpenOM</function>.
838
The specified resource database is assumed to exist for the lifetime
839
of the output method.
843
<function>XOpenOM</function>
844
returns NULL if no output method could be opened.
849
To close an output method, use
850
<function>XCloseOM</function>.
851
<indexterm significance="preferred"><primary>XCloseOM</primary></indexterm>
855
<funcdef>Status <function>XCloseOM</function></funcdef>
856
<paramdef>XOM<parameter> om</parameter></paramdef>
863
<emphasis remap='I'>om</emphasis>
867
Specifies the output method.
877
<function>XCloseOM</function>
878
function closes the specified output method.
883
To set output method attributes, use
884
<function>XSetOMValues</function>.
885
<indexterm significance="preferred"><primary>XSetOMValues</primary></indexterm>
889
<funcdef>char *<function>XSetOMValues</function></funcdef>
890
<paramdef>XOM<parameter> om</parameter></paramdef>
897
<emphasis remap='I'>om</emphasis>
901
Specifies the output method.
902
<!-- .ds Al \ to set <acronym>XOM</acronym> values -->
912
Specifies the variable-length argument list(Al.
922
<function>XSetOMValues</function>
923
function presents a variable argument list programming interface
924
for setting properties or features of the specified output method.
925
This function returns NULL if it succeeds;
927
it returns the name of the first argument that could not be obtained.
931
No standard arguments are currently defined by Xlib.
936
To query an output method, use
937
<function>XGetOMValues</function>.
938
<indexterm significance="preferred"><primary>XGetOMValues</primary></indexterm>
942
<funcdef>char *<function>XGetOMValues</function></funcdef>
943
<paramdef>XOM<parameter> om</parameter></paramdef>
950
<emphasis remap='I'>om</emphasis>
954
Specifies the output method.
955
<!-- .ds Al \ to get XOM values -->
965
Specifies the variable-length argument list(Al.
975
<function>XGetOMValues</function>
976
function presents a variable argument list programming interface
977
for querying properties or features of the specified output method.
978
This function returns NULL if it succeeds;
980
it returns the name of the first argument that could not be obtained.
984
To obtain the display associated with an output method, use
985
<function>XDisplayOfOM</function>.
986
<indexterm significance="preferred"><primary>XDisplayOfOM</primary></indexterm>
990
<funcdef>Display *<function>XDisplayOfOM</function></funcdef>
991
<paramdef>XOM<parameter> om</parameter></paramdef>
998
<emphasis remap='I'>om</emphasis>
1002
Specifies the output method.
1012
<function>XDisplayOfOM</function>
1013
function returns the display associated with the specified output method.
1018
To get the locale associated with an output method, use
1019
<function>XLocaleOfOM</function>.
1020
<indexterm significance="preferred"><primary>XLocaleOfOM</primary></indexterm>
1024
<funcdef>char *<function>XLocaleOfOM</function></funcdef>
1025
<paramdef>XOM<parameter> om</parameter></paramdef>
1032
<emphasis remap='I'>om</emphasis>
1036
Specifies the output method.
1046
<function>XLocaleOfOM</function>
1047
returns the locale associated with the specified output method.
1050
<sect2 id="X_Output_Method_Values">
1051
<title>X Output Method Values</title>
1053
<!-- (SN X Output Method Values -->
1057
The following table describes how <acronym>XOM</acronym> values are interpreted by an
1059
The first column lists the <acronym>XOM</acronym> values. The second column indicates
1060
how each of the <acronym>XOM</acronym> values are treated by a particular output style.
1067
The following key applies to this table.
1071
<tgroup cols='2' align='center'>
1072
<colspec colname='c1'/>
1073
<colspec colname='c2'/>
1077
<entry>Explanation</entry>
1083
<entry>This value may be read using <function>XGetOMValues</function>.</entry>
1090
<tgroup cols='2' align='center'>
1091
<colspec colname='c1'/>
1092
<colspec colname='c2'/>
1095
<entry><acronym>XOM</acronym> Value</entry>
1101
<entry><symbol>XNRequiredCharSet</symbol></entry>
1105
<entry><symbol>XNQueryOrientation</symbol></entry>
1109
<entry><symbol>XNDirectionalDependentDrawing</symbol></entry>
1113
<entry><symbol>XNContextualDrawing</symbol></entry>
1123
<sect3 id="Required_Char_Set">
1124
<title>Required Char Set</title>
1126
<!-- (SN Required Char Set -->
1131
<symbol>XNRequiredCharSet</symbol>
1132
argument returns the list of charsets that are required for loading the fonts
1133
needed for the locale.
1134
The value of the argument is a pointer to a structure of type
1135
<structname>XOMCharSetList</structname>.
1140
<structname>XOMCharSetList</structname>
1141
structure is defined as follows:
1142
<indexterm significance="preferred"><primary>XOMCharSetList</primary></indexterm>
1146
<literallayout class="monospaced">
1147
<!-- .TA .5i 2.5i -->
1148
<!-- .ta .5i 2.5i -->
1151
char **charset_list;
1158
The charset_list member is a list of one or more null-terminated
1159
charset names, and the charset_count member is the number of
1164
The required charset list is owned by Xlib and should not be modified or
1165
freed by the client.
1166
It will be freed by a call to
1167
<function>XCloseOM</function>
1170
Until freed, its contents will not be modified by Xlib.
1176
<sect3 id="Query_Orientation">
1177
<title>Query Orientation</title>
1179
<!-- (SN Query Orientation -->
1184
<symbol>XNQueryOrientation</symbol>
1185
argument returns the global orientation of text when drawn.
1187
<constant>XOMOrientation_LTR_TTB</constant>,
1188
the set of orientations supported is locale-dependent.
1189
The value of the argument is a pointer to a structure of type
1190
<structname>XOMOrientation</structname>.
1191
Clients are responsible for freeing the
1192
<structname>XOMOrientation</structname>
1194
<function>XFree</function>;
1195
this also frees the contents of the structure.
1200
<literallayout class="monospaced">
1201
<!-- .TA .5i 2.5i -->
1202
<!-- .ta .5i 2.5i -->
1204
int num_orientation;
1205
XOrientation *orientation; /* Input Text description */
1209
XOMOrientation_LTR_TTB,
1210
XOMOrientation_RTL_TTB,
1211
XOMOrientation_TTB_LTR,
1212
XOMOrientation_TTB_RTL,
1213
XOMOrientation_Context
1220
The possible value for XOrientation may be:
1225
<constant>XOMOrientation_LTR_TTB</constant>
1226
left-to-right, top-to-bottom global orientation
1231
<constant>XOMOrientation_RTL_TTB</constant>
1232
right-to-left, top-to-bottom global orientation
1237
<constant>XOMOrientation_TTB_LTR</constant>
1238
top-to-bottom, left-to-right global orientation
1243
<constant>XOMOrientation_TTB_RTL</constant>
1244
top-to-bottom, right-to-left global orientation
1249
<constant>XOMOrientation_Context</constant>
1250
contextual global orientation
1258
<sect3 id="Directional_Dependent_Drawing">
1259
<title>Directional Dependent Drawing</title>
1261
<!-- (SN Directional Dependent Drawing -->
1266
<symbol>XNDirectionalDependentDrawing</symbol>
1267
argument indicates whether the text rendering functions
1268
implement implicit handling of directional text. If this value
1270
<symbol>True</symbol>,
1271
the output method has knowledge of directional
1272
dependencies and reorders text as necessary when
1273
rendering text. If this value is
1274
<symbol>False</symbol>,
1275
the output method does not implement any directional text
1276
handling, and all character directions are assumed to be left-to-right.
1280
Regardless of the rendering order of characters,
1281
the origins of all characters are on the primary draw direction side
1282
of the drawing origin.
1286
This OM value presents functionality identical to the
1287
<function>XDirectionalDependentDrawing</function>
1291
<sect3 id="Context_Dependent_Drawing">
1292
<title>Context Dependent Drawing</title>
1294
<!-- (SN Context Dependent Drawing -->
1299
<symbol>XNContextualDrawing</symbol>
1300
argument indicates whether the text rendering functions
1301
implement implicit context-dependent drawing. If this value is
1302
<symbol>True</symbol>,
1303
the output method has knowledge of context dependencies and
1304
performs character shape editing, combining glyphs to present
1305
a single character as necessary. The actual shape editing is
1306
dependent on the locale implementation and the font set used.
1310
This OM value presents functionality identical to the
1311
<function>XContextualDrawing</function>
1316
<sect2 id="Output_Context_Functions">
1317
<title>Output Context Functions</title>
1319
<!-- (SN Output Context Functions -->
1323
An output context is an abstraction that contains both the data
1324
required by an output method and the information required
1325
to display that data.
1326
There can be multiple output contexts for one output method.
1327
The programming interfaces for creating, reading, or modifying
1328
an output context use a variable argument list.
1329
The name elements of the argument lists are referred to as <acronym>XOC</acronym> values.
1330
It is intended that output methods be controlled by these <acronym>XOC</acronym> values.
1331
As new <acronym>XOC</acronym> values are created,
1332
they should be registered with the X Consortium.
1335
can be used anywhere an
1336
<type>XFontSet</type>
1337
can be used, and vice versa;
1338
<type>XFontSet</type>
1339
is retained for compatibility with previous releases.
1340
The concepts of output methods and output contexts include broader,
1341
more generalized abstraction than font set,
1342
supporting complex and more intelligent text display, and dealing not only
1343
with multiple fonts but also with context dependencies.
1345
<type>XFontSet</type>
1346
is widely used in several interfaces, so
1348
is defined as an upward compatible type of
1349
<type>XFontSet</type>.
1354
To create an output context, use
1355
<function>XCreateOC</function>.
1356
<indexterm significance="preferred"><primary>XCreateOC</primary></indexterm>
1360
<funcdef>XOC <function>XCreateOC</function></funcdef>
1361
<paramdef>XOM<parameter> om</parameter></paramdef>
1368
<emphasis remap='I'>om</emphasis>
1372
Specifies the output method.
1373
<!-- .ds Al \ to set <acronym>XOC</acronym> values -->
1383
Specifies the variable-length argument list(Al.
1393
<function>XCreateOC</function>
1394
function creates an output context within the specified output method.
1398
The base font names argument is mandatory at creation time, and
1399
the output context will not be created unless it is provided.
1400
All other output context values can be set later.
1404
<function>XCreateOC</function>
1405
returns NULL if no output context could be created.
1406
NULL can be returned for any of the following reasons:
1411
A required argument was not set.
1416
A read-only argument was set.
1421
An argument name is not recognized.
1426
The output method encountered an output method implementation-dependent error.
1432
<function>XCreateOC</function>
1434
<errorname>BadAtom</errorname>
1440
To destroy an output context, use
1441
<function>XDestroyOC</function>.
1442
<indexterm significance="preferred"><primary>XDestroyOC</primary></indexterm>
1446
<funcdef>void <function>XDestroyOC</function></funcdef>
1447
<paramdef>XOC<parameter> oc</parameter></paramdef>
1454
<emphasis remap='I'>oc</emphasis>
1458
Specifies the output context.
1468
<function>XDestroyOC</function>
1469
function destroys the specified output context.
1474
To get the output method associated with an output context, use
1475
<function>XOMOfOC</function>.
1476
<indexterm significance="preferred"><primary>XOMOfOC</primary></indexterm>
1480
<funcdef>XOM <function>XOMOfOC</function></funcdef>
1481
<paramdef>XOC<parameter> oc</parameter></paramdef>
1488
<emphasis remap='I'>oc</emphasis>
1492
Specifies the output context.
1502
<function>XOMOfOC</function>
1503
function returns the output method associated with the
1504
specified output context.
1509
Xlib provides two functions for setting and reading output context values,
1511
<function>XSetOCValues</function>
1513
<function>XGetOCValues</function>.
1514
Both functions have a variable-length argument list.
1515
In that argument list, any <acronym>XOC</acronym> value's name must be denoted
1516
with a character string using the X Portable Character Set.
1521
To set <acronym>XOC</acronym> values, use
1522
<function>XSetOCValues</function>.
1523
<indexterm significance="preferred"><primary>XSetOCValues</primary></indexterm>
1527
<funcdef>char *<function>XSetOCValues</function></funcdef>
1528
<paramdef>XOC<parameter> oc</parameter></paramdef>
1535
<emphasis remap='I'>oc</emphasis>
1539
Specifies the output context.
1540
<!-- .ds Al \ to set <acronym>XOC</acronym> values -->
1550
Specifies the variable-length argument list(Al.
1560
<function>XSetOCValues</function>
1561
function returns NULL if no error occurred;
1563
it returns the name of the first argument that could not be set.
1564
An argument might not be set for any of the following reasons:
1569
The argument is read-only.
1574
The argument name is not recognized.
1579
An implementation-dependent error occurs.
1585
Each value to be set must be an appropriate datum,
1586
matching the data type imposed by the semantics of the argument.
1590
<function>XSetOCValues</function>
1592
<errorname>BadAtom</errorname>
1598
To obtain <acronym>XOC</acronym> values, use
1599
<function>XGetOCValues</function>.
1600
<indexterm significance="preferred"><primary>XGetOCValues</primary></indexterm>
1604
<funcdef>char *<function>XGetOCValues</function></funcdef>
1605
<paramdef>XOC<parameter> oc</parameter></paramdef>
1612
<emphasis remap='I'>oc</emphasis>
1616
Specifies the output context.
1617
<!-- .ds Al \ to get XOC values -->
1627
Specifies the variable-length argument list(Al.
1637
<function>XGetOCValues</function>
1638
function returns NULL if no error occurred; otherwise,
1639
it returns the name of the first argument that could not be obtained.
1640
An argument might not be obtained for any of the following reasons:
1645
The argument name is not recognized.
1650
An implementation-dependent error occurs.
1657
following a name must point to a location where the value is to be stored.
1661
<sect2 id="Output_Context_Values">
1662
<title>Output Context Values</title>
1664
<!-- (SN Output Context Values -->
1668
The following table describes how <acronym>XOC</acronym> values are interpreted
1669
by an output method.
1670
The first column lists the <acronym>XOC</acronym> values.
1671
The second column indicates the alternative interfaces that function
1672
identically and are provided for compatibility with previous releases.
1673
The third column indicates how each of the <acronym>XOC</acronym> values is treated.
1677
The following keys apply to this table.
1680
<tgroup cols='2' align='center'>
1681
<colspec colname='c1'/>
1682
<colspec colname='c2'/>
1686
<entry>Explanation</entry>
1692
<entry>This value must be set with <function>XCreateOC</function>.</entry>
1696
<entry>This value may be set using <function>XCreateOC</function>.
1697
If it is not set,a default is provided.</entry>
1701
<entry>This value may be read using <function>XGetOCValues</function>.</entry>
1705
<entry>This value must be set using <function>XSetOCValues</function>.</entry>
1713
<tgroup cols='3' align='center'>
1714
<colspec colname='c1'/>
1715
<colspec colname='c2'/>
1716
<colspec colname='c3'/>
1719
<entry><acronym>XOC</acronym> Value</entry>
1720
<entry>Alternative Interface</entry>
1726
<entry>BaseFontName</entry>
1727
<entry><function>XCreateFontSet</function></entry>
1731
<entry>MissingCharSet</entry>
1732
<entry><function>XCreateFontSet</function></entry>
1736
<entry>DefaultString</entry>
1737
<entry><function>XCreateFontSet</function></entry>
1741
<entry>Orientation</entry>
1743
<entry>D-S-G</entry>
1746
<entry>ResourceName</entry>
1751
<entry>ResourceClass</entry>
1756
<entry>FontInfo</entry>
1757
<entry><function>XFontsOfFontSet</function></entry>
1761
<entry>OMAutomatic</entry>
1772
<sect3 id="Base_Font_Name">
1773
<title>Base Font Name</title>
1775
<!-- (SN Base Font Name -->
1780
<symbol>XNBaseFontName</symbol>
1781
argument is a list of base font names that Xlib uses
1782
to load the fonts needed for the locale.
1783
The base font names are a comma-separated list. The string is null-terminated
1784
and is assumed to be in the Host Portable Character Encoding;
1785
otherwise, the result is implementation-dependent.
1786
White space immediately on either side of a separating comma is ignored.
1790
Use of <acronym>XLFD</acronym> font names permits Xlib to obtain the fonts needed for a
1791
variety of locales from a single locale-independent base font name.
1792
The single base font name should name a family of fonts whose members
1793
are encoded in the various charsets needed by the locales of interest.
1797
An <acronym>XLFD</acronym> base font name can explicitly name a charset needed for the locale.
1798
This allows the user to specify an exact font for use with a charset required
1799
by a locale, fully controlling the font selection.
1803
If a base font name is not an <acronym>XLFD</acronym> name,
1804
Xlib will attempt to obtain an <acronym>XLFD</acronym> name from the font properties
1806
If Xlib is successful, the
1807
<function>XGetOCValues</function>
1808
function will return this <acronym>XLFD</acronym> name instead of the client-supplied name.
1812
This argument must be set at creation time
1813
and cannot be changed.
1814
If no fonts exist for any of the required charsets,
1815
or if the locale definition in Xlib requires that a font exist
1816
for a particular charset and a font is not found for that charset,
1817
<function>XCreateOC</function>
1822
When querying for the
1823
<symbol>XNBaseFontName</symbol>
1824
<acronym>XOC</acronym> value,
1825
<function>XGetOCValues</function>
1826
returns a null-terminated string identifying the base font names that
1827
Xlib used to load the fonts needed for the locale.
1828
This string is owned by Xlib and should not be modified or freed by
1830
The string will be freed by a call to
1831
<function>XDestroyOC</function>
1834
Until freed, the string contents will not be modified by Xlib.
1837
<sect3 id="Missing_CharSet">
1838
<title>Missing CharSet</title>
1840
<!-- (SN Missing CharSet -->
1845
<symbol>XNMissingCharSet</symbol>
1846
argument returns the list of required charsets that are missing from the
1848
The value of the argument is a pointer to a structure of type
1849
<structname>XOMCharSetList</structname>.
1853
If fonts exist for all of the charsets required by the current locale,
1854
charset_list is set to NULL and charset_count is set to zero.
1855
If no fonts exist for one or more of the required charsets,
1856
charset_list is set to a list of one or more null-terminated charset names
1857
for which no fonts exist, and charset_count is set to the number of
1859
The charsets are from the list of the required charsets for
1860
the encoding of the locale and do not include any charsets to which Xlib
1861
may be able to remap a required charset.
1865
The missing charset list is owned by Xlib and should not be modified or
1866
freed by the client.
1867
It will be freed by a call to
1868
<function>XDestroyOC</function>
1871
Until freed, its contents will not be modified by Xlib.
1874
<sect3 id="Default_String">
1875
<title>Default String</title>
1877
<!-- (SN Default String -->
1881
When a drawing or measuring function is called with an
1883
that has missing charsets, some characters in the locale will not be
1886
<symbol>XNDefaultString</symbol>
1887
argument returns a pointer to a string that represents the glyphs
1888
that are drawn with this
1890
when the charsets of the available fonts do not include all glyphs
1891
required to draw a character.
1892
The string does not necessarily consist of valid characters
1893
in the current locale and is not necessarily drawn with
1894
the fonts loaded for the font set,
1895
but the client can draw or measure the default glyphs
1896
by including this string in a string being drawn or measured with the
1902
<symbol>XNDefaultString</symbol>
1903
argument returned the empty string (""),
1904
no glyphs are drawn and the escapement is zero.
1905
The returned string is null-terminated.
1906
It is owned by Xlib and should not be modified or freed by the client.
1907
It will be freed by a call to
1908
<function>XDestroyOC</function>
1911
Until freed, its contents will not be modified by Xlib.
1914
<sect3 id="Orientation">
1915
<title>Orientation</title>
1917
<!-- (SN Orientation -->
1922
<symbol>XNOrientation</symbol>
1923
argument specifies the current orientation of text when drawn. The value of
1924
this argument is one of the values returned by the
1925
<function>XGetOMValues</function>
1927
<symbol>XNQueryOrientation</symbol>
1928
argument specified in the
1929
<type>XOrientation</type>
1931
The value of the argument is of type
1932
<type>XOrientation</type>.
1934
<symbol>XNOrientation</symbol>
1935
is queried, the value specifies the current orientation.
1937
<symbol>XNOrientation</symbol>
1938
is set, a value is used to set the current orientation.
1943
<constant>XOMOrientation_Context</constant>
1944
is set, the text orientation of the
1945
text is determined according to an implementation-defined method
1946
(for example, ISO 6429 control sequences), and the initial text orientation for
1947
locale-dependent Xlib functions is assumed to
1949
<constant>XOMOrientation_LTR_TTB</constant>.
1954
<symbol>XNOrientation</symbol>
1955
value does not change the prime drawing direction
1956
for Xlib drawing functions.
1959
<sect3 id="Resource_Name_and_Class">
1960
<title>Resource Name and Class</title>
1962
<!-- (SN Resource Name and Class -->
1967
<symbol>XNResourceName</symbol>
1969
<symbol>XNResourceClass</symbol>
1970
arguments are strings that specify the full name and class
1971
used by the client to obtain resources for the display of the output context.
1972
These values should be used as prefixes for name and class
1973
when looking up resources that may vary according to the output context.
1974
If these values are not set,
1975
the resources will not be fully specified.
1979
It is not intended that values that can be set as <acronym>XOM</acronym> values be
1984
When querying for the
1985
<symbol>XNResourceName</symbol>
1987
<symbol>XNResourceClass</symbol>
1988
<acronym>XOC</acronym> value,
1989
<function>XGetOCValues</function>
1990
returns a null-terminated string.
1991
This string is owned by Xlib and should not be modified or freed by
1993
The string will be freed by a call to
1994
<function>XDestroyOC</function>
1997
or when the associated value is changed via
1998
<function>XSetOCValues</function>.
1999
Until freed, the string contents will not be modified by Xlib.
2002
<sect3 id="Font_Info">
2003
<title>Font Info</title>
2005
<!-- (SN Font Info -->
2010
<symbol>XNFontInfo</symbol>
2011
argument specifies a list of one or more
2012
<structname>XFontStruct</structname>
2014
and font names for the fonts used for drawing by the given output context.
2015
The value of the argument is a pointer to a structure of type
2016
<structname>XOMFontInfo</structname>.
2021
<literallayout class="monospaced">
2022
<!-- .TA .5i 2.5i -->
2023
<!-- .ta .5i 2.5i -->
2026
XFontStruct **font_struct_list;
2027
char **font_name_list;
2034
A list of pointers to the
2035
<structname>XFontStruct</structname>
2036
structures is returned to font_struct_list.
2037
A list of pointers to null-terminated, fully-specified font name strings
2038
in the locale of the output context is returned to font_name_list.
2039
The font_name_list order corresponds to the font_struct_list order.
2041
<structname>XFontStruct</structname>
2042
structures and font names is returned to num_font.
2046
Because it is not guaranteed that a given character will be imaged using a
2048
there is no provision for mapping a character or default string
2049
to the font properties, font ID, or direction hint for the font
2051
The client may access the
2052
<structname>XFontStruct</structname>
2053
list to obtain these values for all the fonts currently in use.
2057
Xlib does not guarantee that fonts are loaded from the server
2058
at the creation of an
2060
Xlib may choose to cache font data, loading it only as needed to draw text
2061
or compute text dimensions.
2062
Therefore, existence of the per_char metrics in the
2063
<structname>XFontStruct</structname>
2065
<structname>XFontStructSet</structname>
2067
Also, note that all properties in the
2068
<structname>XFontStruct</structname>
2069
structures are in the STRING encoding.
2073
The client must not free the
2074
<structname>XOMFontInfo</structname>
2075
struct itself; it will be freed when the
2080
<sect3 id="OM_Automatic">
2081
<title>OM Automatic</title>
2083
<!-- (SN OM Automatic -->
2088
<symbol>XNOMAutomatic</symbol>
2089
argument returns whether the associated output context was created by
2090
<function>XCreateFontSet</function>
2092
<function>XFreeFontSet</function>
2093
function not only destroys the output context but also closes the implicit
2094
output method associated with it,
2095
<function>XFreeFontSet</function>
2096
should be used with any output context created by
2097
<function>XCreateFontSet</function>.
2098
However, it is possible that a client does not know how the output context
2100
Before a client destroys the output context,
2101
it can query whether
2102
<symbol>XNOMAutomatic</symbol>
2103
is set to determine whether
2104
<function>XFreeFontSet</function>
2106
<function>XDestroyOC</function>
2107
should be used to destroy the output context.
2111
<sect2 id="Creating_and_Freeing_a_Font_Set">
2112
<title>Creating and Freeing a Font Set</title>
2114
<!-- (SN Creating and Freeing a Font Set -->
2118
Xlib international text drawing is done using a set of one or more fonts,
2119
as needed for the locale of the text.
2120
Fonts are loaded according to a list of base font names
2121
supplied by the client and the charsets required by the locale.
2123
<type>XFontSet</type>
2124
is an opaque type representing the state of a particular output thread
2125
and is equivalent to the type
2132
<function>XCreateFontSet</function>
2133
function is a convenience function for creating an output context using
2134
only default values. The returned
2135
<type>XFontSet</type>
2136
has an implicitly created
2141
<symbol>XNOMAutomatic</symbol>
2142
automatically set to
2143
<symbol>True</symbol>
2144
so that the output context self indicates whether it was created by
2145
<function>XCreateOC</function>
2147
<function>XCreateFontSet</function>.
2148
<indexterm significance="preferred"><primary>XCreateFontSet</primary></indexterm>
2152
<funcdef>XFontSet <function>XCreateFontSet</function></funcdef>
2153
<paramdef>Display<parameter> *display</parameter></paramdef>
2154
<paramdef>char<parameter> *base_font_name_list</parameter></paramdef>
2155
<paramdef>char<parameter> ***missing_charset_list_return</parameter></paramdef>
2156
<paramdef>int<parameter> *missing_charset_count_return</parameter></paramdef>
2157
<paramdef>char<parameter> **def_string_return</parameter></paramdef>
2164
<emphasis remap='I'>display</emphasis>
2168
Specifies the connection to the X server.
2174
<emphasis remap='I'>base_font_name_list</emphasis>
2178
Specifies the base font names.
2184
<emphasis remap='I'>missing_charset_list_return</emphasis>
2188
Returns the missing charsets.
2194
<emphasis remap='I'>missing_charset_count_return</emphasis>
2198
Returns the number of missing charsets.
2204
<emphasis remap='I'>def_string_return</emphasis>
2208
Returns the string drawn for missing charsets.
2218
<function>XCreateFontSet</function>
2219
function creates a font set for the specified display.
2220
The font set is bound to the current locale when
2221
<function>XCreateFontSet</function>
2223
The font set may be used in subsequent calls to obtain font
2224
and character information and to image text in the locale of the font set.
2228
The base_font_name_list argument is a list of base font names
2229
that Xlib uses to load the fonts needed for the locale.
2230
The base font names are a comma-separated list.
2231
The string is null-terminated
2232
and is assumed to be in the Host Portable Character Encoding;
2233
otherwise, the result is implementation-dependent.
2234
White space immediately on either side of a separating comma is ignored.
2238
Use of <acronym>XLFD</acronym> font names permits Xlib to obtain the fonts needed for a
2239
variety of locales from a single locale-independent base font name.
2240
The single base font name should name a family of fonts whose members
2241
are encoded in the various charsets needed by the locales of interest.
2245
An <acronym>XLFD</acronym> base font name can explicitly name a charset needed for the locale.
2246
This allows the user to specify an exact font for use with a charset required
2247
by a locale, fully controlling the font selection.
2251
If a base font name is not an <acronym>XLFD</acronym> name,
2252
Xlib will attempt to obtain an <acronym>XLFD</acronym> name from the font properties
2254
If this action is successful in obtaining an <acronym>XLFD</acronym> name, the
2255
<function>XBaseFontNameListOfFontSet</function>
2256
function will return this <acronym>XLFD</acronym> name instead of the client-supplied name.
2260
Xlib uses the following algorithm to select the fonts
2261
that will be used to display text with the
2262
<type>XFontSet</type>.
2266
For each font charset required by the locale,
2267
the base font name list is searched for the first appearance of one
2268
of the following cases that names a set of fonts that exist at the server:
2273
The first <acronym>XLFD</acronym>-conforming base font name that specifies the required
2274
charset or a superset of the required charset in its
2275
<structfield>CharSetRegistry</structfield>
2277
<structfield>CharSetEncoding</structfield>
2279
The implementation may use a base font name whose specified charset
2280
is a superset of the required charset, for example,
2281
an ISO8859-1 font for an ASCII charset.
2286
The first set of one or more <acronym>XLFD</acronym>-conforming base font names
2287
that specify one or more charsets that can be remapped to support the
2289
The Xlib implementation may recognize various mappings
2290
from a required charset to one or more other charsets
2291
and use the fonts for those charsets.
2292
For example, JIS Roman is ASCII with tilde and backslash replaced
2294
Xlib may load an ISO8859-1 font to support this character set
2295
if a JIS Roman font is not available.
2300
The first <acronym>XLFD</acronym>-conforming font name or the first non-<acronym>XLFD</acronym> font name
2301
for which an <acronym>XLFD</acronym> font name can be obtained, combined with the
2302
required charset (replacing the
2303
<structfield>CharSetRegistry</structfield>
2305
<structfield>CharSetEncoding</structfield>
2306
fields in the <acronym>XLFD</acronym> font name).
2308
the implementation may use a charset that is a superset
2309
of the required charset.
2314
The first font name that can be mapped in some implementation-dependent
2315
manner to one or more fonts that support imaging text in the charset.
2321
For example, assume that a locale required the charsets:
2325
<literallayout class="monospaced">
2334
The user could supply a base_font_name_list that explicitly specifies the
2335
charsets, ensuring that specific fonts are used if they exist.
2340
<literallayout class="monospaced">
2341
"-JIS-Fixed-Medium-R-Normal--26-180-100-100-C-240-JISX0208.1983-0,\\
2342
-JIS-Fixed-Medium-R-Normal--26-180-100-100-C-120-JISX0201.1976-0,\\
2343
-GB-Fixed-Medium-R-Normal--26-180-100-100-C-240-GB2312-1980.0,\\
2344
-Adobe-Courier-Bold-R-Normal--25-180-75-75-M-150-ISO8859-1"
2349
Alternatively, the user could supply a base_font_name_list
2350
that omits the charsets,
2351
letting Xlib select font charsets required for the locale.
2356
<literallayout class="monospaced">
2357
"-JIS-Fixed-Medium-R-Normal--26-180-100-100-C-240,\\
2358
-JIS-Fixed-Medium-R-Normal--26-180-100-100-C-120,\\
2359
-GB-Fixed-Medium-R-Normal--26-180-100-100-C-240,\\
2360
-Adobe-Courier-Bold-R-Normal--25-180-100-100-M-150"
2365
Alternatively, the user could simply supply a single base font name
2366
that allows Xlib to select from all available fonts
2367
that meet certain minimum <acronym>XLFD</acronym> property requirements.
2372
<literallayout class="monospaced">
2373
"-*-*-*-R-Normal--*-180-100-100-*-*"
2379
<function>XCreateFontSet</function>
2380
is unable to create the font set,
2381
either because there is insufficient memory or because the current locale
2383
<function>XCreateFontSet</function>
2384
returns NULL, missing_charset_list_return is set to NULL,
2385
and missing_charset_count_return
2387
If fonts exist for all of the charsets required by the current locale,
2388
<function>XCreateFontSet</function>
2390
<type>XFontSet</type>,
2391
missing_charset_list_return is set to NULL,
2392
and missing_charset_count_return is set to zero.
2396
If no font exists for one or more of the required charsets,
2397
<function>XCreateFontSet</function>
2398
sets missing_charset_list_return to a
2399
list of one or more null-terminated charset names for which no font exists
2400
and sets missing_charset_count_return to the number of missing fonts.
2401
The charsets are from the list of the required charsets for
2402
the encoding of the locale and do not include any charsets to which Xlib
2403
may be able to remap a required charset.
2407
If no font exists for any of the required charsets
2408
or if the locale definition in Xlib requires that a font exist
2409
for a particular charset and a font is not found for that charset,
2410
<function>XCreateFontSet</function>
2413
<function>XCreateFontSet</function>
2415
<type>XFontSet</type>
2420
When an Xmb/wc drawing or measuring function is called with an
2421
<type>XFontSet</type>
2422
that has missing charsets, some characters in the locale will not be
2424
If def_string_return is non-NULL,
2425
<function>XCreateFontSet</function>
2426
returns a pointer to a string that represents the glyphs
2427
that are drawn with this
2428
<type>XFontSet</type>
2429
when the charsets of the available fonts do not include all font glyphs
2430
required to draw a codepoint.
2431
The string does not necessarily consist of valid characters
2432
in the current locale and is not necessarily drawn with
2433
the fonts loaded for the font set,
2434
but the client can draw and measure the default glyphs
2435
by including this string in a string being drawn or measured with the
2436
<type>XFontSet</type>.
2440
If the string returned to def_string_return is the empty string (""),
2441
no glyphs are drawn, and the escapement is zero.
2442
The returned string is null-terminated.
2443
It is owned by Xlib and should not be modified or freed by the client.
2444
It will be freed by a call to
2445
<function>XFreeFontSet</function>
2447
<type>XFontSet</type>.
2448
Until freed, its contents will not be modified by Xlib.
2452
The client is responsible for constructing an error message from the
2453
missing charset and default string information and may choose to continue
2454
operation in the case that some fonts did not exist.
2459
<type>XFontSet</type>
2460
and missing charset list should be freed with
2461
<function>XFreeFontSet</function>
2463
<function>XFreeStringList</function>,
2465
The client-supplied base_font_name_list may be freed
2466
by the client after calling
2467
<function>XCreateFontSet</function>.
2473
<structname>XFontStruct</structname>
2474
structures and full font names given an
2475
<type>XFontSet</type>,
2477
<function>XFontsOfFontSet</function>.
2478
<indexterm significance="preferred"><primary>XFontsOfFontSet</primary></indexterm>
2482
<funcdef>int <function>XFontsOfFontSet</function></funcdef>
2483
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
2484
<paramdef>XFontStruct<parameter> ***font_struct_list_return</parameter></paramdef>
2485
<paramdef>char<parameter> ***font_name_list_return</parameter></paramdef>
2492
<emphasis remap='I'>font_set</emphasis>
2496
Specifies the font set.
2502
<emphasis remap='I'>font_struct_list_return</emphasis>
2506
Returns the list of font structs.
2512
<emphasis remap='I'>font_name_list_return</emphasis>
2516
Returns the list of font names.
2526
<function>XFontsOfFontSet</function>
2527
function returns a list of one or more
2528
<structname>XFontStruct</structname>s
2529
and font names for the fonts used by the Xmb and Xwc layers
2530
for the given font set.
2531
A list of pointers to the
2532
<structname>XFontStruct</structname>
2533
structures is returned to font_struct_list_return.
2534
A list of pointers to null-terminated, fully specified font name strings
2535
in the locale of the font set is returned to font_name_list_return.
2536
The font_name_list order corresponds to the font_struct_list order.
2538
<structname>XFontStruct</structname>
2539
structures and font names is returned as the value of the function.
2543
Because it is not guaranteed that a given character will be imaged using a
2545
there is no provision for mapping a character or default string
2546
to the font properties, font ID, or direction hint for the font
2548
The client may access the
2549
<structname>XFontStruct</structname>
2550
list to obtain these values for all the fonts currently in use.
2554
Xlib does not guarantee that fonts are loaded from the server
2555
at the creation of an
2556
<type>XFontSet</type>.
2557
Xlib may choose to cache font data, loading it only as needed to draw text
2558
or compute text dimensions.
2559
Therefore, existence of the per_char metrics in the
2560
<structname>XFontStruct</structname>
2562
<structname>XFontStructSet</structname>
2564
Also, note that all properties in the
2565
<structname>XFontStruct</structname>
2566
structures are in the STRING encoding.
2571
<structname>XFontStruct</structname>
2572
and font name lists are owned by Xlib
2573
and should not be modified or freed by the client.
2574
They will be freed by a call to
2575
<function>XFreeFontSet</function>
2577
<type>XFontSet</type>.
2578
Until freed, their contents will not be modified by Xlib.
2583
To obtain the base font name list and the selected font name list given an
2584
<type>XFontSet</type>,
2586
<function>XBaseFontNameListOfFontSet</function>.
2587
<indexterm significance="preferred"><primary>XBaseFontNameListOfFontSet</primary></indexterm>
2591
<funcdef>char *<function>XBaseFontNameListOfFontSet</function></funcdef>
2592
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
2599
<emphasis remap='I'>font_set</emphasis>
2603
Specifies the font set.
2613
<function>XBaseFontNameListOfFontSet</function>
2614
function returns the original base font name list supplied
2615
by the client when the
2616
<type>XFontSet</type>
2618
A null-terminated string containing a list of
2619
comma-separated font names is returned
2620
as the value of the function.
2621
White space may appear immediately on either side of separating commas.
2626
<function>XCreateFontSet</function>
2627
obtained an <acronym>XLFD</acronym> name from the font properties for the font specified
2628
by a non-<acronym>XLFD</acronym> base name, the
2629
<function>XBaseFontNameListOfFontSet</function>
2630
function will return the <acronym>XLFD</acronym> name instead of the non-<acronym>XLFD</acronym> base name.
2634
The base font name list is owned by Xlib and should not be modified or
2635
freed by the client.
2636
It will be freed by a call to
2637
<function>XFreeFontSet</function>
2639
<type>XFontSet</type>.
2640
Until freed, its contents will not be modified by Xlib.
2645
To obtain the locale name given an
2646
<type>XFontSet</type>,
2648
<function>XLocaleOfFontSet</function>.
2649
<indexterm significance="preferred"><primary>XLocaleOfFontSet</primary></indexterm>
2653
<funcdef>char *<function>XLocaleOfFontSet</function></funcdef>
2654
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
2661
<emphasis remap='I'>font_set</emphasis>
2665
Specifies the font set.
2675
<function>XLocaleOfFontSet</function>
2677
returns the name of the locale bound to the specified
2678
<type>XFontSet</type>,
2679
as a null-terminated string.
2683
The returned locale name string is owned by Xlib
2684
and should not be modified or freed by the client.
2685
It may be freed by a call to
2686
<function>XFreeFontSet</function>
2688
<type>XFontSet</type>.
2689
Until freed, it will not be modified by Xlib.
2695
<function>XFreeFontSet</function>
2696
function is a convenience function for freeing an output context.
2697
<function>XFreeFontSet</function>
2698
also frees its associated
2700
if the output context was created by
2701
<function>XCreateFontSet</function>.
2702
<indexterm significance="preferred"><primary>XFreeFontSet</primary></indexterm>
2706
<funcdef>void <function>XFreeFontSet</function></funcdef>
2707
<paramdef>Display<parameter> *display</parameter></paramdef>
2708
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
2715
<emphasis remap='I'>display</emphasis>
2719
Specifies the connection to the X server.
2725
<emphasis remap='I'>font_set</emphasis>
2729
Specifies the font set.
2739
<function>XFreeFontSet</function>
2740
function frees the specified font set.
2741
The associated base font name list, font name list,
2742
<structname>XFontStruct</structname>
2744
<structname>XFontSetExtents</structname>,
2748
<sect2 id="Obtaining_Font_Set_Metrics">
2749
<title>Obtaining Font Set Metrics</title>
2751
<!-- (SN Obtaining Font Set Metrics -->
2755
Metrics for the internationalized text drawing functions
2756
are defined in terms of a primary draw direction,
2757
which is the default direction in which the character origin advances
2758
for each succeeding character in the string.
2759
The Xlib interface is currently defined to support only a left-to-right
2760
primary draw direction.
2761
The drawing origin is the position passed to the drawing function
2762
when the text is drawn.
2763
The baseline is a line drawn through the drawing origin parallel
2764
to the primary draw direction.
2765
Character ink is the pixels painted in the foreground color
2766
and does not include interline or intercharacter spacing
2767
or image text background pixels.
2771
The drawing functions are allowed to implement implicit text
2772
directionality control, reversing the order in which characters are
2773
rendered along the primary draw direction in response to locale-specific
2774
lexical analysis of the string.
2778
Regardless of the character rendering order,
2779
the origins of all characters are on the primary draw direction side
2780
of the drawing origin.
2781
The screen location of a particular character image may be determined with
2782
<function>XmbTextPerCharExtents</function>
2784
<function>XwcTextPerCharExtents</function>.
2788
The drawing functions are allowed to implement context-dependent
2789
rendering, where the glyphs drawn for a string are not simply a
2790
concatenation of the glyphs that represent each individual character.
2791
A string of two characters drawn with
2792
<function>XmbDrawString</function>
2793
may render differently than if the two characters
2794
were drawn with separate calls to
2795
<function>XmbDrawString</function>.
2796
If the client appends or inserts a character
2797
in a previously drawn string,
2798
the client may need to redraw some adjacent characters
2799
to obtain proper rendering.
2804
To find out about direction-dependent rendering, use
2805
<function>XDirectionalDependentDrawing</function>.
2806
<indexterm significance="preferred"><primary>XDirectionalDependentDrawing</primary></indexterm>
2810
<funcdef>Bool <function>XDirectionalDependentDrawing</function></funcdef>
2811
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
2818
<emphasis remap='I'>font_set</emphasis>
2822
Specifies the font set.
2832
<function>XDirectionalDependentDrawing</function>
2834
<symbol>True</symbol>
2835
if the drawing functions implement implicit text directionality;
2836
otherwise, it returns
2837
<symbol>False</symbol>.
2842
To find out about context-dependent rendering, use
2843
<function>XContextualDrawing</function>.
2844
<indexterm significance="preferred"><primary>XContextualDrawing</primary></indexterm>
2848
<funcdef>Bool <function>XContextualDrawing</function></funcdef>
2849
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
2856
<emphasis remap='I'>font_set</emphasis>
2860
Specifies the font set.
2870
<function>XContextualDrawing</function>
2872
<symbol>True</symbol>
2873
if text drawn with the font set might include context-dependent drawing;
2874
otherwise, it returns
2875
<symbol>False</symbol>.
2880
To find out about context-dependent or direction-dependent rendering, use
2881
<function>XContextDependentDrawing</function>.
2882
<indexterm significance="preferred"><primary>XContextDependentDrawing</primary></indexterm>
2886
<funcdef>Bool <function>XContextDependentDrawing</function></funcdef>
2887
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
2894
<emphasis remap='I'>font_set</emphasis>
2898
Specifies the font set.
2908
<function>XContextDependentDrawing</function>
2910
<symbol>True</symbol>
2911
if the drawing functions implement implicit text directionality or
2912
if text drawn with the font_set might include context-dependent drawing;
2913
otherwise, it returns
2914
<symbol>False</symbol>.
2918
The drawing functions do not interpret newline, tab, or other control
2920
The behavior when nonprinting characters other than space are drawn
2921
is implementation-dependent.
2922
It is the client's responsibility to interpret control characters
2927
The maximum character extents for the fonts that are used by the text
2928
drawing layers can be accessed by the
2929
<structname>XFontSetExtents</structname>
2931
<indexterm significance="preferred"><primary>XFontSetExtents</primary></indexterm>
2935
<literallayout class="monospaced">
2939
XRectangle max_ink_extent; /* over all drawable characters */
2940
XRectangle max_logical_extent; /* over all drawable characters */
2947
<structname>XRectangle</structname>
2948
structures used to return font set metrics are the usual Xlib screen-oriented
2950
with x, y giving the upper left corner, and width and height always positive.
2954
The max_ink_extent member gives the maximum extent, over all drawable characters, of
2955
the rectangles that bound the character glyph image drawn in the
2956
foreground color, relative to a constant origin.
2958
<function>XmbTextExtents</function>
2960
<function>XwcTextExtents</function>
2961
for detailed semantics.
2965
The max_logical_extent member gives the maximum extent,
2966
over all drawable characters, of the rectangles
2967
that specify minimum spacing to other graphical features,
2968
relative to a constant origin.
2969
Other graphical features drawn by the client, for example,
2970
a border surrounding the text, should not intersect this rectangle.
2971
The max_logical_extent member should be used to compute minimum
2972
interline spacing and the minimum area that must be allowed
2973
in a text field to draw a given number of arbitrary characters.
2977
Due to context-dependent rendering,
2978
appending a given character to a string may change
2979
the string's extent by an amount other than that character's
2984
The rectangles for a given character in a string can be obtained from
2985
<function>XmbTextPerCharExtents</function>
2987
<function>XwcTextPerCharExtents</function>.
2992
To obtain the maximum extents structure given an
2993
<type>XFontSet</type>,
2995
<function>XExtentsOfFontSet</function>.
2996
<indexterm significance="preferred"><primary>XExtentsOfFontSet</primary></indexterm>
3000
<funcdef>XFontSetExtents *<function>XExtentsOfFontSet</function></funcdef>
3001
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
3008
<emphasis remap='I'>font_set</emphasis>
3012
Specifies the font set.
3022
<function>XExtentsOfFontSet</function>
3024
<structname>XFontSetExtents</structname>
3025
structure for the fonts used by the Xmb and Xwc layers
3026
for the given font set.
3031
<structname>XFontSetExtents</structname>
3032
structure is owned by Xlib and should not be modified
3033
or freed by the client.
3034
It will be freed by a call to
3035
<function>XFreeFontSet</function>
3037
<type>XFontSet</type>.
3038
Until freed, its contents will not be modified by Xlib.
3043
To obtain the escapement in pixels of the specified text as a value,
3045
<function>XmbTextEscapement</function>
3047
<function>XwcTextEscapement</function>.
3048
<indexterm significance="preferred"><primary>XmbTextEscapement</primary></indexterm>
3049
<indexterm significance="preferred"><primary>XwcTextEscapement</primary></indexterm>
3053
<funcdef>int <function>XmbTextEscapement</function></funcdef>
3054
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
3055
<paramdef>char<parameter> *string</parameter></paramdef>
3056
<paramdef>int<parameter> num_bytes</parameter></paramdef>
3062
<funcdef>int <function>XwcTextEscapement</function></funcdef>
3063
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
3064
<paramdef>wchar_t<parameter> *string</parameter></paramdef>
3065
<paramdef>int<parameter> num_wchars</parameter></paramdef>
3072
<emphasis remap='I'>font_set</emphasis>
3076
Specifies the font set.
3082
<emphasis remap='I'>string</emphasis>
3086
Specifies the character string.
3092
<emphasis remap='I'>num_bytes</emphasis>
3096
Specifies the number of bytes in the string argument.
3102
<emphasis remap='I'>num_wchars</emphasis>
3106
Specifies the number of characters in the string argument.
3116
<function>XmbTextEscapement</function>
3118
<function>XwcTextEscapement</function>
3119
functions return the escapement in pixels of the specified string as a value,
3120
using the fonts loaded for the specified font set.
3121
The escapement is the distance in pixels in the primary draw
3122
direction from the drawing origin to the origin of the next character to
3123
be drawn, assuming that the rendering of the next character is not
3124
dependent on the supplied string.
3128
Regardless of the character rendering order,
3129
the escapement is always positive.
3134
To obtain the overall_ink_return and overall_logical_return arguments,
3135
the overall bounding box of the string's image, and a logical bounding box,
3137
<function>XmbTextExtents</function>
3139
<function>XwcTextExtents</function>.
3140
<indexterm significance="preferred"><primary>XmbTextExtents</primary></indexterm>
3141
<indexterm significance="preferred"><primary>XwcTextExtents</primary></indexterm>
3145
<funcdef>int <function>XmbTextExtents</function></funcdef>
3146
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
3147
<paramdef>char<parameter> *string</parameter></paramdef>
3148
<paramdef>int<parameter> num_bytes</parameter></paramdef>
3149
<paramdef>XRectangle<parameter> *overall_ink_return</parameter></paramdef>
3150
<paramdef>XRectangle<parameter> *overall_logical_return</parameter></paramdef>
3156
<funcdef>int <function>XwcTextExtents</function></funcdef>
3157
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
3158
<paramdef>wchar_t<parameter> *string</parameter></paramdef>
3159
<paramdef>int<parameter> num_wchars</parameter></paramdef>
3160
<paramdef>XRectangle<parameter> *overall_ink_return</parameter></paramdef>
3161
<paramdef>XRectangle<parameter> *overall_logical_return</parameter></paramdef>
3168
<emphasis remap='I'>font_set</emphasis>
3172
Specifies the font set.
3178
<emphasis remap='I'>string</emphasis>
3182
Specifies the character string.
3188
<emphasis remap='I'>num_bytes</emphasis>
3192
Specifies the number of bytes in the string argument.
3198
<emphasis remap='I'>num_wchars</emphasis>
3202
Specifies the number of characters in the string argument.
3203
<!-- .ds Ov dimensions -->
3209
<emphasis remap='I'>overall_ink_return</emphasis>
3213
Returns the overall ink dimensions.
3219
<emphasis remap='I'>overall_logical_return</emphasis>
3223
Returns the overall logical dimensions.
3233
<function>XmbTextExtents</function>
3235
<function>XwcTextExtents</function>
3236
functions set the components of the specified overall_ink_return and
3237
overall_logical_return
3238
arguments to the overall bounding box of the string's image
3239
and a logical bounding box for spacing purposes, respectively.
3240
They return the value returned by
3241
<function>XmbTextEscapement</function>
3243
<function>XwcTextEscapement</function>.
3244
These metrics are relative to the drawing origin of the string,
3245
using the fonts loaded for the specified font set.
3249
If the overall_ink_return argument is non-NULL,
3250
it is set to the bounding box of the string's character ink.
3251
The overall_ink_return for a nondescending, horizontally drawn
3252
Latin character is conventionally entirely above the baseline;
3253
that is, overall_ink_return.height <= -overall_ink_return.y.
3254
The overall_ink_return for a nonkerned character
3255
is entirely at, and to the right of, the origin;
3256
that is, overall_ink_return.x >= 0.
3257
A character consisting of a single pixel at the origin would set
3258
overall_ink_return fields y = 0, x = 0, width = 1, and height = 1.
3262
If the overall_logical_return argument is non-NULL,
3263
it is set to the bounding box that provides minimum spacing
3264
to other graphical features for the string.
3265
Other graphical features, for example, a border surrounding the text,
3266
should not intersect this rectangle.
3271
<type>XFontSet</type>
3272
has missing charsets,
3273
metrics for each unavailable character are taken
3274
from the default string returned by
3275
<function>XCreateFontSet</function>
3276
so that the metrics represent the text as it will actually be drawn.
3277
The behavior for an invalid codepoint is undefined.
3281
To determine the effective drawing origin for a character in a drawn string,
3282
the client should call
3283
<function>XmbTextPerCharExtents</function>
3284
on the entire string, then on the character,
3285
and subtract the x values of the returned
3286
rectangles for the character.
3287
This is useful to redraw portions of a line of text
3288
or to justify words, but for context-dependent rendering,
3289
the client should not assume that it can redraw the character by itself
3290
and get the same rendering.
3295
To obtain per-character information for a text string,
3297
<function>XmbTextPerCharExtents</function>
3299
<function>XwcTextPerCharExtents</function>.
3300
<indexterm significance="preferred"><primary>XmbTextPerCharExtents</primary></indexterm>
3301
<indexterm significance="preferred"><primary>XwcTextPerCharExtents</primary></indexterm>
3305
<funcdef>Status <function>XmbTextPerCharExtents</function></funcdef>
3306
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
3307
<paramdef>char<parameter> *string</parameter></paramdef>
3308
<paramdef>int<parameter> num_bytes</parameter></paramdef>
3309
<paramdef>XRectangle<parameter> *ink_array_return</parameter></paramdef>
3310
<paramdef>XRectangle<parameter> *logical_array_return</parameter></paramdef>
3311
<paramdef>int<parameter> array_size</parameter></paramdef>
3312
<paramdef>int<parameter> *num_chars_return</parameter></paramdef>
3313
<paramdef>XRectangle<parameter> *overall_ink_return</parameter></paramdef>
3314
<paramdef>XRectangle<parameter> *overall_logical_return</parameter></paramdef>
3320
<funcdef>Status <function>XwcTextPerCharExtents</function></funcdef>
3321
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
3322
<paramdef>wchar_t<parameter> *string</parameter></paramdef>
3323
<paramdef>int<parameter> num_wchars</parameter></paramdef>
3324
<paramdef>XRectangle<parameter> *ink_array_return</parameter></paramdef>
3325
<paramdef>XRectangle<parameter> *logical_array_return</parameter></paramdef>
3326
<paramdef>int<parameter> array_size</parameter></paramdef>
3327
<paramdef>int<parameter> *num_chars_return</parameter></paramdef>
3328
<paramdef>XRectangle<parameter> *overall_ink_return</parameter></paramdef>
3329
<paramdef>XRectangle<parameter> *overall_logical_return</parameter></paramdef>
3336
<emphasis remap='I'>font_set</emphasis>
3340
Specifies the font set.
3346
<emphasis remap='I'>string</emphasis>
3350
Specifies the character string.
3356
<emphasis remap='I'>num_bytes</emphasis>
3360
Specifies the number of bytes in the string argument.
3366
<emphasis remap='I'>num_wchars</emphasis>
3370
Specifies the number of characters in the string argument.
3376
<emphasis remap='I'>ink_array_return</emphasis>
3380
Returns the ink dimensions for each character.
3386
<emphasis remap='I'>logical_array_return</emphasis>
3390
Returns the logical dimensions for each character.
3396
<emphasis remap='I'>array_size</emphasis>
3400
Specifies the size of ink_array_return and logical_array_return.
3401
The caller must pass in arrays of this size.
3407
<emphasis remap='I'>num_chars_return</emphasis>
3411
Returns the number of characters in the string argument.
3412
<!-- .ds Ov extents of the entire string -->
3418
<emphasis remap='I'>overall_ink_return</emphasis>
3422
Returns the overall ink dimensions.
3428
<emphasis remap='I'>overall_logical_return</emphasis>
3432
Returns the overall logical dimensions.
3442
<function>XmbTextPerCharExtents</function>
3444
<function>XwcTextPerCharExtents</function>
3445
functions return the text dimensions of each character of the specified text,
3446
using the fonts loaded for the specified font set.
3447
Each successive element of ink_array_return and logical_array_return
3448
is set to the successive character's drawn metrics,
3449
relative to the drawing origin of the string and one
3451
for each character in the supplied text string.
3452
The number of elements of ink_array_return and logical_array_return
3453
that have been set is returned to num_chars_return.
3457
Each element of ink_array_return is set to the bounding box
3458
of the corresponding character's drawn foreground color.
3459
Each element of logical_array_return is set to the bounding box
3460
that provides minimum spacing to other graphical features
3461
for the corresponding character.
3462
Other graphical features should not intersect any of the
3463
logical_array_return rectangles.
3468
<structname>XRectangle</structname>
3469
represents the effective drawing dimensions of the character,
3470
regardless of the number of font glyphs that are used to draw
3471
the character or the direction in which the character is drawn.
3472
If multiple characters map to a single character glyph,
3473
the dimensions of all the
3474
<structname>XRectangle</structname>s
3475
of those characters are the same.
3480
<type>XFontSet</type>
3481
has missing charsets, metrics for each unavailable
3482
character are taken from the default string returned by
3483
<function>XCreateFontSet</function>
3484
so that the metrics represent the text as it will actually be drawn.
3485
The behavior for an invalid codepoint is undefined.
3489
If the array_size is too small for the number of characters in the
3490
supplied text, the functions return zero
3491
and num_chars_return is set to the number of rectangles required.
3492
Otherwise, the functions return a nonzero value.
3496
If the overall_ink_return or overall_logical_return argument is non-NULL,
3497
<function>XmbTextPerCharExtents</function>
3499
<function>XwcTextPerCharExtents</function>
3500
return the maximum extent of the string's metrics to overall_ink_return
3501
or overall_logical_return, as returned by
3502
<function>XmbTextExtents</function>
3504
<function>XwcTextExtents</function>.
3507
<sect2 id="Drawing_Text_Using_Font_Sets">
3508
<title>Drawing Text Using Font Sets</title>
3510
<!-- (SN Drawing Text Using Font Sets -->
3514
The functions defined in this section
3515
draw text at a specified location in a drawable.
3516
They are similar to the functions
3517
<function>XDrawText</function>,
3518
<function>XDrawString</function>,
3520
<function>XDrawImageString</function>
3521
except that they work with font sets instead of single fonts
3522
and interpret the text based on the locale of the font set
3523
instead of treating the bytes of the string as direct font indexes.
3524
See section 8.6 for details of the use of Graphics Contexts (GCs)
3525
and possible protocol errors.
3527
<errorname>BadFont</errorname>
3529
characters prior to the offending character may have been drawn.
3533
The text is drawn using the fonts loaded for the specified font set;
3534
the font in the GC is ignored and may be modified by the functions.
3535
No validation that all fonts conform to some width rule is performed.
3540
<function>XmbDrawText</function>
3542
<function>XwcDrawText</function>
3543
use the following structures:
3547
<indexterm significance="preferred"><primary>XmbTextItem</primary></indexterm>
3549
<literallayout class="monospaced">
3550
<!-- .TA .5i 2.5i -->
3551
<!-- .ta .5i 2.5i -->
3553
char *chars; /* pointer to string */
3554
int nchars; /* number of bytes */
3555
int delta; /* pixel delta between strings */
3556
XFontSet font_set; /* fonts, None means don't change */
3562
<indexterm significance="preferred"><primary>XwcTextItem</primary></indexterm>
3563
<literallayout class="monospaced">
3564
<!-- .TA .5i 2.5i -->
3565
<!-- .ta .5i 2.5i -->
3567
wchar_t *chars; /* pointer to wide char string */
3568
int nchars; /* number of wide characters */
3569
int delta; /* pixel delta between strings */
3570
XFontSet font_set; /* fonts, None means don't change */
3578
To draw text using multiple font sets in a given drawable, use
3579
<function>XmbDrawText</function>
3581
<function>XwcDrawText</function>.
3582
<indexterm significance="preferred"><primary>XmbDrawText</primary></indexterm>
3583
<indexterm significance="preferred"><primary>XwcDrawText</primary></indexterm>
3587
<funcdef>void <function>XmbDrawText</function></funcdef>
3588
<paramdef>Display<parameter> *display</parameter></paramdef>
3589
<paramdef>Drawable<parameter> d</parameter></paramdef>
3590
<paramdef>GC<parameter> gc</parameter></paramdef>
3591
<paramdef>intx,<parameter> y</parameter></paramdef>
3592
<paramdef>XmbTextItem<parameter> *items</parameter></paramdef>
3593
<paramdef>int<parameter> nitems</parameter></paramdef>
3599
<funcdef>void <function>XwcDrawText</function></funcdef>
3600
<paramdef>Display<parameter> *display</parameter></paramdef>
3601
<paramdef>Drawable<parameter> d</parameter></paramdef>
3602
<paramdef>GC<parameter> gc</parameter></paramdef>
3603
<paramdef>intx,<parameter> y</parameter></paramdef>
3604
<paramdef>XwcTextItem<parameter> *items</parameter></paramdef>
3605
<paramdef>int<parameter> nitems</parameter></paramdef>
3612
<emphasis remap='I'>display</emphasis>
3616
Specifies the connection to the X server.
3622
<emphasis remap='I'>d</emphasis>
3626
Specifies the drawable.
3632
<emphasis remap='I'>gc</emphasis>
3643
<emphasis remap='I'>x</emphasis>
3654
<emphasis remap='I'>y</emphasis>
3658
Specify the x and y coordinates(Xy.
3664
<emphasis remap='I'>items</emphasis>
3668
Specifies an array of text items.
3674
<emphasis remap='I'>nitems</emphasis>
3678
Specifies the number of text items in the array.
3688
<function>XmbDrawText</function>
3690
<function>XwcDrawText</function>
3691
functions allow complex spacing and font set shifts between text strings.
3692
Each text item is processed in turn, with the origin of a text
3693
element advanced in the primary draw direction by the escapement of the
3695
A text item delta specifies an additional escapement of the text item
3696
drawing origin in the primary draw direction.
3697
A font_set member other than
3698
<symbol>None</symbol>
3699
in an item causes the font set to be used for this and subsequent text items
3700
in the text_items list.
3701
Leading text items with a font_set member set to
3702
<symbol>None</symbol>
3707
<function>XmbDrawText</function>
3709
<function>XwcDrawText</function>
3710
do not perform any context-dependent rendering between text segments.
3711
Clients may compute the drawing metrics by passing each text segment to
3712
<function>XmbTextExtents</function>
3714
<function>XwcTextExtents</function>
3716
<function>XmbTextPerCharExtents</function>
3718
<function>XwcTextPerCharExtents</function>.
3720
<type>XFontSet</type>
3721
has missing charsets, each unavailable character is drawn
3722
with the default string returned by
3723
<function>XCreateFontSet</function>.
3724
The behavior for an invalid codepoint is undefined.
3729
To draw text using a single font set in a given drawable, use
3730
<function>XmbDrawString</function>
3732
<function>XwcDrawString</function>.
3733
<indexterm significance="preferred"><primary>XmbDrawString</primary></indexterm>
3734
<indexterm significance="preferred"><primary>XwcDrawString</primary></indexterm>
3738
<funcdef>void <function>XmbDrawString</function></funcdef>
3739
<paramdef>Display<parameter> *display</parameter></paramdef>
3740
<paramdef>Drawable<parameter> d</parameter></paramdef>
3741
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
3742
<paramdef>GC<parameter> gc</parameter></paramdef>
3743
<paramdef>intx,<parameter> y</parameter></paramdef>
3744
<paramdef>char<parameter> *string</parameter></paramdef>
3745
<paramdef>int<parameter> num_bytes</parameter></paramdef>
3751
<funcdef>void <function>XwcDrawString</function></funcdef>
3752
<paramdef>Display<parameter> *display</parameter></paramdef>
3753
<paramdef>Drawable<parameter> d</parameter></paramdef>
3754
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
3755
<paramdef>GC<parameter> gc</parameter></paramdef>
3756
<paramdef>intx,<parameter> y</parameter></paramdef>
3757
<paramdef>wchar_t<parameter> *string</parameter></paramdef>
3758
<paramdef>int<parameter> num_wchars</parameter></paramdef>
3765
<emphasis remap='I'>display</emphasis>
3769
Specifies the connection to the X server.
3775
<emphasis remap='I'>d</emphasis>
3779
Specifies the drawable.
3785
<emphasis remap='I'>font_set</emphasis>
3789
Specifies the font set.
3795
<emphasis remap='I'>gc</emphasis>
3806
<emphasis remap='I'>x</emphasis>
3817
<emphasis remap='I'>y</emphasis>
3821
Specify the x and y coordinates(Xy.
3827
<emphasis remap='I'>string</emphasis>
3831
Specifies the character string.
3837
<emphasis remap='I'>num_bytes</emphasis>
3841
Specifies the number of bytes in the string argument.
3847
<emphasis remap='I'>num_wchars</emphasis>
3851
Specifies the number of characters in the string argument.
3861
<function>XmbDrawString</function>
3863
<function>XwcDrawString</function>
3864
functions draw the specified text with the foreground pixel.
3866
<type>XFontSet</type>
3867
has missing charsets, each unavailable character is drawn
3868
with the default string returned by
3869
<function>XCreateFontSet</function>.
3870
The behavior for an invalid codepoint is undefined.
3875
To draw image text using a single font set in a given drawable, use
3876
<function>XmbDrawImageString</function>
3878
<function>XwcDrawImageString</function>.
3879
<indexterm significance="preferred"><primary>XmbDrawImageString</primary></indexterm>
3880
<indexterm significance="preferred"><primary>XwcDrawImageString</primary></indexterm>
3884
<funcdef>void <function>XmbDrawImageString</function></funcdef>
3885
<paramdef>Display<parameter> *display</parameter></paramdef>
3886
<paramdef>Drawable<parameter> d</parameter></paramdef>
3887
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
3888
<paramdef>GC<parameter> gc</parameter></paramdef>
3889
<paramdef>intx,<parameter> y</parameter></paramdef>
3890
<paramdef>char<parameter> *string</parameter></paramdef>
3891
<paramdef>int<parameter> num_bytes</parameter></paramdef>
3897
<funcdef>void <function>XwcDrawImageString</function></funcdef>
3898
<paramdef>Display<parameter> *display</parameter></paramdef>
3899
<paramdef>Drawable<parameter> d</parameter></paramdef>
3900
<paramdef>XFontSet<parameter> font_set</parameter></paramdef>
3901
<paramdef>GC<parameter> gc</parameter></paramdef>
3902
<paramdef>intx,<parameter> y</parameter></paramdef>
3903
<paramdef>wchar_t<parameter> *string</parameter></paramdef>
3904
<paramdef>int<parameter> num_wchars</parameter></paramdef>
3911
<emphasis remap='I'>display</emphasis>
3915
Specifies the connection to the X server.
3921
<emphasis remap='I'>d</emphasis>
3925
Specifies the drawable.
3931
<emphasis remap='I'>font_set</emphasis>
3935
Specifies the font set.
3941
<emphasis remap='I'>gc</emphasis>
3952
<emphasis remap='I'>x</emphasis>
3963
<emphasis remap='I'>y</emphasis>
3967
Specify the x and y coordinates(Xy.
3973
<emphasis remap='I'>string</emphasis>
3977
Specifies the character string.
3983
<emphasis remap='I'>num_bytes</emphasis>
3987
Specifies the number of bytes in the string argument.
3993
<emphasis remap='I'>num_wchars</emphasis>
3997
Specifies the number of characters in the string argument.
4007
<function>XmbDrawImageString</function>
4009
<function>XwcDrawImageString</function>
4010
functions fill a destination rectangle with the background pixel defined
4011
in the GC and then paint the text with the foreground pixel.
4012
The filled rectangle is the rectangle returned to overall_logical_return by
4013
<function>XmbTextExtents</function>
4015
<function>XwcTextExtents</function>
4016
for the same text and
4017
<type>XFontSet</type>.
4022
<type>XFontSet</type>
4023
has missing charsets, each unavailable character is drawn
4024
with the default string returned by
4025
<function>XCreateFontSet</function>.
4026
The behavior for an invalid codepoint is undefined.
4030
<sect1 id="Input_Methods">
4031
<title>Input Methods</title>
4033
<!-- (SN Input Methods -->
4037
This section provides discussions of the following X Input Method
4038
(<acronym>XIM</acronym>) topics:
4043
Input method overview
4048
Input method management
4053
Input method functions
4063
Input context functions
4068
Input context values
4073
Input method callback semantics
4083
Getting keyboard input
4088
Input method conventions
4092
<sect2 id="Input_Method_Overview">
4093
<title>Input Method Overview</title>
4095
<!-- (SN Input Method Overview -->
4099
This section provides definitions for terms and concepts used
4100
for internationalized text input and a brief overview of the
4101
intended use of the mechanisms provided by Xlib.
4105
A large number of languages in the world use alphabets
4106
consisting of a small set of symbols (letters) to form words.
4107
To enter text into a computer in an alphabetic language,
4108
a user usually has a keyboard on which there exist key symbols corresponding
4110
Sometimes, a few characters of an alphabetic language are missing
4112
Many computer users who speak a Latin-alphabet-based language
4113
only have an English-based keyboard.
4114
They need to hit a combination of keystrokes
4115
to enter a character that does not exist directly on the keyboard.
4116
A number of algorithms have been developed for entering such characters.
4117
These are known as European input methods, compose input methods,
4118
or dead-key input methods.
4122
Japanese is an example of a language with a phonetic symbol set,
4123
where each symbol represents a specific sound.
4124
There are two phonetic symbol sets in Japanese: Katakana and Hiragana.
4126
Katakana is used for words that are of foreign origin,
4127
and Hiragana is used for writing native Japanese words.
4128
Collectively, the two systems are called Kana.
4129
Each set consists of 48 characters.
4133
Korean also has a phonetic symbol set, called Hangul.
4134
Each of the 24 basic phonetic symbols (14 consonants and 10 vowels)
4135
represents a specific sound.
4136
A syllable is composed of two or three parts:
4137
the initial consonants, the vowels, and the optional last consonants.
4139
syllables can be treated as the basic units on which text processing is done.
4141
a delete operation may work on a phonetic symbol or a syllable.
4142
Korean code sets include several thousands of these syllables.
4143
A user types the phonetic symbols that make up the syllables of the words
4145
The display may change as each phonetic symbol is entered.
4147
when the second phonetic symbol of a syllable is entered,
4148
the first phonetic symbol may change its shape and size.
4149
Likewise, when the third phonetic symbol is entered,
4150
the first two phonetic symbols may change their shape and size.
4154
Not all languages rely solely on alphabetic or phonetic systems.
4155
Some languages, including Japanese and Korean, employ an
4156
ideographic writing system.
4157
In an ideographic system, rather than taking a small set of
4158
symbols and combining them in different ways to create words,
4159
each word consists of one unique symbol (or, occasionally, several symbols).
4160
The number of symbols can be very large:
4161
approximately 50,000 have been identified in Hanzi,
4162
the Chinese ideographic system.
4166
Two major aspects of ideographic systems impact their use with computers.
4167
First, the standard computer character sets in Japan, China, and Korea
4168
include roughly 8,000 characters,
4169
while sets in Taiwan have between 15,000 and 30,000 characters.
4170
This makes it necessary to use more than one byte to represent a character.
4171
Second, it obviously is impractical to have a keyboard that includes
4172
all of a given language's ideographic symbols.
4173
Therefore, a mechanism is required for entering characters
4174
so that a keyboard with a reasonable number of keys can be used.
4175
Those input methods are usually based on phonetics,
4176
but there also exist methods based on the graphical properties of
4181
In Japan, both Kana and the ideographic system Kanji are used.
4182
In Korea, Hangul and sometimes the ideographic system Hanja are used.
4183
Now consider entering ideographs in Japan, Korea, China, and Taiwan.
4187
In Japan, either Kana or English characters are typed and then a region
4188
is selected (sometimes automatically) for conversion to Kanji.
4189
Several Kanji characters may have the same phonetic representation.
4190
If that is the case with the string entered,
4191
a menu of characters is presented and
4192
the user must choose the appropriate one.
4193
If no choice is necessary or a preference has been established,
4194
the input method does the substitution directly.
4195
When Latin characters are converted to Kana or Kanji,
4196
it is called a romaji conversion.
4200
In Korea, it is usually acceptable to keep Korean text in Hangul form,
4201
but some people may choose to write Hanja-originated words in Hanja
4202
rather than in Hangul.
4203
To change Hangul to Hanja,
4204
the user selects a region for conversion
4205
and then follows the same basic method as that described for Japanese.
4209
Probably because there are well-accepted phonetic writing systems
4210
for Japanese and Korean,
4211
computer input methods in these countries for entering ideographs
4212
are fairly standard.
4213
Keyboard keys have both English characters and phonetic symbols
4214
engraved on them, and the user can switch between the two sets.
4218
The situation is different for Chinese.
4219
While there is a phonetic system called Pinyin promoted by authorities,
4220
there is no consensus for entering Chinese text.
4221
Some vendors use a phonetic decomposition (Pinyin or another),
4222
others use ideographic decomposition of Chinese words,
4223
with various implementations and keyboard layouts.
4224
There are about 16 known methods, none of which is a clear standard.
4228
Also, there are actually two ideographic sets used:
4229
Traditional Chinese (the original written Chinese)
4230
and Simplified Chinese.
4232
the People's Republic of China launched a campaign to simplify
4233
some ideographic characters and eliminate redundancies altogether.
4235
characters would be streamlined every five years.
4236
Characters have been revised several times now,
4237
resulting in the smaller, simpler set that makes up Simplified Chinese.
4239
<sect3 id="Input_Method_Architecture">
4240
<title>Input Method Architecture</title>
4242
<!-- (SN Input Method Architecture -->
4246
As shown in the previous section,
4247
there are many different input methods in use today,
4248
each varying with language, culture, and history.
4249
A common feature of many input methods is that the user may type
4250
multiple keystrokes to compose a single character (or set
4252
The process of composing characters from keystrokes is called
4253
<emphasis remap='I'>preediting</emphasis>.
4254
It may require complex algorithms and large dictionaries
4255
involving substantial computer resources.
4259
Input methods may require one or more areas in which to show the
4260
feedback of the actual keystrokes, to propose disambiguation to the
4261
user, to list dictionaries, and so on.
4262
The input method areas of concern are as follows:
4267
The <emphasis remap='I'>status</emphasis> area is a logical extension of the
4268
LEDs that exist on the physical keyboard.
4269
It is a window that is intended to present the internal state
4270
of the input method that is critical to the user.
4271
The status area may consist of text data and bitmaps or some combination.
4276
The <emphasis remap='I'>preedit</emphasis> area displays the
4277
intermediate text for those languages that are composing prior to
4278
the client handling the data.
4283
The <emphasis remap='I'>auxiliary</emphasis> area is used for pop-up menus and customizing
4284
dialogs that may be required for an input method.
4285
There may be multiple auxiliary areas for an input method.
4286
Auxiliary areas are managed by the input method independent of the client.
4287
Auxiliary areas are assumed to be separate dialogs,
4288
which are maintained by the input method.
4294
There are various user interaction styles used for preediting.
4295
The ones supported by Xlib are as follows:
4300
For <emphasis remap='I'>on-the-spot</emphasis> input methods,
4301
preediting data will be displayed directly in the application window.
4302
Application data is moved to allow preedit data to appear
4303
at the point of insertion.
4308
<emphasis remap='I'>Over-the-spot</emphasis> preediting means that the data is displayed in
4309
a preedit window that is placed over the point of insertion.
4314
<emphasis remap='I'>Off-the-spot</emphasis> preediting means that the preedit window is
4315
inside the application window but not at the point of insertion.
4316
Often, this type of window is placed at the bottom of the application window.
4321
<emphasis remap='I'>Root-window</emphasis> preediting refers to input methods that use a preedit
4322
window that is the child of
4323
<function>RootWindow</function>.
4329
It would require a lot of computing resources if portable applications
4330
had to include input methods for all the languages in the world.
4332
a goal of the Xlib design is to allow an application
4333
to communicate with an input method placed in a separate process.
4334
Such a process is called an <emphasis remap='I'>input server</emphasis>.
4335
The server to which the application should connect is dependent on
4336
the environment when the application is started up,
4337
that is, the user language and the actual encoding to be used for it.
4338
The input method connection is said to be <emphasis remap='I'>locale-dependent</emphasis>.
4339
It is also user-dependent.
4340
For a given language, the user can choose, to some extent,
4341
the user interface style of input method (if choice is possible among
4346
Using an input server implies communication overhead,
4347
but applications can be migrated without relinking.
4348
Input methods can be implemented either as a
4349
stub communicating to an input server or as a local library.
4353
An input method may be based on a <emphasis remap='I'>front-end</emphasis> or a <emphasis remap='I'>back-end</emphasis>
4355
In a front-end architecture,
4356
there are two separate connections to the X server:
4357
keystrokes go directly from the X server to the input method on
4358
one connection and other events to the regular client connection.
4359
The input method is then acting as a filter and sends composed strings
4361
A front-end architecture requires synchronization between the
4362
two connections to avoid lost key events or locking issues.
4366
In a back-end architecture,
4367
a single X server connection is used.
4368
A dispatching mechanism must decide on this channel to delegate appropriate
4369
keystrokes to the input method.
4371
it may retain a Help keystroke for its own purpose.
4372
In the case where the input method is a separate process (that is, a server),
4373
there must be a special communication protocol between the back-end client
4374
and the input server.
4378
A front-end architecture introduces synchronization issues
4379
and a filtering mechanism for noncharacter keystrokes
4380
(Function keys, Help, and so on).
4381
A back-end architecture sometimes implies more communication overhead
4382
and more process switching.
4383
If all three processes (X server, input server, client)
4384
are running on a single workstation,
4385
there are two process switches for each keystroke in a back-end
4387
but there is only one in a front-end architecture.
4391
The abstraction used by a client to communicate with an input method
4392
is an opaque data structure represented by the
4395
This data structure is returned by the
4396
<function>XOpenIM</function>
4397
function, which opens an input method on a given display.
4398
Subsequent operations on this data structure encapsulate all communication
4399
between client and input method.
4400
There is no need for an X client to use any networking library
4401
or natural language package to use an input method.
4405
A single input server may be used for one or more languages,
4406
supporting one or more encoding schemes.
4407
But the strings returned from an input method will always be encoded
4408
in the (single) locale associated with the
4413
<sect3 id="Input_Contexts">
4414
<title>Input Contexts</title>
4416
<!-- (SN Input Contexts -->
4420
Xlib provides the ability to manage a multi-threaded state for text input.
4421
A client may be using multiple windows,
4422
each window with multiple text entry areas,
4423
and the user possibly switching among them at any time.
4424
The abstraction for representing the state of a particular input thread
4425
is called an <emphasis remap='I'>input context</emphasis>.
4426
The Xlib representation of an input context is an
4431
An input context is the abstraction retaining the state, properties,
4432
and semantics of communication between a client and an input method.
4433
An input context is a combination of an input method, a locale
4434
specifying the encoding of the character strings to be returned,
4435
a client window, internal state information,
4436
and various layout or appearance characteristics.
4437
The input context concept somewhat matches for input the graphics context
4438
abstraction defined for graphics output.
4442
One input context belongs to exactly one input method.
4443
Different input contexts may be associated with the same input method,
4444
possibly with the same client window.
4448
<function>XCreateIC</function>
4449
function, providing an
4451
argument and affiliating the input context to the input method
4453
When an input method is closed with
4454
<function>XCloseIM</function>,
4455
all of its affiliated input contexts should not be used any more
4456
(and should preferably be destroyed before closing the input method).
4460
Considering the example of a client window with multiple text entry areas,
4461
the application programmer could, for example, choose to implement as follows:
4466
As many input contexts are created as text entry areas, and the client
4467
will get the input accumulated on each context each time it looks up
4473
A single context is created for a top-level window in the application.
4474
If such a window contains several text entry areas,
4475
each time the user moves to another text entry area,
4476
the client has to indicate changes in the context.
4482
A range of choices can be made by application designers to use
4483
either a single or multiple input contexts,
4484
according to the needs of their application.
4487
<sect3 id="Getting_Keyboard_Input">
4488
<title>Getting Keyboard Input</title>
4490
<!-- (SN Getting Keyboard Input -->
4494
To obtain characters from an input method,
4495
a client must call the function
4496
<function>XmbLookupString</function>
4498
<function>XwcLookupString</function>
4499
with an input context created from that input method.
4500
Both a locale and display are bound to an input method when it is opened,
4501
and an input context inherits this locale and display.
4502
Any strings returned by
4503
<function>XmbLookupString</function>
4505
<function>XwcLookupString</function>
4506
will be encoded in that locale.
4509
<sect3 id="Focus_Management">
4510
<title>Focus Management</title>
4512
<!-- (SN Focus Management -->
4516
For each text entry area in which the
4517
<function>XmbLookupString</function>
4519
<function>XwcLookupString</function>
4521
there will be an associated input context.
4525
When the application focus moves to a text entry area,
4526
the application must set the input context focus to the
4527
input context associated with that area.
4528
The input context focus is set by calling
4529
<function>XSetICFocus</function>
4530
with the appropriate input context.
4534
Also, when the application focus moves out of a text entry area, the
4535
application should unset the focus for the associated input context
4537
<function>XUnsetICFocus</function>.
4538
As an optimization, if
4539
<function>XSetICFocus</function>
4540
is called successively on two different input contexts,
4541
setting the focus on the second
4542
will automatically unset the focus on the first.
4546
To set and unset the input context focus correctly,
4547
it is necessary to track application-level focus changes.
4548
Such focus changes do not necessarily correspond to X server focus changes.
4552
If a single input context
4553
is being used to do input for
4554
multiple text entry areas, it will also be necessary
4555
to set the focus window of the
4556
input context whenever the focus window changes
4557
(see section 13.5.6.3).
4560
<sect3 id="Geometry_Management">
4561
<title>Geometry Management</title>
4563
<!-- (SN Geometry Management -->
4567
In most input method architectures
4568
(on-the-spot being the notable exception),
4569
the input method will perform the display of its own data.
4570
To provide better visual locality,
4571
it is often desirable to have the input method areas embedded within a client.
4573
the client may need to allocate space for an input method.
4574
Xlib provides support that allows the size and position of input method
4575
areas to be provided by a client.
4576
The input method areas that are supported for geometry management
4577
are the status area and the preedit area.
4581
The fundamental concept on which geometry management for input method windows
4582
is based is the proper division of responsibilities between the
4583
client (or toolkit) and the input method.
4584
The division of responsibilities is as follows:
4589
The client is responsible for the geometry of the input method window.
4594
The input method is responsible for the contents of the input method window.
4600
An input method is able to suggest a size to the client,
4601
but it cannot suggest a placement.
4602
Also the input method can only suggest a size.
4603
It does not determine the size,
4604
and it must accept the size it is given.
4608
Before a client provides geometry management for an input method,
4609
it must determine if geometry management is needed.
4610
The input method indicates the need for geometry management
4612
<symbol>XIMPreeditArea</symbol>
4614
<symbol>XIMStatusArea</symbol>
4616
<structname>XIMStyles</structname>
4618
<function>XGetIMValues</function>.
4619
When a client has decided that it will provide geometry management
4620
for an input method,
4621
it indicates that decision by setting the
4622
<symbol>XNInputStyle</symbol>
4628
After a client has established with the input method
4629
that it will do geometry management,
4630
the client must negotiate the geometry with the input method.
4631
The geometry is negotiated by the following steps:
4636
The client suggests an area to the input method by setting the
4637
<symbol>XNAreaNeeded</symbol>
4638
value for that area.
4639
If the client has no constraints for the input method,
4640
it either will not suggest an area or will set the width and height to zero.
4641
Otherwise, it will set one of the values.
4646
The client will get the <acronym>XIC</acronym> value
4647
<symbol>XNAreaNeeded</symbol>.
4648
The input method will return its suggested size in this value.
4649
The input method should pay attention to any constraints suggested
4655
The client sets the <acronym>XIC</acronym> value
4656
<symbol>XNArea</symbol>
4657
to inform the input method of the geometry of its window.
4658
The client should try to honor the geometry requested by the input method.
4659
The input method must accept this geometry.
4665
Clients doing geometry management must be aware that setting other
4666
<acronym>XIC</acronym> values may affect the geometry desired by an input method.
4668
<symbol>XNFontSet</symbol>
4670
<symbol>XNLineSpace</symbol>
4671
may change the geometry desired by the input method.
4675
The table of <acronym>XIC</acronym> values (see section 13.5.6)
4676
indicates the values that can cause the desired geometry to change
4678
It is the responsibility of the client to renegotiate the geometry
4679
of the input method window when it is needed.
4684
a geometry management callback is provided
4685
by which an input method can initiate a geometry change.
4688
<sect3 id="Event_Filtering">
4689
<title>Event Filtering</title>
4691
<!-- (SN Event Filtering -->
4695
A filtering mechanism is provided to allow input methods
4696
to capture X events transparently to clients.
4697
It is expected that toolkits (or clients) using
4698
<function>XmbLookupString</function>
4700
<function>XwcLookupString</function>
4701
will call this filter at some point in the event processing mechanism
4702
to make sure that events needed by an input method can be filtered
4703
by that input method.
4707
If there were no filter,
4708
a client could receive and discard events that are necessary
4709
for the proper functioning of an input method.
4710
The following provides a few examples of such events:
4715
Expose events on preedit window in local mode.
4720
Events may be used by an input method to communicate with an input server.
4721
Such input server protocol-related events have to be intercepted
4722
if one does not want to disturb client code.
4727
Key events can be sent to a filter before they are bound
4728
to translations such as those the X Toolkit Intrinsics library provides.
4734
Clients are expected to get the <acronym>XIC</acronym> value
4735
<symbol>XNFilterEvents</symbol>
4736
and augment the event mask for the client window with that event mask.
4737
This mask may be zero.
4740
<sect3 id="Callbacks">
4741
<title>Callbacks</title>
4743
<!-- (SN Callbacks -->
4747
When an on-the-spot input method is implemented,
4748
only the client can insert or delete preedit data in place
4749
and possibly scroll existing text.
4750
This means that the echo of the keystrokes has to be achieved
4751
by the client itself, tightly coupled with the input method logic.
4755
When the user enters a keystroke,
4757
<function>XmbLookupString</function>
4759
<function>XwcLookupString</function>.
4760
At this point, in the on-the-spot case,
4761
the echo of the keystroke in the preedit has not yet been done.
4762
Before returning to the client logic that handles the input characters,
4763
the look-up function
4764
must call the echoing logic to insert the new keystroke.
4765
If the keystrokes entered so far make up a character,
4766
the keystrokes entered need to be deleted,
4767
and the composed character will be returned.
4768
Hence, what happens is that, while being called by client code,
4769
the input method logic has to call back to the client before it returns.
4770
The client code, that is, a callback procedure,
4771
is called from the input method logic.
4775
There are a number of cases where the input method logic has to
4776
call back the client.
4777
Each of those cases is associated with a well-defined callback action.
4778
It is possible for the client to specify, for each input context,
4779
what callback is to be called for each action.
4783
There are also callbacks provided for feedback of status information
4784
and a callback to initiate a geometry request for an input method.
4787
<sect3 id="Visible_Position_Feedback_Masks">
4788
<title>Visible Position Feedback Masks</title>
4790
<!-- (SN Visible Position Feedback Masks -->
4794
In the on-the-spot input style, there is a problem when
4795
attempting to draw preedit strings that are longer than the
4796
available space. Once the display area is exceeded, it is not
4797
clear how best to display the preedit string.
4798
The visible position feedback masks of
4799
<structname>XIMText</structname>
4800
help resolve this problem by allowing the input method to specify hints that
4801
indicate the essential portions of the preedit string.
4802
For example, such hints can help developers implement
4803
scrolling of a long preedit string within a short preedit display area.
4806
<sect3 id="Preedit_String_Management">
4807
<title>Preedit String Management</title>
4809
<!-- (SN Preedit String Management -->
4813
As highlighted before, the input method architecture provides
4814
preediting, which supports a type of preprocessor input composition.
4815
In this case, composition consists of interpreting a sequence
4816
of key events and returning a committed string via
4817
<function>XmbLookupString</function>
4819
<function>XwcLookupString</function>.
4820
This provides the basics for input methods.
4824
In addition to preediting based on key events, a general framework
4825
is provided to give a client that desires it more advanced preediting based
4826
on the text within the client. This framework is called
4827
<emphasis remap='I'>string conversion</emphasis> and is provided using <acronym>XIC</acronym> values.
4828
The fundamental concept of string conversion
4829
is to allow the input method to manipulate the client's
4830
text independent of any user preediting operation.
4834
The need for string conversion is based on
4835
language needs and input method capabilities.
4836
The following are some examples of string conversion:
4841
Transliteration conversion provides language-specific conversions
4842
within the input method.
4843
In the case of Korean input, users wish to convert a Hangul string
4844
into a Hanja string while in preediting, after preediting,
4845
or in other situations (for example, on a selected string).
4846
The conversion is triggered when the user
4847
presses a Hangul-to-Hanja key sequence (which may be input method specific).
4848
Sometimes the user may want to invoke the conversion after finishing
4849
preediting or on a user-selected string.
4850
Thus, the string to be converted is in an application buffer, not in
4851
the preedit area of the input method. The string conversion services
4852
allow the client to request this transliteration conversion from the
4854
There are many other transliteration conversions defined for
4855
various languages, for example, Kana-to-Kanji conversion in Japanese.
4857
The key to remember is that transliteration conversions are triggered
4858
at the request of the user and returned to the client
4859
immediately without affecting the preedit area of the input method.
4864
Reconversion of a previously committed string or
4865
a selected string is supported by many input methods as a
4866
convenience to the user.
4867
For example, a user tends to mistype the commit key while
4868
preediting. In that case, some input methods provide a special
4869
key sequence to request a ``reconvert'' operation on the
4870
committed string, similiar to the undo facility provided by most
4872
Another example is where the user is proofreading a document
4873
that has some misconversions from preediting and wants to correct
4874
the misconverted text. Such reconversion is again triggered
4875
by the user invoking some special action, but reconversions should
4876
not affect the state of the preedit area.
4881
Context-sensitive conversion is required for some languages
4882
and input methods that need to retrieve text that surrounds the
4883
current spot location (cursor position) of the client's buffer.
4884
Such text is needed when the preediting operation depends on
4885
some surrounding characters (usually preceding the spot location).
4887
in Thai language input, certain character sequences may be invalid and
4888
the input method may want to check whether characters constitute a
4889
valid word. Input methods that do such context-dependent
4890
checking need to retrieve the characters surrounding the current
4891
cursor position to obtain complete words.
4893
Unlike other conversions, this conversion is not explicitly
4894
requested by the user.
4895
Input methods that provide such context-sensitive conversion
4896
continuously need to request context from the client, and any change
4897
in the context of the spot location may affect such conversions.
4898
The client's context would be needed if the user moves the cursor
4899
and starts editing again.
4901
For this reason, an input method supporting this type of conversion
4902
should take notice of when the client calls
4903
<function>XmbResetIC</function>
4905
<function>XwcResetIC</function>,
4906
which is usually an indication of a context change.
4912
Context-sensitive conversions just need a copy of the client's text,
4913
while other conversions replace the client's text with new text
4914
to achieve the reconversion or transliteration. Yet in all
4915
cases the result of a conversion, either immediately or via preediting,
4917
<function>XmbLookupString</function>
4919
<function>XwcLookupString</function>
4924
String conversion support is dependent on the availability of the
4925
<symbol>XNStringConversion</symbol>
4927
<symbol>XNStringConversionCallback</symbol>
4928
<acronym>XIC</acronym> values.
4929
Because the input method may not support string conversions,
4930
clients have to query the availability of string conversion
4931
operations by checking the supported <acronym>XIC</acronym> values list by calling
4932
<function>XGetIMValues</function>
4934
<symbol>XNQueryICValuesList</symbol>
4939
The difference between these two values is whether the
4940
conversion is invoked by the client or the input method.
4942
<symbol>XNStringConversion</symbol>
4943
<acronym>XIC</acronym> value is used by clients to request
4944
a string conversion from the input method. The client
4945
is responsible for determining which events are used
4946
to trigger the string conversion and whether the string to be
4947
converted should be copied or deleted. The type of conversion
4948
is determined by the input method; the client can only
4949
pass the string to be converted. The client is guaranteed that
4951
<symbol>XNStringConversionCallback</symbol>
4952
will be issued when this value is set; thus, the client need
4953
only set one of these values.
4958
<symbol>XNStringConversionCallback</symbol>
4959
<acronym>XIC</acronym> value is used by the client to notify the input method that
4960
it will accept requests from the input method for string conversion.
4961
If this value is set,
4962
it is the input method's responsibility to determine which
4963
events are used to trigger the string conversion.
4964
When such events occur, the input method issues a call to the
4965
client-supplied procedure to retrieve the string to be converted. The client's
4966
callback procedure is notified whether to copy or delete the string and
4967
is provided with hints as to the amount of text needed.
4969
<structname>XIMStringConversionCallbackStruct</structname>
4970
specifies which text should be passed back to the input method.
4974
Finally, the input method may call the client's
4975
<symbol>XNStringConversionCallback</symbol>
4976
procedure multiple times if the string returned from the callback is
4977
not sufficient to perform a successful conversion. The arguments
4978
to the client's procedure allow the input method to define a
4979
position (in character units) relative to the client's cursor position
4980
and the size of the text needed. By varying the position and size of
4981
the desired text in subsequent callbacks, the input method can retrieve
4989
<sect2 id="Input_Method_Management">
4990
<title>Input Method Management</title>
4992
<!-- (SN Input Method Management -->
4996
The interface to input methods might appear to be simply creating
4998
(<function>XOpenIM</function>)
4999
and freeing an input method
5000
(<function>XCloseIM</function>).
5001
However, input methods may
5002
require complex communication with input method servers (IM servers),
5009
If the X server, IM server, and X clients are started asynchronously,
5010
some clients may attempt to connect to the IM server before it is
5011
fully operational, and fail.
5012
Therefore, some mechanism is needed to allow clients to detect when an IM
5019
It is up to clients to decide what should be done when an IM server is
5020
not available (for example, wait, or use some other IM server).
5028
Some input methods may allow the underlying IM server to be switched.
5029
Such customization may be desired without restarting the entire client.
5035
To support management of input methods in these cases, the following
5036
functions are provided:
5039
<tgroup cols='2' align='center'>
5040
<colspec colname='c1'/>
5041
<colspec colname='c2'/>
5044
<entry><function>XRegisterIMInstantiateCallback</function></entry>
5045
<entry>This function allows clients to register a callback procedure
5046
to be called when Xlib detects that an IM server is up and available.</entry>
5049
<entry><function>XOpenIM</function></entry>
5050
<entry>A client calls this function as a result of the callback procedure
5051
being called.</entry>
5054
<entry><function>XSetIMValues</function>, <function>XSetICValues</function></entry>
5055
<entry>These functions use the <acronym>XIM</acronym> and <acronym>XIC</acronym> values,
5056
<symbol>XNDestroyCallback</symbol>,
5058
to register a callback procedure to be called when Xlib detects that
5059
an IM server that was associated with an opened
5060
input method is no longer available.
5061
In addition, this function can be used to switch IM servers for those input
5062
methods that support such functionality. The IM value for switching IM
5063
servers is implementation-dependent; see the description below about
5064
switching IM servers.</entry>
5067
<entry><function>XUnregisterIMInstantiateCallback</function></entry>
5068
<entry>This function removes a callback procedure registered by the client.</entry>
5076
Input methods that support switching of IM servers may exhibit some
5082
The input method will ensure that any new IM server supports any of the
5083
input styles being used by input contexts already associated with the
5085
However, the list of supported input styles may be different.
5095
Geometry management requests on previously created input contexts
5096
may be initiated by the new IM server.
5103
<sect3 id="Hot_Keys">
5104
<title>Hot Keys</title>
5106
<!-- (SN Hot Keys -->
5110
Some clients need to guarantee which keys can be used to escape from the
5111
input method, regardless of the input method state;
5112
for example, the client-specific Help key or the keys to move the
5114
The HotKey mechanism allows clients
5115
to specify a set of keys for this purpose. However, the input
5116
method might not allow clients to specify hot keys.
5117
Therefore, clients have to query support of hot keys by checking the
5118
supported <acronym>XIC</acronym> values list by calling
5119
<function>XGetIMValues</function>
5121
<symbol>XNQueryICValuesList</symbol>
5123
When the hot keys specified conflict with the key bindings of the
5124
input method, hot keys take precedence over the key bindings of the input
5131
<sect3 id="Preedit_State_Operation">
5132
<title>Preedit State Operation</title>
5134
<!-- (SN Preedit State Operation -->
5138
An input method may have several internal states, depending on its
5139
implementation and the locale. However, one state that is
5140
independent of locale and implementation is whether the input method
5141
is currently performing a preediting operation.
5142
Xlib provides the ability for an application to manage the preedit state
5143
programmatically. Two methods are provided for
5144
retrieving the preedit state of an input context.
5145
One method is to query the state by calling
5146
<function>XGetICValues</function>
5148
<symbol>XNPreeditState</symbol>
5149
<acronym>XIC</acronym> value.
5150
Another method is to receive notification whenever
5151
the preedit state is changed. To receive such notification,
5152
an application needs to register a callback by calling
5153
<function>XSetICValues</function>
5155
<symbol>XNPreeditStateNotifyCallback</symbol>
5156
<acronym>XIC</acronym> value.
5157
In order to change the preedit state programmatically, an application
5159
<function>XSetICValues</function>
5161
<symbol>XNPreeditState</symbol>.
5165
Availability of the preedit state is input method dependent. The input
5166
method may not provide the ability to set the state or to
5167
retrieve the state programmatically. Therefore, clients have to
5168
query availability of preedit state operations by checking the
5169
supported <acronym>XIC</acronym> values list by calling
5170
<function>XGetIMValues</function>
5172
<symbol>XNQueryICValuesList</symbol>
5177
<sect2 id="Input_Method_Functions">
5178
<title>Input Method Functions</title>
5180
<!-- (SN Input Method Functions -->
5184
To open a connection, use
5185
<function>XOpenIM</function>.
5186
<indexterm significance="preferred"><primary>XOpenIM</primary></indexterm>
5190
<funcdef>XIM <function>XOpenIM</function></funcdef>
5191
<paramdef>Display<parameter> *display</parameter></paramdef>
5192
<paramdef>XrmDatabase<parameter> db</parameter></paramdef>
5193
<paramdef>char<parameter> *res_name</parameter></paramdef>
5194
<paramdef>char<parameter> *res_class</parameter></paramdef>
5201
<emphasis remap='I'>display</emphasis>
5205
Specifies the connection to the X server.
5211
<emphasis remap='I'>db</emphasis>
5215
Specifies a pointer to the resource database.
5221
<emphasis remap='I'>res_name</emphasis>
5225
Specifies the full resource name of the application.
5231
<emphasis remap='I'>res_class</emphasis>
5235
Specifies the full class name of the application.
5245
<function>XOpenIM</function>
5246
function opens an input method,
5247
matching the current locale and modifiers specification.
5248
Current locale and modifiers are bound to the input method at opening time.
5249
The locale associated with an input method cannot be changed dynamically.
5250
This implies that the strings returned by
5251
<function>XmbLookupString</function>
5253
<function>XwcLookupString</function>,
5254
for any input context affiliated with a given input method,
5255
will be encoded in the locale current at the time the input method is opened.
5259
The specific input method to which this call will be routed
5260
is identified on the basis of the current locale.
5261
<function>XOpenIM</function>
5262
will identify a default input method corresponding to the
5264
That default can be modified using
5265
<function>XSetLocaleModifiers</function>
5266
for the input method modifier.
5270
The db argument is the resource database to be used by the input method
5271
for looking up resources that are private to the input method.
5272
It is not intended that this database be used to look
5273
up values that can be set as IC values in an input context.
5275
no database is passed to the input method.
5279
The res_name and res_class arguments specify the resource name
5280
and class of the application.
5281
They are intended to be used as prefixes by the input method
5282
when looking up resources that are common to all input contexts
5283
that may be created for this input method.
5284
The characters used for resource names and classes must be in the
5285
X Portable Character Set.
5286
The resources looked up are not fully specified
5287
if res_name or res_class is NULL.
5291
The res_name and res_class arguments are not assumed to exist beyond
5293
<function>XOpenIM</function>.
5294
The specified resource database is assumed to exist for the lifetime
5295
of the input method.
5299
<function>XOpenIM</function>
5300
returns NULL if no input method could be opened.
5305
To close a connection, use
5306
<function>XCloseIM</function>.
5307
<indexterm significance="preferred"><primary>XCloseIM</primary></indexterm>
5311
<funcdef>Status <function>XCloseIM</function></funcdef>
5312
<paramdef>XIM<parameter> im</parameter></paramdef>
5319
<emphasis remap='I'>im</emphasis>
5323
Specifies the input method.
5333
<function>XCloseIM</function>
5334
function closes the specified input method.
5339
To set input method attributes, use
5340
<function>XSetIMValues</function>.
5341
<indexterm significance="preferred"><primary>XSetIMValues</primary></indexterm>
5345
<funcdef>char *<function>XSetIMValues</function></funcdef>
5346
<paramdef>XIM<parameter> im</parameter></paramdef>
5353
<emphasis remap='I'>im</emphasis>
5357
Specifies the input method.
5358
<!-- .ds Al \ to set <acronym>XIM</acronym> values -->
5368
Specifies the variable-length argument list(Al.
5378
<function>XSetIMValues</function>
5379
function presents a variable argument list programming interface
5380
for setting attributes of the specified input method.
5381
It returns NULL if it succeeds;
5383
it returns the name of the first argument that could not be set.
5384
Xlib does not attempt to set arguments from the supplied list that
5385
follow the failed argument;
5386
all arguments in the list preceding the failed argument have been set
5392
To query an input method, use
5393
<function>XGetIMValues</function>.
5394
<indexterm significance="preferred"><primary>XGetIMValues</primary></indexterm>
5398
<funcdef>char *<function>XGetIMValues</function></funcdef>
5399
<paramdef>XIM<parameter> im</parameter></paramdef>
5406
<emphasis remap='I'>im</emphasis>
5410
Specifies the input method.
5411
<!-- .ds Al \ to get XIM values -->
5421
Specifies the variable length argument list(Al.
5431
<function>XGetIMValues</function>
5432
function presents a variable argument list programming interface
5433
for querying properties or features of the specified input method.
5434
This function returns NULL if it succeeds;
5436
it returns the name of the first argument that could not be obtained.
5440
Each <acronym>XIM</acronym> value argument (following a name) must point to
5441
a location where the <acronym>XIM</acronym> value is to be stored.
5442
That is, if the <acronym>XIM</acronym> value is of type T,
5443
the argument must be of type T*.
5444
If T itself is a pointer type,
5446
<function>XGetIMValues</function>
5447
allocates memory to store the actual data,
5448
and the client is responsible for freeing this data by calling
5449
<function>XFree</function>
5450
with the returned pointer.
5455
To obtain the display associated with an input method, use
5456
<function>XDisplayOfIM</function>.
5457
<indexterm significance="preferred"><primary>XDisplayOfIM</primary></indexterm>
5461
<funcdef>Display *<function>XDisplayOfIM</function></funcdef>
5462
<paramdef>XIM<parameter> im</parameter></paramdef>
5469
<emphasis remap='I'>im</emphasis>
5473
Specifies the input method.
5483
<function>XDisplayOfIM</function>
5484
function returns the display associated with the specified input method.
5489
To get the locale associated with an input method, use
5490
<function>XLocaleOfIM</function>.
5491
<indexterm significance="preferred"><primary>XLocaleOfIM</primary></indexterm>
5495
<funcdef>char *<function>XLocaleOfIM</function></funcdef>
5496
<paramdef>XIM<parameter> im</parameter></paramdef>
5503
<emphasis remap='I'>im</emphasis>
5507
Specifies the input method.
5517
<function>XLocaleOfIM</function>
5518
function returns the locale associated with the specified input method.
5523
To register an input method instantiate callback, use
5524
<function>XRegisterIMInstantiateCallback</function>.
5525
<indexterm significance="preferred"><primary>XRegisterIMInstantiateCallback</primary></indexterm>
5529
<funcdef>Bool <function>XRegisterIMInstantiateCallback</function></funcdef>
5530
<paramdef>Display<parameter> *display</parameter></paramdef>
5531
<paramdef>XrmDatabase<parameter> db</parameter></paramdef>
5532
<paramdef>char<parameter> *res_name</parameter></paramdef>
5533
<paramdef>char<parameter> *res_class</parameter></paramdef>
5534
<paramdef>XIMProc<parameter> callback</parameter></paramdef>
5535
<paramdef>XPointer<parameter> *client_data</parameter></paramdef>
5542
<emphasis remap='I'>display</emphasis>
5546
Specifies the connection to the X server.
5552
<emphasis remap='I'>db</emphasis>
5556
Specifies a pointer to the resource database.
5562
<emphasis remap='I'>res_name</emphasis>
5566
Specifies the full resource name of the application.
5572
<emphasis remap='I'>res_class</emphasis>
5576
Specifies the full class name of the application.
5582
<emphasis remap='I'>callback</emphasis>
5586
Specifies a pointer to the input method instantiate callback.
5592
<emphasis remap='I'>client_data</emphasis>
5596
Specifies the additional client data.
5606
<function>XRegisterIMInstantiateCallback</function>
5607
function registers a callback to be invoked whenever a new input method
5608
becomes available for the specified display that matches the current
5609
locale and modifiers.
5613
The function returns
5614
<symbol>True</symbol>
5615
if it succeeds; otherwise, it returns
5616
<symbol>False</symbol>.
5620
The generic prototype is as follows:
5621
<indexterm significance="preferred"><primary>IMInstantiateCallback</primary></indexterm>
5625
<funcdef>void <function><replaceable>IMInstantiateCallback</replaceable></function></funcdef>
5626
<paramdef>Display<parameter> *display</parameter></paramdef>
5627
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
5628
<paramdef>XPointer<parameter> call_data</parameter></paramdef>
5635
<emphasis remap='I'>display</emphasis>
5639
Specifies the connection to the X server.
5645
<emphasis remap='I'>client_data</emphasis>
5649
Specifies the additional client data.
5655
<emphasis remap='I'>call_data</emphasis>
5659
Not used for this callback and always passed as NULL.
5668
To unregister an input method instantiation callback, use
5669
<function>XUnregisterIMInstantiateCallback</function>.
5670
<indexterm significance="preferred"><primary>XUnregisterIMInstantiateCallback</primary></indexterm>
5674
<funcdef>Bool <function>XUnregisterIMInstantiateCallback</function></funcdef>
5675
<paramdef>Display<parameter> *display</parameter></paramdef>
5676
<paramdef>XrmDatabase<parameter> db</parameter></paramdef>
5677
<paramdef>char<parameter> *res_name</parameter></paramdef>
5678
<paramdef>char<parameter> *res_class</parameter></paramdef>
5679
<paramdef>XIMProc<parameter> callback</parameter></paramdef>
5680
<paramdef>XPointer<parameter> *client_data</parameter></paramdef>
5687
<emphasis remap='I'>display</emphasis>
5691
Specifies the connection to the X server.
5697
<emphasis remap='I'>db</emphasis>
5701
Specifies a pointer to the resource database.
5707
<emphasis remap='I'>res_name</emphasis>
5711
Specifies the full resource name of the application.
5717
<emphasis remap='I'>res_class</emphasis>
5721
Specifies the full class name of the application.
5727
<emphasis remap='I'>callback</emphasis>
5731
Specifies a pointer to the input method instantiate callback.
5737
<emphasis remap='I'>client_data</emphasis>
5741
Specifies the additional client data.
5751
<function>XUnregisterIMInstantiateCallback</function>
5752
function removes an input method instantiation callback previously
5754
The function returns
5755
<symbol>True</symbol>
5756
if it succeeds; otherwise, it returns
5757
<symbol>False</symbol>.
5760
<sect2 id="Input_Method_Values">
5761
<title>Input Method Values</title>
5763
<!-- (SN Input Method Values -->
5767
The following table describes how <acronym>XIM</acronym> values are interpreted
5769
The first column lists the <acronym>XIM</acronym> values.
5770
The second column indicates how each of the <acronym>XIM</acronym> values
5771
are treated by that input style.
5778
The following keys apply to this table.
5781
<tgroup cols='2' align='center'>
5782
<colspec colname='c1'/>
5783
<colspec colname='c2'/>
5787
<entry>Explanation</entry>
5793
<entry>This value may be set using
5794
<function>XSetIMValues</function>.
5796
a default is provided.</entry>
5800
<entry>This value may be set using <function>XSetIMValues</function>.</entry>
5804
<entry>This value may be read using <function>XGetIMValues</function>.</entry>
5812
<tgroup cols='2' align='center'>
5813
<colspec colname='c1'/>
5814
<colspec colname='c2'/>
5817
<entry><acronym>XIM</acronym> Value</entry>
5823
<entry><symbol>XNQueryInputStyle</symbol></entry>
5827
<entry><symbol>XNResourceName</symbol></entry>
5828
<entry>D-S-G</entry>
5831
<entry><symbol>XNResourceClass</symbol></entry>
5832
<entry>D-S-G</entry>
5835
<entry><symbol>XNDestroyCallback</symbol></entry>
5836
<entry>D-S-G</entry>
5839
<entry><symbol>XNQueryIMValuesList</symbol></entry>
5843
<entry><symbol>XNQueryICValuesList</symbol></entry>
5847
<entry><symbol>XNVisiblePosition</symbol></entry>
5851
<entry><symbol>XNR6PreeditCallback</symbol></entry>
5852
<entry>D-S-G</entry>
5860
<symbol>XNR6PreeditCallback</symbol>
5861
is obsolete and its use is not recommended (see section 13.5.4.6).
5864
<sect3 id="Query_Input_Style">
5865
<title>Query Input Style</title>
5867
<!-- (SN Query Input Style -->
5871
A client should always query the input method to determine which input
5872
styles are supported.
5873
The client should then find an input style it is capable of supporting.
5877
If the client cannot find an input style that it can support,
5878
it should negotiate with the user the continuation of the program
5879
(exit, choose another input method, and so on).
5883
The argument value must be a pointer to a location
5884
where the returned value will be stored.
5885
The returned value is a pointer to a structure of type
5886
<structname>XIMStyles</structname>.
5887
Clients are responsible for freeing the
5888
<structname>XIMStyles</structname>
5891
<function>XFree</function>.
5896
<structname>XIMStyles</structname>
5897
structure is defined as follows:
5901
<indexterm significance="preferred"><primary>XIMStyle</primary></indexterm>
5902
<indexterm significance="preferred"><primary>XIMPreeditArea</primary></indexterm>
5903
<indexterm significance="preferred"><primary>XIMPreeditCallbacks</primary></indexterm>
5904
<indexterm significance="preferred"><primary>XIMPreeditPosition</primary></indexterm>
5905
<indexterm significance="preferred"><primary>XIMPreeditNothing</primary></indexterm>
5906
<indexterm significance="preferred"><primary>XIMPreeditNone</primary></indexterm>
5907
<indexterm significance="preferred"><primary>XIMStatusArea</primary></indexterm>
5908
<indexterm significance="preferred"><primary>XIMStatusCallbacks</primary></indexterm>
5909
<indexterm significance="preferred"><primary>XIMStatusNothing</primary></indexterm>
5910
<indexterm significance="preferred"><primary>XIMStatusNone</primary></indexterm>
5911
<indexterm significance="preferred"><primary>XIMStyles</primary></indexterm>
5913
<literallayout class="monospaced">
5914
typedef unsigned long XIMStyle;
5917
#define XIMPreeditArea 0x0001L
5918
#define XIMPreeditCallbacks 0x0002L
5919
#define XIMPreeditPosition 0x0004L
5920
#define XIMPreeditNothing 0x0008L
5921
#define XIMPreeditNone 0x0010L
5923
#define XIMStatusArea 0x0100L
5924
#define XIMStatusCallbacks 0x0200L
5925
#define XIMStatusNothing 0x0400L
5926
#define XIMStatusNone 0x0800L
5929
unsigned short count_styles;
5930
XIMStyle * supported_styles;
5940
<structname>XIMStyles</structname>
5941
structure contains the number of input styles supported
5942
in its count_styles field.
5943
This is also the size of the supported_styles array.
5947
The supported styles is a list of bitmask combinations,
5948
which indicate the combination of styles for each of the areas supported.
5949
These areas are described later.
5950
Each element in the list should select one of the bitmask values for
5952
The list describes the complete set of combinations supported.
5953
Only these combinations are supported by the input method.
5957
The preedit category defines what type of support is provided
5958
by the input method for preedit information.
5960
<indexterm significance="preferred"><primary>XIMPreeditArea</primary></indexterm>
5961
<indexterm significance="preferred"><primary>XIMPreeditPosition</primary></indexterm>
5962
<indexterm significance="preferred"><primary>XIMPreeditCallbacks</primary></indexterm>
5963
<indexterm significance="preferred"><primary>XIMPreeditNothing</primary></indexterm>
5964
<indexterm significance="preferred"><primary>XIMPreeditNone</primary></indexterm>
5966
<tgroup cols='2' align='center'>
5967
<colspec colname='c1'/>
5968
<colspec colname='c2'/>
5971
<entry><symbol>XIMPreeditArea</symbol></entry>
5973
the input method would require the client to provide some area values
5974
for it to do its preediting.
5975
Refer to <acronym>XIC</acronym> values
5976
<symbol>XNArea</symbol>
5978
<symbol>XNAreaNeeded</symbol>.</entry>
5981
<entry><symbol>XIMPreeditPosition</symbol></entry>
5983
the input method would require the client to provide positional values.
5984
Refer to <acronym>XIC</acronym> values
5985
<symbol>XNSpotLocation</symbol>
5987
<symbol>XNFocusWindow</symbol>.</entry>
5990
<entry><symbol>XIMPreeditCallbacks</symbol></entry>
5992
the input method would require the client to define the set of preedit callbacks.
5993
Refer to <acronym>XIC</acronym> values
5994
<symbol>XNPreeditStartCallback</symbol>,
5995
<symbol>XNPreeditDoneCallback</symbol>,
5996
<symbol>XNPreeditDrawCallback</symbol>,
5998
<symbol>XNPreeditCaretCallback</symbol>.</entry>
6001
<entry><symbol>XIMPreeditNothing</symbol></entry>
6002
<entry>If chosen, the input method can function without any preedit values.</entry>
6005
<entry><symbol>XIMPreeditNone</symbol></entry>
6006
<entry>The input method does not provide any preedit feedback.
6007
Any preedit value is ignored.
6008
This style is mutually exclusive with the other preedit styles.</entry>
6016
The status category defines what type of support is provided
6017
by the input method for status information.
6019
<indexterm significance="preferred"><primary>XIMStatusArea</primary></indexterm>
6020
<indexterm significance="preferred"><primary>XIMStatusCallbacks</primary></indexterm>
6021
<indexterm significance="preferred"><primary>XIMStatusNothing</primary></indexterm>
6022
<indexterm significance="preferred"><primary>XIMStatusNone</primary></indexterm>
6024
<tgroup cols='2' align='center'>
6025
<colspec colname='c1'/>
6026
<colspec colname='c2'/>
6029
<entry><symbol>XIMStatusArea</symbol></entry>
6030
<entry>The input method requires the client to provide
6031
some area values for it to do its status feedback.
6033
<symbol>XNArea</symbol>
6035
<symbol>XNAreaNeeded</symbol>.</entry>
6038
<entry><symbol>XIMStatusCallbacks</symbol></entry>
6039
<entry>The input method requires the client to define the set of status callbacks,
6040
<symbol>XNStatusStartCallback</symbol>,
6041
<symbol>XNStatusDoneCallback</symbol>,
6043
<symbol>XNStatusDrawCallback</symbol>.</entry>
6046
<entry><symbol>XIMStatusNothing</symbol></entry>
6047
<entry>The input method can function without any status values.</entry>
6050
<entry><symbol>XIMStatusNone</symbol></entry>
6051
<entry>The input method does not provide any status feedback.
6052
If chosen, any status value is ignored.
6053
This style is mutually exclusive with the other status styles.</entry>
6060
<sect3 id="Resource_Name_and_Class_c">
6061
<title>Resource Name and Class</title>
6063
<!-- (SN Resource Name and Class -->
6068
<symbol>XNResourceName</symbol>
6070
<symbol>XNResourceClass</symbol>
6071
arguments are strings that specify the full name and class
6072
used by the input method.
6073
These values should be used as prefixes for the name and class
6074
when looking up resources that may vary according to the input method.
6075
If these values are not set,
6076
the resources will not be fully specified.
6080
It is not intended that values that can be set as <acronym>XIM</acronym> values be
6087
<sect3 id="Destroy_Callback">
6088
<title>Destroy Callback</title>
6090
<!-- (SN Destroy Callback -->
6095
<symbol>XNDestroyCallback</symbol>
6096
argument is a pointer to a structure of type
6097
<structname>XIMCallback</structname>.
6098
<symbol>XNDestroyCallback</symbol>
6099
is triggered when an input method stops its service for any reason.
6100
After the callback is invoked, the input method is closed and the
6101
associated input context(s) are destroyed by Xlib.
6102
Therefore, the client should not call
6103
<function>XCloseIM</function>
6105
<function>XDestroyIC</function>.
6109
The generic prototype of this callback function is as follows:
6110
<indexterm significance="preferred"><primary>DestroyCallback</primary></indexterm>
6114
<funcdef>void <function><replaceable>DestroyCallback</replaceable></function></funcdef>
6115
<paramdef>XIM<parameter> im</parameter></paramdef>
6116
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
6117
<paramdef>XPointer<parameter> call_data</parameter></paramdef>
6124
<emphasis remap='I'>im</emphasis>
6128
Specifies the input method.
6134
<emphasis remap='I'>client_data</emphasis>
6138
Specifies the additional client data.
6144
<emphasis remap='I'>call_data</emphasis>
6148
Not used for this callback and always passed as NULL.
6157
A DestroyCallback is always called with a NULL call_data argument.
6163
<sect3 id="Query_IM_IC_Values_List">
6164
<title>Query IM/IC Values List</title>
6166
<!-- (SN Query IM/IC Values List -->
6170
<symbol>XNQueryIMValuesList</symbol>
6172
<symbol>XNQueryICValuesList</symbol>
6173
are used to query about <acronym>XIM</acronym> and <acronym>XIC</acronym> values supported by the input method.
6177
The argument value must be a pointer to a location where the returned
6178
value will be stored. The returned value is a pointer to a structure
6180
<structname>XIMValuesList</structname>.
6181
Clients are responsible for freeing the
6182
<structname>XIMValuesList</structname>
6185
<function>XFree</function>.
6190
<structname>XIMValuesList</structname>
6191
structure is defined as follows:
6193
<literallayout class="monospaced">
6194
<!-- .TA .5i 2.5i -->
6195
<!-- .ta .5i 2.5i -->
6197
unsigned short count_values;
6198
char **supported_values;
6207
<sect3 id="Visible_Position">
6208
<title>Visible Position</title>
6210
<!-- (SN Visible Position -->
6215
<symbol>XNVisiblePosition</symbol>
6216
argument indicates whether the visible position masks of
6217
<type>XIMFeedback</type>
6219
<structname>XIMText</structname>
6224
The argument value must be a pointer to a location where the returned
6225
value will be stored. The returned value is of type
6227
If the returned value is
6228
<symbol>True</symbol>,
6229
the input method uses the visible position masks of
6230
<type>XIMFeedback</type>
6232
<structname>XIMText</structname>;
6233
otherwise, the input method does not use the masks.
6237
Because this <acronym>XIM</acronym> value is optional, a client should call
6238
<function>XGetIMValues</function>
6240
<symbol>XNQueryIMValuesList</symbol>
6241
before using this argument.
6243
<symbol>XNVisiblePosition</symbol>
6244
does not exist in the IM values list returned from
6245
<symbol>XNQueryIMValuesList</symbol>,
6246
the visible position masks of
6247
<type>XIMFeedback</type>
6249
<structname>XIMText</structname>
6250
are not used to indicate the visible position.
6256
<sect3 id="Preedit_Callback_Behavior">
6257
<title>Preedit Callback Behavior</title>
6259
<!-- (SN Preedit Callback Behavior -->
6264
<symbol>XNR6PreeditCallback</symbol>
6265
argument originally included in the X11R6 specification has been
6267
<!-- .\" If XNR6PreeditCallbackBehavior is not deprecated, then its type -->
6268
<!-- .\" should be changed from *Bool to Bool. -->
6270
During formulation of the X11R6 specification, the behavior of
6271
the R6 PreeditDrawCallbacks was going to differ significantly from
6272
that of the R5 callbacks.
6273
Late changes to the specification converged the R5 and R6 behaviors,
6274
eliminating the need for
6275
<symbol>XNR6PreeditCallback</symbol>.
6276
Unfortunately, this argument was not removed from the R6 specification
6277
before it was published.
6283
<symbol>XNR6PreeditCallback</symbol>
6284
argument indicates whether the behavior of preedit callbacks regarding
6285
<structname>XIMPreeditDrawCallbackStruct</structname>
6286
values follows Release 5 or Release 6 semantics.
6290
The value is of type
6293
<symbol>XNR6PreeditCallback</symbol>,
6294
if the returned value is
6295
<symbol>True</symbol>,
6296
the input method uses the Release 6 behavior;
6297
otherwise, it uses the Release 5 behavior.
6298
The default value is
6299
<symbol>False</symbol>.
6300
In order to use Release 6 semantics, the value of
6301
<symbol>XNR6PreeditCallback</symbol>
6303
<symbol>True</symbol>.
6307
Because this <acronym>XIM</acronym> value is optional, a client should call
6308
<function>XGetIMValues</function>
6310
<symbol>XNQueryIMValuesList</symbol>
6311
before using this argument.
6313
<symbol>XNR6PreeditCallback</symbol>
6314
does not exist in the IM values list returned from
6315
<symbol>XNQueryIMValuesList</symbol>,
6316
the PreeditCallback behavior is Release 5 semantics.
6323
<sect2 id="Input_Context_Functions">
6324
<title>Input Context Functions</title>
6326
<!-- (SN Input Context Functions -->
6330
An input context is an abstraction that is used to contain both the data
6331
required (if any) by an input method and the information required
6332
to display that data.
6333
There may be multiple input contexts for one input method.
6334
The programming interfaces for creating, reading, or modifying
6335
an input context use a variable argument list.
6336
The name elements of the argument lists are referred to as <acronym>XIC</acronym> values.
6337
It is intended that input methods be controlled by these <acronym>XIC</acronym> values.
6338
As new <acronym>XIC</acronym> values are created,
6339
they should be registered with the X Consortium.
6344
To create an input context, use
6345
<function>XCreateIC</function>.
6346
<indexterm significance="preferred"><primary>XCreateIC</primary></indexterm>
6350
<funcdef>XIC <function>XCreateIC</function></funcdef>
6351
<paramdef>XIM<parameter> im</parameter></paramdef>
6358
<emphasis remap='I'>im</emphasis>
6362
Specifies the input method.
6363
<!-- .ds Al \ to set <acronym>XIC</acronym> values -->
6373
Specifies the variable length argument list(Al.
6383
<function>XCreateIC</function>
6384
function creates a context within the specified input method.
6388
Some of the arguments are mandatory at creation time, and
6389
the input context will not be created if those arguments are not provided.
6390
The mandatory arguments are the input style and the set of text callbacks
6391
(if the input style selected requires callbacks).
6392
All other input context values can be set later.
6396
<function>XCreateIC</function>
6397
returns a NULL value if no input context could be created.
6398
A NULL value could be returned for any of the following reasons:
6403
A required argument was not set.
6408
A read-only argument was set (for example,
6409
<symbol>XNFilterEvents</symbol>).
6414
The argument name is not recognized.
6419
The input method encountered an input method implementation-dependent error.
6425
<function>XCreateIC</function>
6427
<errorname>BadAtom</errorname>,
6428
<errorname>BadColor</errorname>,
6429
<errorname>BadPixmap</errorname>,
6431
<errorname>BadWindow</errorname>
6437
To destroy an input context, use
6438
<function>XDestroyIC</function>.
6439
<indexterm significance="preferred"><primary>XDestroyIC</primary></indexterm>
6443
<funcdef>void <function>XDestroyIC</function></funcdef>
6444
<paramdef>XIC<parameter> ic</parameter></paramdef>
6451
<emphasis remap='I'>ic</emphasis>
6455
Specifies the input context.
6464
<function>XDestroyIC</function>
6465
destroys the specified input context.
6470
To communicate to and synchronize with input method
6471
for any changes in keyboard focus from the client side,
6473
<function>XSetICFocus</function>
6475
<function>XUnsetICFocus</function>.
6476
<indexterm significance="preferred"><primary>XSetICFocus</primary></indexterm>
6480
<funcdef>void <function>XSetICFocus</function></funcdef>
6481
<paramdef>XIC<parameter> ic</parameter></paramdef>
6488
<emphasis remap='I'>ic</emphasis>
6492
Specifies the input context.
6502
<function>XSetICFocus</function>
6503
function allows a client to notify an input method that the focus window
6504
attached to the specified input context has received keyboard focus.
6505
The input method should take action to provide appropriate feedback.
6506
Complete feedback specification is a matter of user interface policy.
6511
<function>XSetICFocus</function>
6512
does not affect the focus window value.
6517
<indexterm significance="preferred"><primary>XUnsetICFocus</primary></indexterm>
6521
<funcdef>void <function>XUnsetICFocus</function></funcdef>
6522
<paramdef>XIC<parameter> ic</parameter></paramdef>
6529
<emphasis remap='I'>ic</emphasis>
6533
Specifies the input context.
6543
<function>XUnsetICFocus</function>
6544
function allows a client to notify an input method that the specified input context
6545
has lost the keyboard focus and that no more input is expected on the focus window
6546
attached to that input context.
6547
The input method should take action to provide appropriate feedback.
6548
Complete feedback specification is a matter of user interface policy.
6553
<function>XUnsetICFocus</function>
6554
does not affect the focus window value;
6555
the client may still receive
6556
events from the input method that are directed to the focus window.
6561
To reset the state of an input context to its initial state, use
6562
<function>XmbResetIC</function>
6564
<function>XwcResetIC</function>.
6565
<indexterm significance="preferred"><primary>XmbResetIC</primary></indexterm>
6566
<indexterm significance="preferred"><primary>XwcResetIC</primary></indexterm>
6570
<funcdef>char *<function>XmbResetIC</function></funcdef>
6571
<paramdef>XIC<parameter> ic</parameter></paramdef>
6577
<funcdef>wchar_t *<function>XwcResetIC</function></funcdef>
6578
<paramdef>XIC<parameter> ic</parameter></paramdef>
6585
<emphasis remap='I'>ic</emphasis>
6589
Specifies the input context.
6599
<symbol>XNResetState</symbol>
6601
<symbol>XIMInitialState</symbol>,
6602
<function>XmbResetIC</function>
6604
<function>XwcResetIC</function>
6605
reset an input context to its initial state;
6607
<symbol>XNResetState</symbol>
6609
<symbol>XIMPreserveState</symbol>,
6610
the current input context state is preserved.
6611
In both cases, any input pending on that context is deleted.
6612
The input method is required to clear the preedit area, if any,
6613
and update the status accordingly.
6615
<function>XmbResetIC</function>
6617
<function>XwcResetIC</function>
6618
does not change the focus.
6623
<function>XmbResetIC</function>
6624
is its current preedit string as a multibyte string.
6625
If there is any preedit text drawn or visible to the user,
6626
then these procedures must return a non-NULL string.
6627
If there is no visible preedit text,
6628
then it is input method implementation-dependent
6629
whether these procedures return a non-NULL string or NULL.
6633
The client should free the returned string by calling
6634
<function>XFree</function>.
6639
To get the input method associated with an input context, use
6640
<function>XIMOfIC</function>.
6641
<indexterm significance="preferred"><primary>XIMOfIC</primary></indexterm>
6645
<funcdef>XIM <function>XIMOfIC</function></funcdef>
6646
<paramdef>XIC<parameter> ic</parameter></paramdef>
6653
<emphasis remap='I'>ic</emphasis>
6657
Specifies the input context.
6667
<function>XIMOfIC</function>
6668
function returns the input method associated with the specified input context.
6673
Xlib provides two functions for setting and reading <acronym>XIC</acronym> values, respectively,
6674
<function>XSetICValues</function>
6676
<function>XGetICValues</function>.
6677
Both functions have a variable-length argument list.
6678
In that argument list, any <acronym>XIC</acronym> value's name must be denoted
6679
with a character string using the X Portable Character Set.
6684
To set <acronym>XIC</acronym> values, use
6685
<function>XSetICValues</function>.
6686
<indexterm significance="preferred"><primary>XSetICValues</primary></indexterm>
6690
<funcdef>char *<function>XSetICValues</function></funcdef>
6691
<paramdef>XIC<parameter> ic</parameter></paramdef>
6698
<emphasis remap='I'>ic</emphasis>
6702
Specifies the input context.
6703
<!-- .ds Al \ to set <acronym>XIC</acronym> values -->
6713
Specifies the variable length argument list(Al.
6723
<function>XSetICValues</function>
6724
function returns NULL if no error occurred;
6726
it returns the name of the first argument that could not be set.
6727
An argument might not be set for any of the following reasons:
6732
The argument is read-only (for example,
6733
<symbol>XNFilterEvents</symbol>).
6738
The argument name is not recognized.
6743
An implementation-dependent error occurs.
6749
Each value to be set must be an appropriate datum,
6750
matching the data type imposed by the semantics of the argument.
6754
<function>XSetICValues</function>
6756
<errorname>BadAtom</errorname>,
6757
<errorname>BadColor</errorname>,
6758
<errorname>BadCursor</errorname>,
6759
<errorname>BadPixmap</errorname>,
6761
<errorname>BadWindow</errorname>
6767
To obtain <acronym>XIC</acronym> values, use
6768
<function>XGetICValues</function>.
6769
<indexterm significance="preferred"><primary>XGetICValues</primary></indexterm>
6773
<funcdef>char *<function>XGetICValues</function></funcdef>
6774
<paramdef>XIC<parameter> ic</parameter></paramdef>
6781
<emphasis remap='I'>ic</emphasis>
6785
Specifies the input context.
6786
<!-- .ds Al \ to get XIC values -->
6796
Specifies the variable length argument list(Al.
6806
<function>XGetICValues</function>
6807
function returns NULL if no error occurred; otherwise,
6808
it returns the name of the first argument that could not be obtained.
6809
An argument could not be obtained for any of the following reasons:
6814
The argument name is not recognized.
6819
The input method encountered an implementation-dependent error.
6825
Each IC attribute value argument (following a name) must point to
6826
a location where the IC value is to be stored.
6827
That is, if the IC value is of type T,
6828
the argument must be of type T*.
6829
If T itself is a pointer type,
6831
<function>XGetICValues</function>
6832
allocates memory to store the actual data,
6833
and the client is responsible for freeing this data by calling
6834
<function>XFree</function>
6835
with the returned pointer.
6836
The exception to this rule is for an IC value of type
6837
<type>XVaNestedList</type>
6838
(for preedit and status attributes).
6839
In this case, the argument must also be of type
6840
<type>XVaNestedList</type>.
6841
Then, the rule of changing type T to T* and freeing the allocated data
6842
applies to each element of the nested list.
6845
<sect2 id="Input_Context_Values">
6846
<title>Input Context Values</title>
6848
<!-- (SN Input Context Values -->
6852
The following tables describe how <acronym>XIC</acronym> values are interpreted
6853
by an input method depending on the input style chosen by the
6858
The first column lists the <acronym>XIC</acronym> values.
6859
The second column indicates which values are involved in affecting,
6860
negotiating, and setting the geometry of the input method windows.
6861
The subentries under the third column indicate the different
6862
input styles that are supported.
6863
Each of these columns indicates how each of the <acronym>XIC</acronym> values
6864
are treated by that input style.
6868
The following keys apply to these tables.
6871
<tgroup cols='2' align='center'>
6872
<colspec colname='c1'/>
6873
<colspec colname='c2'/>
6877
<entry>Explanation</entry>
6883
<entry>This value must be set with <function>XCreateIC</function>.</entry>
6887
<entry>This value may be set using
6888
<function>XCreateIC</function>.>
6890
a default is provided.</entry>
6894
<entry>This value may be read using
6895
<function>XGetICValues</function>.</entry>
6899
<entry>This value may cause geometry negotiation when its value is set by means of
6900
<function>XCreateIC</function>
6902
<function>XSetICValues</function>.</entry>
6906
<entry>This value will be the response of the input method when any
6907
GN value is changed.</entry>
6911
<entry>This value will cause the geometry of the input method window to be set.</entry>
6915
<entry>This value must be set once and only once.
6916
It need not be set at create time.</entry>
6920
<entry>This value may be set with
6921
<function>XSetICValues</function>.</entry>
6924
<entry>Ignored</entry>
6925
<entry>This value is ignored by the input method for the given input style.</entry>
6933
<tgroup cols='7' align='center'>
6934
<colspec colname='c1'/>
6935
<colspec colname='c2'/>
6936
<colspec colname='c3'/>
6937
<colspec colname='c4'/>
6938
<colspec colname='c5'/>
6939
<colspec colname='c6'/>
6940
<colspec colname='c7'/>
6943
<entry><acronym>XIC</acronym> Value</entry>
6944
<entry>Geometry Mangement</entry>
6945
<entry>Preedit Callback</entry>
6946
<entry>Preedit Position</entry>
6947
<entry>Input Style Preedit Area</entry>
6948
<entry>Preedit Nothing</entry>
6949
<entry>Preedit None</entry>
6952
<entry>Input Style</entry>
6961
<entry>Client Window</entry>
6967
<entry>Ignored</entry>
6970
<entry>Focus Window</entry>
6972
<entry>D-S-G</entry>
6973
<entry>D-S-G</entry>
6974
<entry>D-S-G</entry>
6975
<entry>D-S-G</entry>
6976
<entry>Ignored</entry>
6979
<entry>Resource Name</entry>
6981
<entry>Ignored</entry>
6982
<entry>D-S-G</entry>
6983
<entry>D-S-G</entry>
6984
<entry>D-S-G</entry>
6985
<entry>Ignored</entry>
6988
<entry>Resource Class</entry>
6990
<entry>Ignored</entry>
6991
<entry>D-S-G</entry>
6992
<entry>D-S-G</entry>
6993
<entry>D-S-G</entry>
6994
<entry>Ignored</entry>
6997
<entry>Geometry Callback</entry>
6999
<entry>Ignored</entry>
7000
<entry>Ignored</entry>
7001
<entry>D-S-G</entry>
7002
<entry>Ignored</entry>
7003
<entry>Ignored</entry>
7006
<entry>Filter Events</entry>
7012
<entry>Ignored</entry>
7015
<entry>Destroy Callback</entry>
7017
<entry>D-S-G</entry>
7018
<entry>D-S-G</entry>
7019
<entry>D-S-G</entry>
7020
<entry>D-S-G</entry>
7021
<entry>D-S-G</entry>
7024
<entry>String Conversion Callback</entry>
7033
<entry>String Conversion</entry>
7035
<entry>D-S-G</entry>
7036
<entry>D-S-G</entry>
7037
<entry>D-S-G</entry>
7038
<entry>D-S-G</entry>
7039
<entry>D-S-G</entry>
7042
<entry>Reset State</entry>
7044
<entry>D-S-G</entry>
7045
<entry>D-S-G</entry>
7046
<entry>D-S-G</entry>
7047
<entry>D-S-G</entry>
7048
<entry>Ignored</entry>
7051
<entry>HotKey</entry>
7057
<entry>Ignored</entry>
7060
<entry>HotKeyState</entry>
7062
<entry>D-S-G</entry>
7063
<entry>D-S-G</entry>
7064
<entry>D-S-G</entry>
7065
<entry>D-S-G</entry>
7066
<entry>Ignored</entry>
7069
<entry><function>Preedit</function></entry>
7074
<entry>Ignored</entry>
7075
<entry>D-S-G</entry>
7076
<entry>D-S-G</entry>
7077
<entry>Ignored</entry>
7078
<entry>Ignored</entry>
7081
<entry>Area Needed</entry>
7082
<entry>GN-GR</entry>
7083
<entry>Ignored</entry>
7084
<entry>Ignored</entry>
7086
<entry>Ignored</entry>
7087
<entry>Ignored</entry>
7090
<entry>Spot Location</entry>
7092
<entry>Ignored</entry>
7093
<entry>D-S-G</entry>
7094
<entry>Ignored</entry>
7095
<entry>Ignored</entry>
7096
<entry>Ignored</entry>
7099
<entry>Colormap</entry>
7101
<entry>Ignored</entry>
7102
<entry>D-S-G</entry>
7103
<entry>D-S-G</entry>
7104
<entry>D-S-G</entry>
7105
<entry>Ignored</entry>
7108
<entry>Foreground</entry>
7110
<entry>Ignored</entry>
7111
<entry>D-S-G</entry>
7112
<entry>D-S-G</entry>
7113
<entry>D-S-G</entry>
7114
<entry>Ignored</entry>
7117
<entry>Background</entry>
7119
<entry>Ignored</entry>
7120
<entry>D-S-G</entry>
7121
<entry>D-S-G</entry>
7122
<entry>D-S-G</entry>
7123
<entry>Ignored</entry>
7126
<entry>Background Pixmap</entry>
7128
<entry>Ignored</entry>
7129
<entry>D-S-G</entry>
7130
<entry>D-S-G</entry>
7131
<entry>D-S-G</entry>
7132
<entry>Ignored</entry>
7135
<entry>Font Set</entry>
7137
<entry>Ignored</entry>
7138
<entry>D-S-G</entry>
7139
<entry>D-S-G</entry>
7140
<entry>D-S-G</entry>
7141
<entry>Ignored</entry>
7144
<entry>Line Spacing</entry>
7146
<entry>Ignored</entry>
7147
<entry>D-S-G</entry>
7148
<entry>D-S-G</entry>
7149
<entry>D-S-G</entry>
7150
<entry>Ignored</entry>
7153
<entry>Cursor</entry>
7155
<entry>Ignored</entry>
7156
<entry>D-S-G</entry>
7157
<entry>D-S-G</entry>
7158
<entry>D-S-G</entry>
7159
<entry>Ignored</entry>
7162
<entry>Preedit State</entry>
7164
<entry>D-S-G</entry>
7165
<entry>D-S-G</entry>
7166
<entry>D-S-G</entry>
7167
<entry>D-S-G</entry>
7168
<entry>Ignored</entry>
7171
<entry>Preedit State Notify Callback</entry>
7177
<entry>Ignored</entry>
7180
<entry>Preedit Callbacks</entry>
7182
<entry>C-S-G</entry>
7183
<entry>Ignored</entry>
7184
<entry>Ignored</entry>
7185
<entry>Ignored</entry>
7186
<entry>Ignored</entry>
7194
<tgroup cols='6' align='center'>
7195
<colspec colname='c1'/>
7196
<colspec colname='c2'/>
7197
<colspec colname='c3'/>
7198
<colspec colname='c4'/>
7199
<colspec colname='c5'/>
7200
<colspec colname='c6'/>
7203
<entry><acronym>XIC</acronym> Value</entry>
7204
<entry>Geomentry Management</entry>
7205
<entry>Status Callback</entry>
7206
<entry>Status Area</entry>
7207
<entry>Status Nothing</entry>
7208
<entry>Status None</entry>
7213
<entry>Input Style</entry>
7221
<entry>Client Window</entry>
7226
<entry>Ignored</entry>
7229
<entry>Focus Window</entry>
7231
<entry>D-S-G</entry>
7232
<entry>D-S-G</entry>
7233
<entry>D-S-G</entry>
7234
<entry>Ignored</entry>
7237
<entry>Resource Name</entry>
7239
<entry>Ignored</entry>
7240
<entry>D-S-G</entry>
7241
<entry>D-S-G</entry>
7242
<entry>Ignored</entry>
7245
<entry>Resource Class</entry>
7247
<entry>Ignored</entry>
7248
<entry>D-S-G</entry>
7249
<entry>D-S-G</entry>
7250
<entry>Ignored</entry>
7253
<entry>Geometry Callback</entry>
7255
<entry>Ignored</entry>
7256
<entry>D-S-G</entry>
7257
<entry>Ignored</entry>
7258
<entry>Ignored</entry>
7261
<entry>Filter Events</entry>
7269
<entry><type>Status</type></entry>
7274
<entry>Ignored</entry>
7275
<entry>D-S-G</entry>
7276
<entry>Ignored</entry>
7277
<entry>Ignored</entry>
7280
<entry>Area Needed</entry>
7281
<entry>GN-GR</entry>
7282
<entry>Ignored</entry>
7284
<entry>Ignored</entry>
7285
<entry>Ignored</entry>
7288
<entry>Colormap</entry>
7290
<entry>Ignored</entry>
7291
<entry>D-S-G</entry>
7292
<entry>D-S-G</entry>
7293
<entry>Ignored</entry>
7296
<entry>Foreground</entry>
7298
<entry>Ignored</entry>
7299
<entry>D-S-G</entry>
7300
<entry>D-S-G</entry>
7301
<entry>Ignored</entry>
7304
<entry>Background</entry>
7306
<entry>Ignored</entry>
7307
<entry>D-S-G</entry>
7308
<entry>D-S-G</entry>
7309
<entry>Ignored</entry>
7312
<entry>Background Pixmap</entry>
7314
<entry>Ignored</entry>
7315
<entry>D-S-G</entry>
7316
<entry>D-S-G</entry>
7317
<entry>Ignored</entry>
7320
<entry>Font Set</entry>
7322
<entry>Ignored</entry>
7323
<entry>D-S-G</entry>
7324
<entry>D-S-G</entry>
7325
<entry>Ignored</entry>
7328
<entry>Line Spacing</entry>
7330
<entry>Ignored</entry>
7331
<entry>D-S-G</entry>
7332
<entry>D-S-G</entry>
7333
<entry>Ignored</entry>
7336
<entry>Cursor</entry>
7338
<entry>Ignored</entry>
7339
<entry>D-S-G</entry>
7340
<entry>D-S-G</entry>
7341
<entry>Ignored</entry>
7344
<entry>Status Callbacks</entry>
7346
<entry>C-S-G</entry>
7347
<entry>Ignored</entry>
7348
<entry>Ignored</entry>
7349
<entry>Ignored</entry>
7354
<sect3 id="Input_Style">
7355
<title>Input Style</title>
7357
<!-- (SN Input Style -->
7362
<symbol>XNInputStyle</symbol>
7363
argument specifies the input style to be used.
7364
The value of this argument must be one of the values returned by the
7365
<function>XGetIMValues</function>
7367
<symbol>XNQueryInputStyle</symbol>
7368
argument specified in the supported_styles list.
7372
Note that this argument must be set at creation time
7373
and cannot be changed.
7376
<sect3 id="Client_Window">
7377
<title>Client Window</title>
7379
<!-- (SN Client Window -->
7383
<indexterm significance="preferred"><primary>XNClientWindow</primary></indexterm>
7385
<symbol>XNClientWindow</symbol>
7386
argument specifies to the input method the client window in
7387
which the input method
7388
can display data or create subwindows.
7389
Geometry values for input method areas are given with respect to the client
7391
Dynamic change of client window is not supported.
7392
This argument may be set only once and
7393
should be set before any input is done using this input context.
7395
the input method may not operate correctly.
7399
If an attempt is made to set this value a second time with
7400
<function>XSetICValues</function>,
7402
<symbol>XNClientWindow</symbol>
7404
<function>XSetICValues</function>,
7405
and the client window will not be changed.
7409
If the client window is not a valid window ID on the display
7410
attached to the input method,
7412
<errorname>BadWindow</errorname>
7413
error can be generated when this value is used by the input method.
7416
<sect3 id="Focus_Window">
7417
<title>Focus Window</title>
7419
<!-- (SN Focus Window -->
7423
<indexterm significance="preferred"><primary>XNFocusWindow</primary></indexterm>
7425
<symbol>XNFocusWindow</symbol>
7426
argument specifies the focus window.
7427
The primary purpose of the
7428
<symbol>XNFocusWindow</symbol>
7429
is to identify the window that will receive the key event when input
7431
In addition, the input method may possibly affect the focus window
7447
Modify its properties
7452
Grab the keyboard within that window
7458
The associated value must be of type
7459
<type>Window</type>.
7460
If the focus window is not a valid window ID on the display
7461
attached to the input method,
7463
<errorname>BadWindow</errorname>
7464
error can be generated when this value is used by the input method.
7468
When this <acronym>XIC</acronym> value is left unspecified,
7469
the input method will use the client window as the default focus window.
7472
<sect3 id="Resource_Name_and_Class_b">
7473
<title>Resource Name and Class</title>
7475
<!-- (SN Resource Name and Class -->
7479
<indexterm significance="preferred"><primary>XNResourceName</primary></indexterm>
7480
<indexterm significance="preferred"><primary>XNResourceClass</primary></indexterm>
7482
<symbol>XNResourceName</symbol>
7484
<symbol>XNResourceClass</symbol>
7485
arguments are strings that specify the full name and class
7486
used by the client to obtain resources for the client window.
7487
These values should be used as prefixes for name and class
7488
when looking up resources that may vary according to the input context.
7489
If these values are not set,
7490
the resources will not be fully specified.
7494
It is not intended that values that can be set as <acronym>XIC</acronym> values be
7498
<sect3 id="Geometry_Callback">
7499
<title>Geometry Callback</title>
7501
<!-- (SN Geometry Callback -->
7505
<indexterm significance="preferred"><primary>XNGeometryCallback</primary></indexterm>
7507
<symbol>XNGeometryCallback</symbol>
7508
argument is a structure of type
7509
<structname>XIMCallback</structname>
7510
(see section 13.5.6.13.12).
7515
<symbol>XNGeometryCallback</symbol>
7516
argument specifies the geometry callback that a client can set.
7517
This callback is not required for correct operation of either
7518
an input method or a client.
7519
It can be set for a client whose user interface policy permits
7520
an input method to request the dynamic change of that input
7522
An input method that does dynamic change will need to filter any
7523
events that it uses to initiate the change.
7526
<sect3 id="Filter_Events">
7527
<title>Filter Events</title>
7529
<!-- (SN Filter Events -->
7533
<indexterm significance="preferred"><primary>XNFilterEvents</primary></indexterm>
7535
<symbol>XNFilterEvents</symbol>
7536
argument returns the event mask that an input method needs
7537
to have selected for.
7538
The client is expected to augment its own event mask
7539
for the client window with this one.
7543
This argument is read-only, is set by the input method at create time,
7544
and is never changed.
7548
The type of this argument is
7549
<type>unsigned</type>
7551
Setting this value will cause an error.
7554
<sect3 id="Destroy_Callback_b">
7555
<title>Destroy Callback</title>
7557
<!-- (SN Destroy Callback -->
7562
<symbol>XNDestroyCallback</symbol>
7563
argument is a pointer to a structure of type
7564
<structname>XIMCallback</structname>
7565
(see section 13.5.6.13.12). This callback is triggered when the input method
7566
stops its service for any reason; for example, when a connection to an IM
7567
server is broken. After the destroy callback is called,
7568
the input context is destroyed and the input method is closed.
7569
Therefore, the client should not call
7570
<function>XDestroyIC</function>
7572
<function>XCloseIM</function>.
7578
<sect3 id="String_Conversion_Callback">
7579
<title>String Conversion Callback</title>
7581
<!-- (SN String Conversion Callback -->
7586
<symbol>XNStringConversionCallback</symbol>
7587
argument is a structure of type
7588
<structname>XIMCallback</structname>
7589
(see section 13.5.6.13.12).
7594
<symbol>XNStringConversionCallback</symbol>
7595
argument specifies a string conversion callback. This callback
7596
is not required for correct operation of
7597
either the input method or the client. It can be set by a client
7598
to support string conversions that may be requested
7599
by the input method. An input method that does string conversions
7600
will filter any events that it uses to initiate the conversion.
7604
Because this <acronym>XIC</acronym> value is optional, a client should call
7605
<function>XGetIMValues</function>
7607
<symbol>XNQueryICValuesList</symbol>
7608
before using this argument.
7614
<sect3 id="String_Conversion_">
7615
<title>String Conversion </title>
7617
<!-- (SN String Conversion -->
7622
<symbol>XNStringConversion</symbol>
7623
argument is a structure of type
7624
<structname>XIMStringConversionText</structname>.
7629
<symbol>XNStringConversion</symbol>
7630
argument specifies the string to be converted by an input method.
7631
This argument is not required for correct operation of either
7632
the input method or the client.
7636
String conversion facilitates the manipulation of text independent
7638
It is essential for some input methods and clients to manipulate
7639
text by performing context-sensitive conversion,
7640
reconversion, or transliteration conversion on it.
7644
Because this <acronym>XIC</acronym> value is optional, a client should call
7645
<function>XGetIMValues</function>
7647
<symbol>XNQueryICValuesList</symbol>
7648
before using this argument.
7653
<structname>XIMStringConversionText</structname>
7654
structure is defined as follows:
7659
<literallayout class="monospaced">
7661
typedef struct _XIMStringConversionText {
7662
unsigned short length;
7663
XIMStringConversionFeedback *feedback;
7664
Bool encoding_is_wchar;
7669
} XIMStringConversionText;
7671
typedef unsigned long XIMStringConversionFeedback;
7677
The feedback member is reserved for future use. The text to be
7678
converted is defined by the string and length members. The length
7679
is indicated in characters. To prevent the library from freeing memory
7680
pointed to by an uninitialized pointer, the client should set the feedback
7687
<sect3 id="Reset_State">
7688
<title>Reset State</title>
7690
<!-- (SN Reset State -->
7695
<symbol>XNResetState</symbol>
7696
argument specifies the state the input context will return to after calling
7697
<function>XmbResetIC</function>
7699
<function>XwcResetIC</function>.
7703
The <acronym>XIC</acronym> state may be set to its initial state, as specified by the
7704
<symbol>XNPreeditState</symbol>
7706
<function>XCreateIC</function>
7707
was called, or it may be set to preserve the current state.
7712
<type>XIMResetState</type>
7717
<indexterm significance="preferred"><primary>XIMInitialState</primary></indexterm>
7718
<indexterm significance="preferred"><primary>XINPreserveState</primary></indexterm>
7721
<literallayout class="monospaced">
7722
typedef unsigned long XIMResetState;
7724
#define XIMInitialState (1L)
7725
#define XIMPreserveState (1L<<1)
7733
<symbol>XIMInitialState</symbol>
7735
<function>XmbResetIC</function>
7737
<function>XwcResetIC</function>
7738
will return to the initial
7739
<symbol>XNPreeditState</symbol>
7740
state of the <acronym>XIC</acronym>.
7745
<symbol>XIMPreserveState</symbol>
7747
<function>XmbResetIC</function>
7749
<function>XwcResetIC</function>
7750
will preserve the current state of the <acronym>XIC</acronym>.
7755
<symbol>XNResetState</symbol>
7756
is left unspecified, the default is
7757
<symbol>XIMInitialState</symbol>.
7761
<type>XIMResetState</type>
7762
values other than those specified above will default to
7763
<symbol>XIMInitialState</symbol>.
7767
Because this <acronym>XIC</acronym> value is optional, a client should call
7768
<function>XGetIMValues</function>
7770
<symbol>XNQueryICValuesList</symbol>
7771
before using this argument.
7777
<sect3 id="Hot_Keys_b">
7778
<title>Hot Keys</title>
7780
<!-- (SN Hot Keys -->
7785
<symbol>XNHotKey</symbol>
7786
argument specifies the hot key list to the <acronym>XIC</acronym>.
7787
The hot key list is a pointer to the structure of type
7788
<structname>XIMHotKeyTriggers</structname>,
7789
which specifies the key events that must be received
7790
without any interruption of the input method.
7791
For the hot key list set with this argument to be utilized, the client
7793
<symbol>XNHotKeyState</symbol>
7795
<symbol>XIMHotKeyStateON</symbol>.
7799
Because this <acronym>XIC</acronym> value is optional, a client should call
7800
<function>XGetIMValues</function>
7802
<symbol>XNQueryICValuesList</symbol>
7803
before using this functionality.
7807
The value of the argument is a pointer to a structure of type
7808
<structname>XIMHotKeyTriggers</structname>.
7812
If an event for a key in the hot key list is found, then the process will
7813
receive the event and it will be processed inside the client.
7818
<literallayout class="monospaced">
7819
<!-- .TA .5i 2.5i -->
7820
<!-- .ta .5i 2.5i -->
7823
unsigned int modifier;
7824
unsigned int modifier_mask;
7829
XIMHotKeyTrigger *key;
7830
} XIMHotKeyTriggers;
7839
The combination of modifier and modifier_mask are used to represent one of
7840
three states for each modifier:
7841
either the modifier must be on, or the modifier must be off, or the modifier
7842
is a ``don't care'' - it may be on or off.
7843
When a modifier_mask bit is set to 0, the state of the associated modifier
7844
is ignored when evaluating whether the key is hot or not.
7848
<tgroup cols='3' align='center'>
7849
<colspec colname='c1'/>
7850
<colspec colname='c2'/>
7851
<colspec colname='c3'/>
7854
<entry>Modifier Bit</entry>
7855
<entry>Mask Bit</entry>
7856
<entry>Meaning</entry>
7863
<entry>The modifier must be off.</entry>
7868
<entry>The modifier must be on.</entry>
7873
<entry>Do not care if the modifier is on or off.</entry>
7880
<sect3 id="Hot_Key_State">
7881
<title>Hot Key State</title>
7883
<!-- (SN Hot Key State -->
7888
<symbol>XNHotKeyState</symbol>
7889
argument specifies the hot key state of the input method.
7890
This is usually used to switch the input method between hot key
7891
operation and normal input processing.
7895
The value of the argument is a pointer to a structure of type
7898
<literallayout class="monospaced">
7899
typedef unsigned long XIMHotKeyState;
7901
#define XIMHotKeyStateON (0x0001L)
7902
#define XIMHotKeyStateOFF (0x0002L)
7912
If not specified, the default is
7913
<symbol>XIMHotKeyStateOFF</symbol>.
7919
<sect3 id="Preedit_and_Status_Attributes">
7920
<title>Preedit and Status Attributes</title>
7922
<!-- (SN Preedit and Status Attributes -->
7926
<indexterm significance="preferred"><primary>XNPreeditAttributes</primary></indexterm>
7927
<indexterm significance="preferred"><primary>XNStatusAttributes</primary></indexterm>
7929
<symbol>XNPreeditAttributes</symbol>
7931
<symbol>XNStatusAttributes</symbol>
7932
arguments specify to an input method the attributes to be used for the
7933
preedit and status areas,
7935
Those attributes are passed to
7936
<function>XSetICValues</function>
7938
<function>XGetICValues</function>
7939
as a nested variable-length list.
7940
The names to be used in these lists are described in the following sections.
7949
<indexterm significance="preferred"><primary>XNArea</primary></indexterm>
7951
<symbol>XNArea</symbol>
7952
argument must be a pointer to a structure of type
7953
<structname>XRectangle</structname>.
7954
The interpretation of the
7955
<symbol>XNArea</symbol>
7956
argument is dependent on the input method style that has been set.
7960
If the input method style is
7961
<symbol>XIMPreeditPosition</symbol>,
7962
<symbol>XNArea</symbol>
7963
specifies the clipping region within which preediting will take place.
7964
If the focus window has been set,
7965
the coordinates are assumed to be relative to the focus window.
7966
Otherwise, the coordinates are assumed to be relative to the client window.
7967
If neither has been set,
7968
the results are undefined.
7973
<symbol>XNArea</symbol>
7974
is not specified, is set to NULL, or is invalid,
7975
the input method will default the clipping region
7976
to the geometry of the
7977
<symbol>XNFocusWindow</symbol>.
7978
If the area specified is NULL or invalid,
7979
the results are undefined.
7983
If the input style is
7984
<symbol>XIMPreeditArea</symbol>
7986
<symbol>XIMStatusArea</symbol>,
7987
<symbol>XNArea</symbol>
7988
specifies the geometry provided by the client to the input method.
7989
The input method may use this area to display its data,
7990
either preedit or status depending on the area designated.
7991
The input method may create a window as a child of the client window
7992
with dimensions that fit the
7993
<symbol>XNArea</symbol>.
7994
The coordinates are relative to the client window.
7995
If the client window has not been set yet,
7996
the input method should save these values
7997
and apply them when the client window is set.
7999
<symbol>XNArea</symbol>
8000
is not specified, is set to NULL, or is invalid,
8001
the results are undefined.
8004
<sect4 id="Area_Needed">
8005
<title>Area Needed</title>
8007
<!-- (SN Area Needed -->
8011
<indexterm significance="preferred"><primary>XNAreaNeeded</primary></indexterm>
8013
<symbol>XNAreaNeeded</symbol>
8014
argument specifies the geometry suggested by the client for this area
8015
(preedit or status).
8016
The value associated with the argument must be a pointer to a
8018
<structname>XRectangle</structname>.
8019
Note that the x, y values are not used
8020
and that nonzero values for width or height are the constraints
8021
that the client wishes the input method to respect.
8026
<symbol>XNAreaNeeded</symbol>
8027
argument specifies the preferred geometry desired by the input method
8032
This argument is only valid if the input style is
8033
<symbol>XIMPreeditArea</symbol>
8035
<symbol>XIMStatusArea</symbol>.
8036
It is used for geometry negotiation between the client and the input method
8037
and has no other effect on the input method
8038
(see section 13.5.1.5).
8041
<sect4 id="Spot_Location">
8042
<title>Spot Location</title>
8044
<!-- (SN Spot Location -->
8048
<indexterm significance="preferred"><primary>XNSpotLocation</primary></indexterm>
8050
<symbol>XNSpotLocation</symbol>
8051
argument specifies to the input method the coordinates of the spot
8052
to be used by an input method executing with
8053
<symbol>XNInputStyle</symbol>
8055
<symbol>XIMPreeditPosition</symbol>.
8056
When specified to any input method other than
8057
<symbol>XIMPreeditPosition</symbol>,
8058
this <acronym>XIC</acronym> value is ignored.
8062
The x coordinate specifies the position where the next character
8064
The y coordinate is the position of the baseline used
8065
by the current text line in the focus window.
8066
The x and y coordinates are relative to the focus window, if it has been set;
8067
otherwise, they are relative to the client window.
8068
If neither the focus window nor the client window has been set,
8069
the results are undefined.
8073
The value of the argument is a pointer to a structure of type
8074
<structname>XPoint</structname>.
8077
<sect4 id="Colormap">
8078
<title>Colormap</title>
8080
<!-- (SN Colormap -->
8084
Two different arguments can be used to indicate what colormap the input method
8085
should use to allocate colors, a colormap ID, or a standard colormap name.
8089
<indexterm significance="preferred"><primary>XNColormap</primary></indexterm>
8091
<symbol>XNColormap</symbol>
8092
argument is used to specify a colormap ID.
8093
The argument value is of type
8094
<type>Colormap</type>.
8095
An invalid argument may generate a
8096
<errorname>BadColor</errorname>
8097
error when it is used by the input method.
8101
<indexterm significance="preferred"><primary>XNStdColormap</primary></indexterm>
8103
<symbol>XNStdColormap</symbol>
8104
argument is used to indicate the name of the standard colormap
8105
in which the input method should allocate colors.
8106
The argument value is an
8108
that should be a valid atom for calling
8109
<function>XGetRGBColormaps</function>.
8110
An invalid argument may generate a
8111
<errorname>BadAtom</errorname>
8112
error when it is used by the input method.
8116
If the colormap is left unspecified,
8117
the client window colormap becomes the default.
8120
<sect4 id="Foreground_and_Background">
8121
<title>Foreground and Background</title>
8123
<!-- (SN Foreground and Background -->
8127
<indexterm significance="preferred"><primary>XNForeground</primary></indexterm>
8128
<indexterm significance="preferred"><primary>XNBackground</primary></indexterm>
8130
<symbol>XNForeground</symbol>
8132
<symbol>XNBackground</symbol>
8133
arguments specify the foreground and background pixel, respectively.
8134
The argument value is of type
8135
<type>unsigned</type>
8137
It must be a valid pixel in the input method colormap.
8141
If these values are left unspecified,
8142
the default is determined by the input method.
8145
<sect4 id="Background_Pixmap">
8146
<title>Background Pixmap</title>
8148
<!-- (SN Background Pixmap -->
8153
<symbol>XNBackgroundPixmap</symbol>
8154
argument specifies a background pixmap to be used as the background of the
8156
The value must be of type
8157
<type>Pixmap</type>.
8158
An invalid argument may generate a
8159
<errorname>BadPixmap</errorname>
8160
error when it is used by the input method.
8164
If this value is left unspecified,
8165
the default is determined by the input method.
8168
<sect4 id="Font_Set">
8169
<title>Font Set</title>
8171
<!-- (SN Font Set -->
8175
<indexterm significance="preferred"><primary>XNFontSet</primary></indexterm>
8177
<symbol>XNFontSet</symbol>
8178
argument specifies to the input method what font set is to be used.
8179
The argument value is of type
8180
<type>XFontSet</type>.
8184
If this value is left unspecified,
8185
the default is determined by the input method.
8188
<sect4 id="Line_Spacing">
8189
<title>Line Spacing</title>
8191
<!-- (SN Line Spacing -->
8196
<symbol>XNLineSpace</symbol>
8197
argument specifies to the input method what line spacing is to be used
8198
in the preedit window if more than one line is to be used.
8199
This argument is of type
8204
If this value is left unspecified,
8205
the default is determined by the input method.
8209
<title>Cursor</title>
8215
<indexterm significance="preferred"><primary>XNCursor</primary></indexterm>
8217
<symbol>XNCursor</symbol>
8218
argument specifies to the input method what cursor is to be used
8219
in the specified window.
8220
This argument is of type
8221
<type>Cursor</type>.
8225
An invalid argument may generate a
8226
<errorname>BadCursor</errorname>
8227
error when it is used by the input method.
8228
If this value is left unspecified,
8229
the default is determined by the input method.
8232
<sect4 id="Preedit_State">
8233
<title>Preedit State</title>
8235
<!-- (SN Preedit State -->
8240
<symbol>XNPreeditState</symbol>
8241
argument specifies the state of input preediting for the input method.
8242
Input preediting can be on or off.
8246
The valid mask names for
8247
<symbol>XNPreeditState</symbol>
8252
<indexterm significance="preferred"><primary>XIMPreeditUnknown</primary></indexterm>
8253
<indexterm significance="preferred"><primary>XIMPreeditEnable</primary></indexterm>
8254
<indexterm significance="preferred"><primary>XIMPreeditDisable</primary></indexterm>
8258
<literallayout class="monospaced">
8259
typedef unsigned long XIMPreeditState;
8261
#define XIMPreeditUnknown 0L
8262
#define XIMPreeditEnable 1L
8263
#define XIMPreeditDisable (1L<<1)
8271
<symbol>XIMPreeditEnable</symbol>
8272
is set, then input preediting is turned on by the input method.
8277
<symbol>XIMPreeditDisable</symbol>
8278
is set, then input preediting is turned off by the input method.
8283
<symbol>XNPreeditState</symbol>
8284
is left unspecified, then the state will be implementation-dependent.
8289
<symbol>XNResetState</symbol>
8291
<symbol>XIMInitialState</symbol>,
8293
<symbol>XNPreeditState</symbol>
8294
value specified at the creation time will be reflected as the initial state for
8295
<function>XmbResetIC</function>
8297
<function>XwcResetIC</function>.
8301
Because this <acronym>XIC</acronym> value is optional, a client should call
8302
<function>XGetIMValues</function>
8304
<symbol>XNQueryICValuesList</symbol>
8305
before using this argument.
8308
<sect4 id="Preedit_State_Notify_Callback">
8309
<title>Preedit State Notify Callback</title>
8311
<!-- (SN Preedit State Notify Callback -->
8315
The preedit state notify callback is triggered by the input method
8316
when the preediting state has changed.
8318
<symbol>XNPreeditStateNotifyCallback</symbol>
8319
argument is a pointer to a structure of type
8320
<structname>XIMCallback</structname>.
8321
The generic prototype is as follows:
8322
<indexterm significance="preferred"><primary>PreeditStateNotifyCallback</primary></indexterm>
8326
<funcdef>void <function><replaceable>PreeditStateNotifyCallback</replaceable></function></funcdef>
8327
<paramdef>XIC<parameter> ic</parameter></paramdef>
8328
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
8329
<paramdef>XIMPreeditStateNotifyCallbackStruct<parameter> *call_data</parameter></paramdef>
8336
<emphasis remap='I'>ic</emphasis>
8340
Specifies the input context.
8346
<emphasis remap='I'>client_data</emphasis>
8350
Specifies the additional client data.
8356
<emphasis remap='I'>call_data</emphasis>
8360
Specifies the current preedit state.
8370
<structname>XIMPreeditStateNotifyCallbackStruct</structname>
8371
structure is defined as follows:
8375
<indexterm significance="preferred"><primary>XIMPreeditStateNotifyCallbackStruct</primary></indexterm>
8377
<literallayout class="monospaced">
8378
<!-- .TA .5i 2.5i -->
8379
<!-- .ta .5i 2.5i -->
8380
typedef struct _XIMPreeditStateNotifyCallbackStruct {
8381
XIMPreeditState state;
8382
} XIMPreeditStateNotifyCallbackStruct;
8391
Because this <acronym>XIC</acronym> value is optional, a client should call
8392
<function>XGetIMValues</function>
8394
<symbol>XNQueryICValuesList</symbol>
8395
before using this argument.
8398
<sect4 id="Preedit_and_Status_Callbacks">
8399
<title>Preedit and Status Callbacks</title>
8401
<!-- (SN Preedit and Status Callbacks -->
8405
A client that wants to support the input style
8406
<symbol>XIMPreeditCallbacks</symbol>
8407
must provide a set of preedit callbacks to the input method.
8408
The set of preedit callbacks is as follows:
8410
<indexterm significance="preferred"><primary>XNPreeditStartCallback</primary></indexterm>
8411
<indexterm significance="preferred"><primary>XNPreeditDoneCallback</primary></indexterm>
8412
<indexterm significance="preferred"><primary>XNPreeditDrawCallback</primary></indexterm>
8413
<indexterm significance="preferred"><primary>XNPreeditCaretCallback</primary></indexterm>
8415
<tgroup cols='2' align='center'>
8416
<colspec colname='c1'/>
8417
<colspec colname='c2'/>
8420
<entry><symbol>XNPreeditStartCallback</symbol></entry>
8421
<entry>This is called when the input method starts preedit.</entry>
8424
<entry><symbol>XNPreeditDoneCallback</symbol></entry>
8425
<entry>This is called when the input method stops preedit.</entry>
8428
<entry><symbol>XNPreeditDrawCallback</symbol></entry>
8429
<entry>This is called when a number of preedit keystrokes should be echoed.</entry>
8432
<entry><symbol>XNPreeditCaretCallback</symbol></entry>
8433
<entry>This is called to move the text insertion point within the preedit string.</entry>
8441
A client that wants to support the input style
8442
<symbol>XIMStatusCallbacks</symbol>
8443
must provide a set of status callbacks to the input method.
8444
The set of status callbacks is as follows:
8447
<indexterm significance="preferred"><primary>XNStatusStartCallback</primary></indexterm>
8448
<indexterm significance="preferred"><primary>XNStatusDoneCallback</primary></indexterm>
8449
<indexterm significance="preferred"><primary>XNStatusDrawCallback</primary></indexterm>
8451
<tgroup cols='2' align='center'>
8452
<colspec colname='c1'/>
8453
<colspec colname='c2'/>
8456
<entry><symbol>XNStatusStartCallback</symbol></entry>
8457
<entry>This is called when the input method initializes the status area.</entry>
8460
<entry><symbol>XNStatusDoneCallback</symbol></entry>
8461
<entry>This is called when the input method no longer needs the status area.</entry>
8464
<entry><symbol>XNStatusDrawCallback</symbol></entry>
8465
<entry>This is called when updating of the status area is required.</entry>
8472
The value of any status or preedit argument is a pointer
8473
to a structure of type
8474
<structname>XIMCallback</structname>.
8475
<indexterm significance="preferred"><primary>XIMProc</primary></indexterm>
8476
<indexterm significance="preferred"><primary>XIMCallback</primary></indexterm>
8481
<literallayout class="monospaced">
8482
<!-- .TA .5i 2.5i -->
8483
<!-- .ta .5i 2.5i -->
8484
typedef void (*XIMProc)();
8487
XPointer client_data;
8495
Each callback has some particular semantics and will carry the data
8496
that expresses the environment necessary to the client
8497
into a specific data structure.
8498
This paragraph only describes the arguments to be used to set
8503
Setting any of these values while doing preedit
8504
may cause unexpected results.
8509
<sect2 id="Input_Method_Callback_Semantics">
8510
<title>Input Method Callback Semantics</title>
8512
<!-- (SN Input Method Callback Semantics -->
8516
<acronym>XIM</acronym> callbacks are procedures defined by clients or text drawing packages
8517
that are to be called from the input method when selected events occur.
8518
Most clients will use a text editing package or a toolkit
8519
and, hence, will not need to define such callbacks.
8520
This section defines the callback semantics, when they are triggered,
8521
and what their arguments are.
8522
This information is mostly useful for X toolkit implementors.
8526
Callbacks are mostly provided so that clients (or text editing
8527
packages) can implement on-the-spot preediting in their own window.
8529
the input method needs to communicate and synchronize with the client.
8530
The input method needs to communicate changes in the preedit window
8531
when it is under control of the client.
8532
Those callbacks allow the client to initialize the preedit area,
8533
display a new preedit string,
8534
move the text insertion point during preedit,
8535
terminate preedit, or update the status area.
8539
All callback procedures follow the generic prototype:
8540
<indexterm significance="preferred"><primary>CallbackPrototype</primary></indexterm>
8544
<funcdef>void <function><replaceable>CallbackPrototype</replaceable></function></funcdef>
8545
<paramdef>XIC<parameter> ic</parameter></paramdef>
8546
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
8547
<paramdef>SomeType<parameter> call_data</parameter></paramdef>
8554
<emphasis remap='I'>ic</emphasis>
8558
Specifies the input context.
8564
<emphasis remap='I'>client_data</emphasis>
8568
Specifies the additional client data.
8574
<emphasis remap='I'>call_data</emphasis>
8578
Specifies data specific to the callback.
8587
The call_data argument is a structure that expresses the arguments needed
8588
to achieve the semantics;
8590
it is a specific data structure appropriate to the callback.
8591
In cases where no data is needed in the callback,
8592
this call_data argument is NULL.
8593
The client_data argument is a closure that has been initially specified
8594
by the client when specifying the callback and passed back.
8595
It may serve, for example, to inherit application context in the callback.
8599
The following paragraphs describe the programming semantics
8600
and specific data structure associated with the different reasons.
8602
<sect3 id="Geometry_Callback_b">
8603
<title>Geometry Callback</title>
8605
<!-- (SN Geometry Callback -->
8609
The geometry callback is triggered by the input method
8610
to indicate that it wants the client to negotiate geometry.
8611
The generic prototype is as follows:
8612
<indexterm significance="preferred"><primary>GeometryCallback</primary></indexterm>
8616
<funcdef>void <function><replaceable>GeometryCallback</replaceable></function></funcdef>
8617
<paramdef>XIC<parameter> ic</parameter></paramdef>
8618
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
8619
<paramdef>XPointer<parameter> call_data</parameter></paramdef>
8626
<emphasis remap='I'>ic</emphasis>
8630
Specifies the input context.
8636
<emphasis remap='I'>client_data</emphasis>
8640
Specifies the additional client data.
8646
<emphasis remap='I'>call_data</emphasis>
8650
Not used for this callback and always passed as NULL.
8659
The callback is called with a NULL call_data argument.
8662
<sect3 id="Destroy_Callback_c">
8663
<title>Destroy Callback</title>
8665
<!-- (SN Destroy Callback -->
8669
The destroy callback is triggered by the input method
8670
when it stops service for any reason.
8671
After the callback is invoked, the input context will be freed by Xlib.
8672
The generic prototype is as follows:
8673
<indexterm significance="preferred"><primary>DestroyCallback</primary></indexterm>
8677
<funcdef>void <function><replaceable>DestroyCallback</replaceable></function></funcdef>
8678
<paramdef>XIC<parameter> ic</parameter></paramdef>
8679
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
8680
<paramdef>XPointer<parameter> call_data</parameter></paramdef>
8687
<emphasis remap='I'>ic</emphasis>
8691
Specifies the input context.
8697
<emphasis remap='I'>client_data</emphasis>
8701
Specifies the additional client data.
8707
<emphasis remap='I'>call_data</emphasis>
8711
Not used for this callback and always passed as NULL.
8720
The callback is called with a NULL call_data argument.
8723
<sect3 id="String_Conversion_Callback_b">
8724
<title>String Conversion Callback</title>
8726
<!-- (SN String Conversion Callback -->
8730
The string conversion callback is triggered by the input method
8731
to request the client to return the string to be converted. The
8732
returned string may be either a multibyte or wide character string,
8733
with an encoding matching the locale bound to the input context.
8734
The callback prototype is as follows:
8735
<indexterm significance="preferred"><primary>StringConversionCallback</primary></indexterm>
8739
<funcdef>void <function><replaceable>StringConversionCallback</replaceable></function></funcdef>
8740
<paramdef>XIC<parameter> ic</parameter></paramdef>
8741
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
8742
<paramdef>XIMStringConversionCallbackStruct<parameter> *call_data</parameter></paramdef>
8749
<emphasis remap='I'>ic</emphasis>
8753
Specifies the input method.
8759
<emphasis remap='I'>client_data</emphasis>
8763
Specifies the additional client data.
8769
<emphasis remap='I'>call_data</emphasis>
8773
Specifies the amount of the string to be converted.
8782
The callback is passed an
8783
<structname>XIMStringConversionCallbackStruct</structname>
8784
structure in the call_data argument.
8785
The text member is an
8786
<structname>XIMStringConversionText</structname>
8787
structure (see section 13.5.6.9) to be filled in by the client
8788
and describes the text to be sent to the input method.
8789
The data pointed to by the
8790
string and feedback elements of the
8791
<structname>XIMStringConversionText</structname>
8792
structure will be freed using
8793
<function>XFree</function>
8795
after the callback returns. So the client should not point to
8796
internal buffers that are critical to the client.
8797
Similarly, because the feedback element is currently reserved for future
8798
use, the client should set feedback to NULL to prevent the library from
8799
freeing memory at some random location due to an uninitialized pointer.
8804
<structname>XIMStringConversionCallbackStruct</structname>
8805
structure is defined as follows:
8809
<indexterm significance="preferred"><primary>XIMStringConversionCallbackStruct</primary></indexterm>
8813
<literallayout class="monospaced">
8814
typedef struct _XIMStringConversionCallbackStruct {
8815
XIMStringConversionPosition position;
8816
XIMCaretDirection direction;
8818
XIMStringConversionOperation operation;
8819
XIMStringConversionText *text;
8820
} XIMStringConversionCallbackStruct;
8822
typedef short XIMStringConversionPosition;
8824
typedef unsigned short XIMStringConversionOperation;
8826
#define XIMStringConversionSubstitution (0x0001)
8827
#define XIMStringConversionRetrieval (0x0001)
8834
<type>XIMStringConversionPosition</type>
8835
specifies the starting position of the string to be returned
8837
<structname>XIMStringConversionText</structname>
8838
structure. The value identifies a position, in units of characters,
8839
relative to the client's cursor position in the client's buffer.
8843
The ending position of the text buffer is determined by
8844
the direction and factor members. Specifically, it is the character position
8845
relative to the starting point as defined by the
8846
<structname>XIMCaretDirection</structname>.
8847
The factor member of
8848
<structname>XIMStringConversionCallbackStruct</structname>
8849
specifies the number of
8850
<structname>XIMCaretDirection</structname>
8851
positions to be applied. For example, if the direction specifies
8852
<constant>XIMLineEnd</constant>
8853
and factor is 1, then all characters from the starting position to
8854
the end of the current display line are returned. If the direction
8856
<constant>XIMForwardChar</constant>
8858
<constant>XIMBackwardChar</constant>,
8859
then the factor specifies a relative position, indicated in characters,
8860
from the starting position.
8864
<type>XIMStringConversionOperation</type>
8865
specifies whether the string to be converted should be
8866
deleted (substitution) or copied (retrieval) from the client's
8868
<type>XIMStringConversionOperation</type>
8870
<symbol>XIMStringConversionSubstitution</symbol>,
8871
the client must delete the string to be converted from its own buffer.
8873
<type>XIMStringConversionOperation</type>
8875
<symbol>XIMStringConversionRetrieval</symbol>,
8876
the client must not delete the string to be converted from its buffer.
8877
The substitute operation is typically used for reconversion and
8878
transliteration conversion,
8879
while the retrieval operation is typically used for context-sensitive
8883
<sect3 id="Preedit_State_Callbacks">
8884
<title>Preedit State Callbacks</title>
8886
<!-- (SN Preedit State Callbacks -->
8890
When the input method turns preediting on or off, a
8891
<function><replaceable>PreeditStartCallback</replaceable></function>
8893
<function><replaceable>PreeditDoneCallback</replaceable></function>
8894
callback is triggered to let the toolkit do the setup
8895
or the cleanup for the preedit region.
8896
<indexterm significance="preferred"><primary>PreeditStartCallback</primary></indexterm>
8900
<funcdef>int <function><replaceable>PreeditStartCallback</replaceable></function></funcdef>
8901
<paramdef>XIC<parameter> ic</parameter></paramdef>
8902
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
8903
<paramdef>XPointer<parameter> call_data</parameter></paramdef>
8910
<emphasis remap='I'>ic</emphasis>
8914
Specifies the input context.
8920
<emphasis remap='I'>client_data</emphasis>
8924
Specifies the additional client data.
8930
<emphasis remap='I'>call_data</emphasis>
8934
Not used for this callback and always passed as NULL.
8943
When preedit starts on the specified input context,
8944
the callback is called with a NULL call_data argument.
8945
<function><replaceable>PreeditStartCallback</replaceable></function>
8946
will return the maximum size of the preedit string.
8947
A positive number indicates the maximum number of bytes allowed
8948
in the preedit string,
8949
and a value of -1 indicates there is no limit.
8950
<indexterm significance="preferred"><primary>PreeditDoneCallback</primary></indexterm>
8954
<funcdef>void <function><replaceable>PreeditDoneCallback</replaceable></function></funcdef>
8955
<paramdef>XIC<parameter> ic</parameter></paramdef>
8956
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
8957
<paramdef>XPointer<parameter> call_data</parameter></paramdef>
8964
<emphasis remap='I'>ic</emphasis>
8968
Specifies the input context.
8974
<emphasis remap='I'>client_data</emphasis>
8978
Specifies the additional client data.
8984
<emphasis remap='I'>call_data</emphasis>
8988
Not used for this callback and always passed as NULL.
8997
When preedit stops on the specified input context,
8998
the callback is called with a NULL call_data argument.
8999
The client can release the data allocated by
9000
<function><replaceable>PreeditStartCallback</replaceable></function>.
9004
<function><replaceable>PreeditStartCallback</replaceable></function>
9005
should initialize appropriate data needed for
9006
displaying preedit information and for handling further
9007
<function><replaceable>PreeditDrawCallback</replaceable></function>
9010
<function><replaceable>PreeditStartCallback</replaceable></function>
9011
is called, it will not be called again before
9012
<function><replaceable>PreeditDoneCallback</replaceable></function>
9016
<sect3 id="Preedit_Draw_Callback">
9017
<title>Preedit Draw Callback</title>
9019
<!-- (SN Preedit Draw Callback -->
9023
This callback is triggered to draw and insert, delete or replace,
9024
preedit text in the preedit region.
9025
The preedit text may include unconverted input text such as Japanese Kana,
9026
converted text such as Japanese Kanji characters, or characters of both kinds.
9027
That string is either a multibyte or wide character string,
9028
whose encoding matches the locale bound to the input context.
9029
The callback prototype
9031
<indexterm significance="preferred"><primary>PreeditDrawCallback</primary></indexterm>
9035
<funcdef>void <function><replaceable>PreeditDrawCallback</replaceable></function></funcdef>
9036
<paramdef>XIC<parameter> ic</parameter></paramdef>
9037
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
9038
<paramdef>XIMPreeditDrawCallbackStruct<parameter> *call_data</parameter></paramdef>
9045
<emphasis remap='I'>ic</emphasis>
9049
Specifies the input context.
9055
<emphasis remap='I'>client_data</emphasis>
9059
Specifies the additional client data.
9065
<emphasis remap='I'>call_data</emphasis>
9069
Specifies the preedit drawing information.
9078
The callback is passed an
9079
<structname>XIMPreeditDrawCallbackStruct</structname>
9080
structure in the call_data argument.
9081
The text member of this structure contains the text to be drawn.
9082
After the string has been drawn,
9083
the caret should be moved to the specified location.
9088
<structname>XIMPreeditDrawCallbackStruct</structname>
9089
structure is defined as follows:
9093
<indexterm significance="preferred"><primary>XIMPreeditDrawCallbackStruct</primary></indexterm>
9095
<literallayout class="monospaced">
9096
<!-- .TA .5i 2.5i -->
9097
<!-- .ta .5i 2.5i -->
9098
typedef struct _XIMPreeditDrawCallbackStruct {
9099
int caret; /* Cursor offset within preedit string */
9100
int chg_first; /* Starting change position */
9101
int chg_length; /* Length of the change in character count */
9103
} XIMPreeditDrawCallbackStruct;
9109
The client must keep updating a buffer of the preedit text
9110
and the callback arguments referring to indexes in that buffer.
9111
The call_data fields have specific meanings according to the operation,
9117
To indicate text deletion,
9118
the call_data member specifies a NULL text field.
9119
The text to be deleted is then the current text in the buffer
9120
from position chg_first (starting at zero) on a character length
9126
When text is non-NULL,
9127
it indicates insertion or replacement of text in the buffer.
9132
The chg_length member
9133
identifies the number of characters in the current preedit buffer
9134
that are affected by this call.
9135
A positive chg_length indicates that chg_length number of characters, starting
9136
at chg_first, must be deleted or must be replaced by text, whose length is
9138
<structname>XIMText</structname>
9144
A chg_length value of zero indicates that text must be inserted
9145
right at the position specified by chg_first.
9146
A value of zero for chg_first specifies the first character in the buffer.
9151
chg_length and chg_first combine to identify the modification required to
9152
the preedit buffer; beginning at chg_first, replace chg_length number of
9153
characters with the text in the supplied
9154
<structname>XIMText</structname>
9155
structure. For example, suppose the preedit buffer contains the string "ABCDE".
9160
<literallayout class="monospaced">
9164
CharPos: 0 1 2 3 4 5
9168
The CharPos in the diagram shows the location of the character position
9169
relative to the character.
9174
If the value of chg_first is 1 and the value of chg_length is 3, this
9175
says to replace 3 characters beginning at character position 1 with the
9177
<structname>XIMText</structname>
9179
Hence, <acronym>BCD</acronym> would be replaced by the value in the structure.
9184
Though chg_length and chg_first are both signed integers they will
9185
never have a negative value.
9191
identifies the character position before which the cursor should
9192
be placed - after modification to the preedit buffer has been completed.
9193
For example, if caret is zero, the cursor is at
9194
the beginning of the buffer. If the caret is one, the cursor is between
9195
the first and second character.
9201
<indexterm significance="preferred"><primary>XIMText</primary></indexterm>
9203
<literallayout class="monospaced">
9204
<!-- .TA .5i 1.5i 3i -->
9205
typedef struct _XIMText {
9206
unsigned short length;
9207
XIMFeedback * feedback;
9208
Bool encoding_is_wchar;
9211
wchar_t * wide_char;
9219
The text string passed is actually a structure specifying as follows:
9224
The length member is the text length in characters.
9229
The encoding_is_wchar member is a value that indicates
9230
if the text string is encoded in wide character or multibyte format.
9231
The text string may be passed either as multibyte or as wide character;
9232
the input method controls in which form data is passed.
9234
callback routine must be able to handle data passed in either form.
9239
The string member is the text string.
9244
The feedback member indicates rendering type for each character in the
9246
If string is NULL (indicating that only highlighting of the existing
9247
preedit buffer should be updated), feedback points to length highlight
9248
elements that should be applied to the existing preedit buffer, beginning
9255
The feedback member expresses the types of rendering feedback
9256
the callback should apply when drawing text.
9257
Rendering of the text to be drawn is specified either in generic ways
9258
(for example, primary, secondary) or in specific ways (reverse, underline).
9259
When generic indications are given,
9260
the client is free to choose the rendering style.
9261
It is necessary, however, that primary and secondary be mapped
9262
to two distinct rendering styles.
9266
If an input method wants to control display of the preedit string, an
9267
input method can indicate the visibility hints using feedbacks in
9270
<symbol>XIMVisibleToForward</symbol>,
9271
<symbol>XIMVisibleToBackword</symbol>,
9273
<symbol>XIMVisibleToCenter</symbol>
9274
masks are exclusively used for these visibility hints.
9276
<symbol>XIMVisibleToForward</symbol>
9278
indicates that the preedit text is preferably displayed in the
9279
primary draw direction from the
9280
caret position in the preedit area forward.
9282
<symbol>XIMVisibleToBackword</symbol>
9284
indicates that the preedit text is preferably displayed from
9285
the caret position in the preedit area backward, relative to the primary
9288
<symbol>XIMVisibleToCenter</symbol>
9290
indicates that the preedit text is preferably displayed with
9291
the caret position in the preedit area centered.
9295
The insertion point of the preedit string could exist outside of
9296
the visible area when visibility hints are used.
9299
is valid for the entire preedit string, and only one character
9300
can hold one of these feedbacks for a given input context at one time.
9301
This feedback may be OR'ed together with another highlight (such as
9302
<symbol>XIMReverse</symbol>).
9303
Only the most recently set feedback is valid, and any previous
9304
feedback is automatically canceled. This is a hint to the client, and
9305
the client is free to choose how to display the preedit string.
9309
The feedback member also specifies how rendering of the text argument
9310
should be performed.
9311
If the feedback is NULL,
9312
the callback should apply the same feedback as is used for the surrounding
9313
characters in the preedit buffer; if chg_first is at a highlight boundary,
9314
the client can choose which of the two highlights to use.
9315
If feedback is not NULL, feedback specifies an array defining the
9317
character of the string, and the length of the array is thus length.
9321
If an input method wants to indicate that it is only updating the feedback of
9322
the preedit text without changing the content of it,
9324
<structname>XIMText</structname>
9325
structure will contain a NULL value for the string field,
9326
the number of characters affected (relative to chg_first)
9327
will be in the length field,
9328
and the feedback field will point to an array of
9329
<type>XIMFeedback</type>.
9333
Each element in the feedback array is a bitmask represented by a value of type
9334
<type>XIMFeedback</type>.
9335
The valid mask names are as follows:
9339
<indexterm significance="preferred"><primary>XIMReverse</primary></indexterm>
9340
<indexterm significance="preferred"><primary>XIMUnderline</primary></indexterm>
9341
<indexterm significance="preferred"><primary>XIMHighlight</primary></indexterm>
9342
<indexterm significance="preferred"><primary>XIMPrimary</primary></indexterm>
9343
<indexterm significance="preferred"><primary>XIMSecondary</primary></indexterm>
9344
<indexterm significance="preferred"><primary>XIMTertiary</primary></indexterm>
9345
<indexterm significance="preferred"><primary>XIMVisibleToForward</primary></indexterm>
9346
<indexterm significance="preferred"><primary>XIMVisibleToBackward</primary></indexterm>
9347
<indexterm significance="preferred"><primary>XIMVisibleToCenter</primary></indexterm>
9350
<literallayout class="monospaced">
9351
typedef unsigned long XIMFeedback;
9353
#define XIMReverse 1L
9354
#define XIMUnderline (1L<<1)
9355
#define XIMHighlight (1L<<2)
9356
#define XIMPrimary (1L<<5)*
9357
#define XIMSecondary (1L<<6)*
9358
#define XIMTertiary (1L<<7)*
9359
#define XIMVisibleToForward (1L<<8)
9360
#define XIMVisibleToBackward (1L<<9)
9361
#define XIMVisibleToCenter (1L<<10)
9363
*† The values for XIMPrimary, XIMSecondary, and XIMTertiary were incorrectly defined in
9364
the R5 specification. The X Consortium’s X11R5 implementation correctly implemented the val-
9365
ues for these highlights. The value of these highlights has been corrected in this specification to
9366
agree with the values in the Consortium’s X11R5 and X11R6 implementations.
9372
Characters drawn with the
9373
<symbol>XIMReverse</symbol>
9374
highlight should be drawn by swapping the foreground and background colors
9375
used to draw normal, unhighlighted characters.
9376
Characters drawn with the
9377
<symbol>XIMUnderline</symbol>
9378
highlight should be underlined.
9379
Characters drawn with the
9380
<symbol>XIMHighlight</symbol>,
9381
<symbol>XIMPrimary</symbol>,
9382
<symbol>XIMSecondary</symbol>,
9384
<symbol>XIMTertiary</symbol>
9385
highlights should be drawn in some unique manner that must be different
9387
<symbol>XIMReverse</symbol>
9389
<symbol>XIMUnderline</symbol>.
9392
<symbol>XIMPrimary</symbol>,
9393
<symbol>XIMSecondary</symbol>,
9395
<symbol>XIMTertiary</symbol>
9396
were incorrectly defined in the R5 specification.
9397
The X Consortium's X11R5
9398
implementation correctly implemented the values for these highlights.
9399
The value of these highlights has been corrected in this specification
9400
to agree with the values in the Consortium's X11R5 and X11R6 implementations.
9404
<sect3 id="Preedit_Caret_Callback">
9405
<title>Preedit Caret Callback</title>
9407
<!-- (SN Preedit Caret Callback -->
9411
An input method may have its own navigation keys to allow the user
9412
to move the text insertion point in the preedit area
9413
(for example, to move backward or forward).
9414
Consequently, input method needs to indicate to the client that it
9415
should move the text insertion point.
9416
It then calls the PreeditCaretCallback.
9417
<indexterm significance="preferred"><primary>PreeditCaretCallback</primary></indexterm>
9421
<funcdef>void <function><replaceable>PreeditCaretCallback</replaceable></function></funcdef>
9422
<paramdef>XIC<parameter> ic</parameter></paramdef>
9423
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
9424
<paramdef>XIMPreeditCaretCallbackStruct<parameter> *call_data</parameter></paramdef>
9431
<emphasis remap='I'>ic</emphasis>
9435
Specifies the input context.
9441
<emphasis remap='I'>client_data</emphasis>
9445
Specifies the additional client data.
9451
<emphasis remap='I'>call_data</emphasis>
9455
Specifies the preedit caret information.
9464
The input method will trigger PreeditCaretCallback
9465
to move the text insertion point during preedit.
9466
The call_data argument contains a pointer to an
9467
<structname>XIMPreeditCaretCallbackStruct</structname>
9469
which indicates where the caret should be moved.
9470
The callback must move the insertion point to its new location
9471
and return, in field position, the new offset value from the initial position.
9476
<structname>XIMPreeditCaretCallbackStruct</structname>
9477
structure is defined as follows:
9478
<indexterm significance="preferred"><primary>XIMPreeditCaretCallbackStruct</primary></indexterm>
9483
<literallayout class="monospaced">
9484
<!-- .TA .5i 2.5i -->
9485
<!-- .ta .5i 2.5i -->
9486
typedef struct _XIMPreeditCaretCallbackStruct {
9487
int position; /* Caret offset within preedit string */
9488
XIMCaretDirection direction; /* Caret moves direction */
9489
XIMCaretStyle style; /* Feedback of the caret */
9490
} XIMPreeditCaretCallbackStruct;
9497
<structname>XIMCaretStyle</structname>
9498
structure is defined as follows:
9502
<indexterm significance="preferred"><primary>XIMCaretStyle</primary></indexterm>
9504
<literallayout class="monospaced">
9505
<!-- .TA .5i 2.5i -->
9506
<!-- .ta .5i 2.5i -->
9508
XIMIsInvisible, /* Disable caret feedback */
9509
XIMIsPrimary, /* <acronym>UI</acronym> defined caret feedback */
9510
XIMIsSecondary, /* <acronym>UI</acronym> defined caret feedback */
9518
<structname>XIMCaretDirection</structname>
9519
structure is defined as follows:
9520
<indexterm significance="preferred"><primary>XIMCaretDirection</primary></indexterm>
9525
<literallayout class="monospaced">
9526
<!-- .TA .5i 2.5i -->
9527
<!-- .ta .5i 2.5i -->
9529
XIMForwardChar, XIMBackwardChar,
9530
XIMForwardWord, XIMBackwardWord,
9531
XIMCaretUp, XIMCaretDown,
9532
XIMNextLine, XIMPreviousLine,
9533
XIMLineStart, XIMLineEnd,
9534
XIMAbsolutePosition,
9536
} XIMCaretDirection;
9542
These values are defined as follows:
9544
<indexterm significance="preferred"><primary>XIMForwardChar</primary></indexterm>
9545
<indexterm significance="preferred"><primary>XIMBackwardChar</primary></indexterm>
9546
<indexterm significance="preferred"><primary>XIMForwardWord</primary></indexterm>
9547
<indexterm significance="preferred"><primary>XIMBackwardWord</primary></indexterm>
9548
<indexterm significance="preferred"><primary>XIMCaretUp</primary></indexterm>
9549
<indexterm significance="preferred"><primary>XIMCaretDown</primary></indexterm>
9551
<tgroup cols='2' align='center'>
9552
<colspec colname='c1'/>
9553
<colspec colname='c2'/>
9556
<entry><constant>XIMForwardChar</constant></entry>
9557
<entry>Move the caret forward one character position.</entry>
9560
<entry><constant>XIMBackwardChar</constant></entry>
9561
<entry>Move the caret backward one character position.</entry>
9564
<entry><constant>XIMForwardWord</constant></entry>
9565
<entry>Move the caret forward one word.</entry>
9568
<entry><constant>XIMBackwardWord</constant></entry>
9569
<entry>Move the caret backward one word.</entry>
9572
<entry><constant>XIMCaretUp</constant></entry>
9573
<entry>Move the caret up one line keeping the current horizontal offset.</entry>
9576
<entry><constant>XIMCaretDown</constant></entry>
9577
<entry>Move the caret down one line keeping the current horizontal offset.</entry>
9580
<entry><constant>XIMPreviousLine</constant></entry>
9581
<entry>Move the caret to the beginning of the previous line.</entry>
9584
<entry><constant>XIMNextLine</constant></entry>
9585
<entry>Move the caret to the beginning of the next line.</entry>
9588
<entry><constant>XIMLineStart</constant></entry>
9589
<entry>Move the caret to the beginning of the current display line that contains the caret.</entry>
9592
<entry><constant>XIMLineEnd</constant></entry>
9593
<entry>Move the caret to the end of the current display line that contains the caret.</entry>
9596
<entry><constant>XIMAbsolutePosition</constant></entry>
9597
<entry>The callback must move to the location specified by the position field
9598
of the callback data, indicated in characters, starting from the beginning
9599
of the preedit text.
9600
Hence, a value of zero means move back to the beginning of the preedit text.</entry>
9603
<entry><constant>XIMDontChange</constant></entry>
9604
<entry>The caret position does not change.</entry>
9610
<indexterm significance="preferred"><primary>XIMNextLine</primary></indexterm>
9611
<indexterm significance="preferred"><primary>XIMPreviousLine</primary></indexterm>
9612
<indexterm significance="preferred"><primary>XIMLineStart</primary></indexterm>
9613
<indexterm significance="preferred"><primary>XIMLineEnd</primary></indexterm>
9614
<indexterm significance="preferred"><primary>XIMAbsolutePosition</primary></indexterm>
9615
<indexterm significance="preferred"><primary>XIMDontChange</primary></indexterm>
9617
<sect3 id="Status_Callbacks">
9618
<title>Status Callbacks</title>
9620
<!-- (SN Status Callbacks -->
9624
An input method may communicate changes in the status of an input context
9625
(for example, created, destroyed, or focus changes) with three status
9626
callbacks: StatusStartCallback, StatusDoneCallback, and StatusDrawCallback.
9631
When the input context is created or gains focus,
9632
the input method calls the StatusStartCallback callback.
9633
<indexterm significance="preferred"><primary>StatusStartCallback</primary></indexterm>
9637
<funcdef>void <function><replaceable>StatusStartCallback</replaceable></function></funcdef>
9638
<paramdef>XIC<parameter> ic</parameter></paramdef>
9639
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
9640
<paramdef>XPointer<parameter> call_data</parameter></paramdef>
9647
<emphasis remap='I'>ic</emphasis>
9651
Specifies the input context.
9657
<emphasis remap='I'>client_data</emphasis>
9661
Specifies the additional client data.
9667
<emphasis remap='I'>call_data</emphasis>
9671
Not used for this callback and always passed as NULL.
9680
The callback should initialize appropriate data for displaying status
9681
and for responding to StatusDrawCallback calls.
9682
Once StatusStartCallback is called,
9683
it will not be called again before StatusDoneCallback has been called.
9688
When an input context
9689
is destroyed or when it loses focus, the input method calls StatusDoneCallback.
9690
<indexterm significance="preferred"><primary>StatusDoneCallback</primary></indexterm>
9694
<funcdef>void <function><replaceable>StatusDoneCallback</replaceable></function></funcdef>
9695
<paramdef>XIC<parameter> ic</parameter></paramdef>
9696
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
9697
<paramdef>XPointer<parameter> call_data</parameter></paramdef>
9704
<emphasis remap='I'>ic</emphasis>
9708
Specifies the input context.
9714
<emphasis remap='I'>client_data</emphasis>
9718
Specifies the additional client data.
9724
<emphasis remap='I'>call_data</emphasis>
9728
Not used for this callback and always passed as NULL.
9737
The callback may release any data allocated on
9738
<function>StatusStart</function>.
9743
When an input context status has to be updated, the input method calls
9745
<indexterm significance="preferred"><primary>StatusDrawCallback</primary></indexterm>
9749
<funcdef>void <function><replaceable>StatusDrawCallback</replaceable></function></funcdef>
9750
<paramdef>XIC<parameter> ic</parameter></paramdef>
9751
<paramdef>XPointer<parameter> client_data</parameter></paramdef>
9752
<paramdef>XIMStatusDrawCallbackStruct<parameter> *call_data</parameter></paramdef>
9759
<emphasis remap='I'>ic</emphasis>
9763
Specifies the input context.
9769
<emphasis remap='I'>client_data</emphasis>
9773
Specifies the additional client data.
9779
<emphasis remap='I'>call_data</emphasis>
9783
Specifies the status drawing information.
9792
The callback should update the status area by either drawing a string
9793
or imaging a bitmap in the status area.
9798
<structname>XIMStatusDataType</structname>
9800
<structname>XIMStatusDrawCallbackStruct</structname>
9801
structures are defined as follows:
9802
<indexterm significance="preferred"><primary>XIMStatusDataType</primary></indexterm>
9803
<indexterm significance="preferred"><primary>XIMStatusDrawCallbackStruct</primary></indexterm>
9808
<literallayout class="monospaced">
9809
<!-- .TA .5i 1i 3i -->
9810
<!-- .ta .5i 1i 3i -->
9814
} XIMStatusDataType;
9816
typedef struct _XIMStatusDrawCallbackStruct {
9817
XIMStatusDataType type;
9822
} XIMStatusDrawCallbackStruct;
9832
<symbol>XIMVisibleToForward</symbol>,
9833
<symbol>XIMVisibleToBackword</symbol>,
9835
<symbol>XIMVisibleToCenter</symbol>
9836
are not relevant and will not appear in the
9837
<type>XIMFeedback</type>
9839
<structname>XIMText</structname>
9847
<sect2 id="Event_Filtering_b">
9848
<title>Event Filtering</title>
9850
<!-- (SN Event Filtering -->
9854
Xlib provides the ability for an input method
9855
to register a filter internal to Xlib.
9856
This filter is called by a client (or toolkit) by calling
9857
<function>XFilterEvent</function>
9859
<function>XNextEvent</function>.
9860
Any client that uses the
9862
interface should call
9863
<function>XFilterEvent</function>
9864
to allow input methods to process their events without knowledge
9865
of the client's dispatching mechanism.
9866
A client's user interface policy may determine the priority
9867
of event filters with respect to other event-handling mechanisms
9868
(for example, modal grabs).
9872
Clients may not know how many filters there are, if any,
9874
They may only know if an event has been filtered on return of
9875
<function>XFilterEvent</function>.
9876
Clients should discard filtered events.
9881
To filter an event, use
9882
<function>XFilterEvent</function>.
9883
<indexterm significance="preferred"><primary>XFilterEvent</primary></indexterm>
9887
<funcdef>Bool <function>XFilterEvent</function></funcdef>
9888
<paramdef>XEvent<parameter> *event</parameter></paramdef>
9889
<paramdef>Window<parameter> w</parameter></paramdef>
9893
<!-- .ds Ev event to filter -->
9897
<emphasis remap='I'>event</emphasis>
9902
<!-- .ds Wi for which the filter is to be applied -->
9908
<emphasis remap='I'>w</emphasis>
9912
Specifies the window (Wi.
9921
If the window argument is
9922
<symbol>None</symbol>,
9923
<function>XFilterEvent</function>
9924
applies the filter to the window specified in the
9925
<structname>XEvent</structname>
9927
The window argument is provided so that layers above Xlib
9928
that do event redirection can indicate to which window an event
9929
has been redirected.
9934
<function>XFilterEvent</function>
9936
<symbol>True</symbol>,
9937
then some input method has filtered the event,
9938
and the client should discard the event.
9940
<function>XFilterEvent</function>
9942
<symbol>False</symbol>,
9943
then the client should continue processing the event.
9947
If a grab has occurred in the client and
9948
<function>XFilterEvent</function>
9950
<symbol>True</symbol>,
9951
the client should ungrab the keyboard.
9954
<sect2 id="Getting_Keyboard_Input_b">
9955
<title>Getting Keyboard Input</title>
9957
<!-- (SN Getting Keyboard Input -->
9961
To get composed input from an input method,
9963
<function>XmbLookupString</function>
9965
<function>XwcLookupString</function>.
9966
<indexterm significance="preferred"><primary>XmbLookupString</primary></indexterm>
9967
<indexterm significance="preferred"><primary>XwcLookupString</primary></indexterm>
9971
<funcdef>int <function>XmbLookupString</function></funcdef>
9972
<paramdef>XIC<parameter> ic</parameter></paramdef>
9973
<paramdef>XKeyPressedEvent<parameter> *event</parameter></paramdef>
9974
<paramdef>char<parameter> *buffer_return</parameter></paramdef>
9975
<paramdef>int<parameter> bytes_buffer</parameter></paramdef>
9976
<paramdef>KeySym<parameter> *keysym_return</parameter></paramdef>
9977
<paramdef>Status<parameter> *status_return</parameter></paramdef>
9983
<funcdef>int <function>XwcLookupString</function></funcdef>
9984
<paramdef>XIC<parameter> ic</parameter></paramdef>
9985
<paramdef>XKeyPressedEvent<parameter> *event</parameter></paramdef>
9986
<paramdef>wchar_t<parameter> *buffer_return</parameter></paramdef>
9987
<paramdef>int<parameter> wchars_buffer</parameter></paramdef>
9988
<paramdef>KeySym<parameter> *keysym_return</parameter></paramdef>
9989
<paramdef>Status<parameter> *status_return</parameter></paramdef>
9996
<emphasis remap='I'>ic</emphasis>
10000
Specifies the input context.
10001
<!-- .ds Ev key event to be used -->
10007
<emphasis remap='I'>event</emphasis>
10017
<emphasis remap='I'>buffer_return</emphasis>
10021
Returns a multibyte string or wide character string (if any)
10022
from the input method.
10028
<emphasis remap='I'>bytes_buffer</emphasis>
10039
<emphasis remap='I'>wchars_buffer</emphasis>
10043
Specifies space available in the return buffer.
10049
<emphasis remap='I'>keysym_return</emphasis>
10053
Returns the KeySym computed from the event if this argument is not NULL.
10059
<emphasis remap='I'>status_return</emphasis>
10063
Returns a value indicating what kind of data is returned.
10073
<function>XmbLookupString</function>
10075
<function>XwcLookupString</function>
10076
functions return the string from the input method specified
10077
in the buffer_return argument.
10078
If no string is returned,
10079
the buffer_return argument is unchanged.
10083
The KeySym into which the KeyCode from the event was mapped is returned
10084
in the keysym_return argument if it is non-NULL and the status_return
10085
argument indicates that a KeySym was returned.
10086
If both a string and a KeySym are returned,
10087
the KeySym value does not necessarily correspond to the string returned.
10091
<function>XmbLookupString</function>
10092
returns the length of the string in bytes, and
10093
<function>XwcLookupString</function>
10094
returns the length of the string in characters.
10096
<function>XmbLookupString</function>
10098
<function>XwcLookupString</function>
10099
return text in the encoding of the locale bound to the input method
10100
of the specified input context.
10104
Each string returned by
10105
<function>XmbLookupString</function>
10107
<function>XwcLookupString</function>
10108
begins in the initial state of the encoding of the locale
10109
(if the encoding of the locale is state-dependent).
10112
To insure proper input processing,
10113
it is essential that the client pass only
10114
<symbol>KeyPress</symbol>
10116
<function>XmbLookupString</function>
10118
<function>XwcLookupString</function>.
10119
Their behavior when a client passes a
10120
<symbol>KeyRelease</symbol>
10121
event is undefined.
10127
Clients should check the status_return argument before
10128
using the other returned values.
10129
These two functions both return a value to status_return
10130
that indicates what has been returned in the other arguments.
10131
The possible values returned are:
10135
<tgroup cols='2' align='center'>
10136
<colspec colname='c1'/>
10137
<colspec colname='c2'/>
10140
<entry><symbol>XBufferOverflow</symbol></entry>
10141
<entry>The input string to be returned is too large for the supplied buffer_return.
10143
(<function>XmbLookupString</function>
10145
<function>XwcLookupString</function>
10146
in characters) is returned as the value of the function,
10147
and the contents of buffer_return and keysym_return are not modified.
10148
The client should recall the function with the same event
10149
and a buffer of adequate size to obtain the string.</entry>
10152
<entry><symbol>XLookupNone</symbol></entry>
10153
<entry>No consistent input has been composed so far.
10154
The contents of buffer_return and keysym_return are not modified,
10155
and the function returns zero.</entry>
10158
<entry><symbol>XLookupChars</symbol></entry>
10159
<entry>Some input characters have been composed.
10160
They are placed in the buffer_return argument,
10161
and the string length is returned as the value of the function.
10162
The string is encoded in the locale bound to the input context.
10163
The content of the keysym_return argument is not modified.</entry>
10166
<entry><symbol>XLookupKeySym</symbol></entry>
10167
<entry>A KeySym has been returned instead of a string
10168
and is returned in keysym_return.
10169
The content of the buffer_return argument is not modified,
10170
and the function returns zero.</entry>
10173
<entry><symbol>XLookupBoth</symbol></entry>
10174
<entry>Both a KeySym and a string are returned;
10175
<symbol>XLookupChars</symbol>
10177
<symbol>XLookupKeySym</symbol>
10178
occur simultaneously.</entry>
10186
It does not make any difference if the input context passed as an argument to
10187
<function>XmbLookupString</function>
10189
<function>XwcLookupString</function>
10190
is the one currently in possession of the focus or not.
10191
Input may have been composed within an input context before it lost the focus,
10192
and that input may be returned on subsequent calls to
10193
<function>XmbLookupString</function>
10195
<function>XwcLookupString</function>
10196
even though it does not have any more keyboard focus.
10199
<sect2 id="Input_Method_Conventions">
10200
<title>Input Method Conventions</title>
10202
<!-- (SN Input Method Conventions -->
10206
The input method architecture is transparent to the client.
10207
However, clients should respect a number of conventions in order
10209
Clients must also be aware of possible effects of synchronization
10210
between input method and library in the case of a remote input server.
10212
<sect3 id="Client_Conventions">
10213
<title>Client Conventions</title>
10215
<!-- (SN Client Conventions -->
10219
A well-behaved client (or toolkit) should first query the input method style.
10220
If the client cannot satisfy the requirements of the supported styles
10221
(in terms of geometry management or callbacks),
10222
it should negotiate with the user continuation of the program
10223
or raise an exception or error of some sort.
10226
<sect3 id="Synchronization_Conventions">
10227
<title>Synchronization Conventions</title>
10229
<!-- (SN Synchronization Conventions -->
10234
<symbol>KeyPress</symbol>
10235
event with a KeyCode of zero is used exclusively as a
10236
signal that an input method has composed input that can be returned by
10237
<function>XmbLookupString</function>
10239
<function>XwcLookupString</function>.
10240
No other use is made of a
10241
<symbol>KeyPress</symbol>
10242
event with KeyCode of zero.
10246
Such an event may be generated by either a front-end
10247
or a back-end input method in an implementation-dependent manner.
10248
Some possible ways to generate this event include:
10253
A synthetic event sent by an input method server
10258
An artificial event created by a input method filter and pushed
10259
onto a client's event queue
10265
<symbol>KeyPress</symbol>
10266
event whose KeyCode value is modified by an input method filter
10272
When callback support is specified by the client,
10273
input methods will not take action unless they explicitly
10274
called back the client and obtained no response
10275
(the callback is not specified or returned invalid data).
10280
<sect1 id="String_Constants">
10281
<title>String Constants</title>
10283
<!-- (SN String Constants -->
10287
The following symbols for string constants are defined in
10288
<X11/Xlib.h> .
10289
Although they are shown here with particular macro definitions,
10290
they may be implemented as macros, as global symbols, or as a
10291
mixture of the two. The string pointer value itself
10292
is not significant; clients must not assume that inequality of two
10293
values implies inequality of the actual string data.
10296
<literallayout class="monospaced">
10297
#define XNVaNestedList "XNVaNestedList"
10298
#define XNSeparatorofNestedList "separatorofNestedList"
10299
#define XNQueryInputStyle "queryInputStyle"
10300
#define XNClientWindow "clientWindow"
10301
#define XNInputStyle "inputStyle"
10302
#define XNFocusWindow "focusWindow"
10303
#define XNResourceName "resourceName"
10304
#define XNResourceClass "resourceClass"
10305
#define XNGeometryCallback "geometryCallback"
10306
#define XNDestroyCallback "destroyCallback"
10307
#define XNFilterEvents "filterEvents"
10308
#define XNPreeditStartCallback "preeditStartCallback"
10309
#define XNPreeditDoneCallback "preeditDoneCallback"
10310
#define XNPreeditDrawCallback "preeditDrawCallback"
10311
#define XNPreeditCaretCallback "preeditCaretCallback"
10312
#define XNPreeditStateNotifyCallback "preeditStateNotifyCallback"
10313
#define XNPreeditAttributes "preeditAttributes"
10314
#define XNStatusStartCallback "statusStartCallback"
10315
#define XNStatusDoneCallback "statusDoneCallback"
10316
#define XNStatusDrawCallback "statusDrawCallback"
10317
#define XNStatusAttributes "statusAttributes"
10318
#define XNArea "area"
10319
#define XNAreaNeeded "areaNeeded"
10320
#define XNSpotLocation "spotLocation"
10321
#define XNColormap "colorMap"
10322
#define XNStdColormap "stdColorMap"
10323
#define XNForeground "foreground"
10324
#define XNBackground "background"
10325
#define XNBackgroundPixmap "backgroundPixmap"
10326
#define XNFontSet "fontSet"
10327
#define XNLineSpace "lineSpace"
10328
#define XNCursor "cursor"
10329
#define XNQueryIMValuesList "queryIMValuesList"
10330
#define XNQueryICValuesList "queryICValuesList"
10331
#define XNStringConversionCallback "stringConversionCallback"
10332
#define XNStringConversion "stringConversion"
10333
#define XNResetState "resetState"
10334
#define XNHotKey "hotkey"
10335
#define XNHotKeyState "hotkeyState"
10336
#define XNPreeditState "preeditState"
10337
#define XNVisiblePosition "visiblePosition"
10338
#define XNR6PreeditCallbackBehavior "r6PreeditCallback"
10339
#define XNRequiredCharSet "requiredCharSet"
10340
#define XNQueryOrientation "queryOrientation"
10341
#define XNDirectionalDependentDrawing "directionalDependentDrawing"
10342
#define XNContextualDrawing "contextualDrawing"
10343
#define XNBaseFontName "baseFontName"
10344
#define XNMissingCharSet "missingCharSet"
10345
#define XNDefaultString "defaultString"
10346
#define XNOrientation "orientation"
10347
#define XNFontInfo "fontInfo"
10348
#define XNOMAutomatic "omAutomatic"