]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_add_wch.3x
ncurses 6.0 - patch 20170527
[ncurses.git] / man / curs_add_wch.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 2001-2015,2017 Free Software Foundation, Inc.              *
3 .\"                                                                          *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
5 .\" copy of this software and associated documentation files (the            *
6 .\" "Software"), to deal in the Software without restriction, including      *
7 .\" without limitation the rights to use, copy, modify, merge, publish,      *
8 .\" distribute, distribute with modifications, sublicense, and/or sell       *
9 .\" copies of the Software, and to permit persons to whom the Software is    *
10 .\" furnished to do so, subject to the following conditions:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 .\"                                                                          *
23 .\" Except as contained in this notice, the name(s) of the above copyright   *
24 .\" holders shall not be used in advertising or otherwise to promote the     *
25 .\" sale, use or other dealings in this Software without prior written       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" $Id: curs_add_wch.3x,v 1.23 2017/05/20 14:45:24 Sven.Joachim Exp $
30 .TH curs_add_wch 3X ""
31 .ie \n(.g .ds `` \(lq
32 .el       .ds `` ``
33 .ie \n(.g .ds '' \(rq
34 .el       .ds '' ''
35 .de bP
36 .IP \(bu 4
37 ..
38 .SH NAME
39 \fBadd_wch\fP,
40 \fBwadd_wch\fP,
41 \fBmvadd_wch\fP,
42 \fBmvwadd_wch\fP,
43 \fBecho_wchar\fP,
44 \fBwecho_wchar\fP \- add a complex character and rendition to a \fBcurses\fR window, then advance the cursor
45 .SH SYNOPSIS
46 .PP
47 \fB#include <curses.h>\fP
48 .sp
49 .B "int add_wch( const cchar_t *\fIwch\fB );"
50 .br
51 .B "int wadd_wch( WINDOW *\fIwin\fP, const cchar_t *\fIwch\fB );"
52 .br
53 .B "int mvadd_wch( int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fB );"
54 .br
55 .B "int mvwadd_wch( WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fB );"
56 .br
57 .B "int echo_wchar( const cchar_t *\fIwch\fB );"
58 .br
59 .B "int wecho_wchar( WINDOW *\fIwin\fP, const cchar_t *\fIwch\fB );"
60 .br
61 .SH DESCRIPTION
62 .SS add_wch
63 .PP
64 The
65 \fBadd_wch\fP,
66 \fBwadd_wch\fP,
67 \fBmvadd_wch\fP, and
68 \fBmvwadd_wch\fP
69 functions put the complex character \fIwch\fP into the given
70 window at its current position,
71 which is then advanced.
72 These functions perform
73 wrapping and special-character processing as follows:
74 .bP
75 If \fIwch\fP refers to a spacing character,
76 then any previous character at that location is removed.
77 A new character specified by \fIwch\fP is
78 placed at that location with rendition specified by \fIwch\fP.
79 The cursor then advances to
80 the next spacing character on the screen.
81 .bP
82 If \fIwch\fP refers to a non-spacing character,
83 all previous characters at that location are preserved.
84 The non-spacing characters of \fIwch\fP
85 are added to the spacing complex character,
86 and the rendition specified by \fIwch\fP is ignored.
87 .bP
88 If the character part of \fIwch\fP is
89 a tab, newline, backspace or other control character,
90 the window is updated and the cursor moves as if \fBaddch\fR were called.
91 .SS echo_wchar
92 .PP
93 The \fBecho_wchar\fP
94 function is functionally equivalent to a call to
95 \fBadd_wch\fP
96 followed by a call to
97 \fBrefresh\fP(3X).
98 Similarly, the
99 \fBwecho_wchar\fP
100 is functionally equivalent to a call to
101 \fBwadd_wch\fP
102 followed by a call to
103 \fBwrefresh\fP.
104 The knowledge
105 that only a single character is being output is taken into consideration and,
106 for non-control characters, a considerable performance gain might be seen
107 by using the *\fBecho\fP* functions instead of their equivalents.
108 .SS Line Graphics
109 Like \fBaddch\fP(3X),
110 \fBaddch_wch\fP accepts symbols which make it simple to draw lines and other
111 frequently used special characters.
112 These symbols correspond to the same VT100 line-drawing set as
113 \fBaddch\fP(3X).
114 .PP
115 .TS
116 l l l l l
117 l l l l l
118 _ _ _ _ _
119 lw(1.5i) lw5 lw5 lw5 lw20.
120 \fBACS\fR       \fBUnicode\fP   \fBASCII\fR     \fBacsc\fP      \fBGlyph\fR
121 \fBName\fR      \fBDefault\fP   \fBDefault\fR   \fBchar\fP      \fBName\fR
122 WACS_BLOCK      0x25ae  #       0       solid square block
123 WACS_BOARD      0x2592  #       h       board of squares
124 WACS_BTEE       0x2534  +       v       bottom tee
125 WACS_BULLET     0x00b7  o       ~       bullet
126 WACS_CKBOARD    0x2592  :       a       checker board (stipple)
127 WACS_DARROW     0x2193  v       .       arrow pointing down
128 WACS_DEGREE     0x00b0  '       f       degree symbol
129 WACS_DIAMOND    0x25c6  +       `       diamond
130 WACS_GEQUAL     0x2265  >       >       greater-than-or-equal-to
131 WACS_HLINE      0x2500  \-      q       horizontal line
132 WACS_LANTERN    0x2603  #       i       lantern symbol
133 WACS_LARROW     0x2190  <       ,       arrow pointing left
134 WACS_LEQUAL     0x2264  <       y       less-than-or-equal-to
135 WACS_LLCORNER   0x2514  +       m       lower left-hand corner
136 WACS_LRCORNER   0x2518  +       j       lower right-hand corner
137 WACS_LTEE       0x2524  +       t       left tee
138 WACS_NEQUAL     0x2260  !       |       not-equal
139 WACS_PI 0x03c0  *       {       greek pi
140 WACS_PLMINUS    0x00b1  #       g       plus/minus
141 WACS_PLUS       0x253c  +       n       plus
142 WACS_RARROW     0x2192  >       +       arrow pointing right
143 WACS_RTEE       0x251c  +       u       right tee
144 WACS_S1 0x23ba  \-      o       scan line 1
145 WACS_S3 0x23bb  \-      p       scan line 3
146 WACS_S7 0x23bc  \-      r       scan line 7
147 WACS_S9 0x23bd  \&_     s       scan line 9
148 WACS_STERLING   0x00a3  f       }       pound-sterling symbol
149 WACS_TTEE       0x252c  +       w       top tee
150 WACS_UARROW     0x2191          ^       \-      arrow pointing up
151 WACS_ULCORNER   0x250c  +       l       upper left-hand corner
152 WACS_URCORNER   0x2510  +       k       upper right-hand corner
153 WACS_VLINE      0x2502  |       x       vertical line
154 .TE
155 .PP
156 The wide-character configuration of ncurses also defines symbols
157 for double-lines:
158 .PP
159 .TS
160 l l l l l
161 l l l l l
162 _ _ _ _ _
163 lw(1.5i) lw5 lw5 lw5 lw20.
164 \fBACS\fR       \fBUnicode\fP   \fBASCII\fR     \fBacsc\fP      \fBGlyph\fR
165 \fBName\fR      \fBDefault\fP   \fBDefault\fR   \fBchar\fP      \fBName\fR
166 WACS_D_BTEE     0x2569  +       H       double tee pointing up
167 WACS_D_HLINE    0x2550  -       R       double horizontal line
168 WACS_D_LLCORNER 0x255a  +       D       double lower left corner
169 WACS_D_LRCORNER 0x255d  +       A       double lower right corner
170 WACS_D_LTEE     0x2560  +       F       double tee pointing right
171 WACS_D_PLUS     0x256c  +       E       double large plus
172 WACS_D_RTEE     0x2563  +       G       double tee pointing left
173 WACS_D_TTEE     0x2566  +       I       double tee pointing down
174 WACS_D_ULCORNER 0x2554  +       C       double upper left corner
175 WACS_D_URCORNER 0x2557  +       B       double upper right corner
176 WACS_D_VLINE    0x2551  |       Y       double vertical line
177 .TE
178 .PP
179 and for thick lines:
180 .TS
181 l l l l l
182 l l l l l
183 _ _ _ _ _
184 lw(1.5i) lw5 lw5 lw5 lw20.
185 \fBACS\fR       \fBUnicode\fP   \fBASCII\fR     \fBacsc\fP      \fBGlyph\fR
186 \fBName\fR      \fBDefault\fP   \fBDefault\fR   \fBchar\fP      \fBName\fR
187 WACS_T_BTEE     0x253b  +       V       thick tee pointing up
188 WACS_T_HLINE    0x2501  -       Q       thick horizontal line
189 WACS_T_LLCORNER 0x2517  +       M       thick lower left corner
190 WACS_T_LRCORNER 0x251b  +       J       thick lower right corner
191 WACS_T_LTEE     0x252b  +       T       thick tee pointing right
192 WACS_T_PLUS     0x254b  +       N       thick large plus
193 WACS_T_RTEE     0x2523  +       U       thick tee pointing left
194 WACS_T_TTEE     0x2533  +       W       thick tee pointing down
195 WACS_T_ULCORNER 0x250f  +       L       thick upper left corner
196 WACS_T_URCORNER 0x2513  +       K       thick upper right corner
197 WACS_T_VLINE    0x2503  |       X       thick vertical line
198 .TE
199 .SH RETURN VALUE
200 .PP
201 All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success.
202 .PP
203 Functions with a \*(``mv\*('' prefix first perform a cursor movement using
204 \fBwmove\fP, and return an error if the position is outside the window,
205 or if the window pointer is null.
206 .SH NOTES
207 .PP
208 Note that
209 \fBadd_wch\fP,
210 \fBmvadd_wch\fP,
211 \fBmvwadd_wch\fP, and
212 \fBecho_wchar\fP
213 may be macros.
214 .SH PORTABILITY
215 .PP
216 All of these functions are described in the XSI Curses standard, Issue 4.
217 The defaults specified for line-drawing characters apply in the POSIX locale.
218 .PP
219 X/Open Curses makes it clear that the WACS_ symbols should be defined as
220 a pointer to \fBcchar_t\fP data, e.g., in the discussion of \fBborder_set\fR.
221 A few implementations are problematic:
222 .bP
223 NetBSD curses defines the symbols as a \fBwchar_t\fP within a \fBcchar_t\fP.
224 .bP
225 HPUX curses equates some of the \fIACS_\fP symbols
226 to the analogous \fIWACS_\fP symbols as if the \fIACS_\fP symbols were
227 wide characters.
228 The misdefined symbols are the arrows
229 and other symbols which are not used for line-drawing.
230 .PP
231 X/Open Curses does not define symbols for thick- or double-lines.
232 SVr4 curses implementations defined their line-drawing symbols in
233 terms of intermediate symbols.
234 This implementation extends those symbols, providing new definitions
235 which are not in the SVr4 implementations.
236 .PP
237 Not all Unicode-capable terminals provide support for VT100-style
238 alternate character sets (i.e., the \fBacsc\fP capability),
239 with their corresponding line-drawing characters.
240 X/Open Curses did not address the aspect of integrating Unicode with
241 line-drawing characters.
242 Existing implementations of Unix curses (AIX, HPUX, Solaris)
243 use only the \fBacsc\fP character-mapping to provide this feature.
244 As a result, those implementations can only use single-byte line-drawing
245 characters.
246 Ncurses 5.3 (2002) provided a table of Unicode values to solve these problems.
247 NetBSD curses incorporated that table in 2010.
248 .PP
249 In this implementation, the Unicode values are used instead of the
250 terminal description's \fBacsc\fP mapping as discussed in ncurses(3X)
251 for the environment variable \fBNCURSES_NO_UTF8_ACS\fP.
252 In contrast, for the same cases, the line-drawing characters
253 described in \fBcurs_addch\fP(3X) will use only the ASCII default values.
254 .PP
255 Having Unicode available does not solve all of the problems with
256 line-drawing for curses:
257 .bP
258 The closest Unicode equivalents to the
259 VT100 graphics \fIS1\fP, \fIS3\fP, \fIS7\fP and \fIS9\fP
260 frequently are not displayed at
261 the regular intervals which the terminal used.
262 .bP
263 The \fIlantern\fP is a special case.
264 It originated with the AT&T 4410 terminal in the early 1980s.
265 There is no accessible documentation depicting the lantern symbol
266 on the AT&T terminal.
267 .IP
268 Lacking documentation, most readers assume that a \fIstorm lantern\fP
269 was intended.
270 But there are several possibilities, all with problems.
271 .IP
272 Unicode 6.0 (2010) does provide two lantern symbols: U+1F383 and U+1F3EE.
273 Those were not available in 2002, and are irrelevant since
274 they lie outside the BMP and as a result are not generally available
275 in terminals.
276 They are not storm lanterns, in any case.
277 .IP
278 Most \fIstorm lanterns\fP have a tapering glass chimney
279 (to guard against tipping);
280 some have a wire grid protecting the chimney.
281 .IP
282 For the tapering appearance, \[u2603] U+2603 was adequate.
283 In use on a terminal, no one can tell what the image represents.
284 Unicode calls it a snowman.
285 .IP
286 Others have suggested these alternatives:
287 \[sc] U+00A7 (section mark),
288 \[u0398] U+0398 (theta),
289 \[u03A6] U+03A6 (phi),
290 \[u03B4] U+03B4 (delta),
291 \[u2327] U+2327 (x in a rectangle),
292 \[u256C] U+256C (forms double vertical and horizontal), and
293 \[u2612] U+2612 (ballot box with x).
294 .SH SEE ALSO
295 .na
296 .PP
297 \fBcurses\fR(3X),
298 \fBcurs_addch\fR(3X),
299 \fBcurs_attr\fR(3X),
300 \fBcurs_clear\fR(3X),
301 \fBcurs_outopts\fR(3X),
302 \fBcurs_refresh\fR(3X),
303 \fBputwc\fR(3)