1 .\"***************************************************************************
2 .\" Copyright (c) 2001-2015,2017 Free Software Foundation, Inc. *
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: *
12 .\" The above copyright notice and this permission notice shall be included *
13 .\" in all copies or substantial portions of the Software. *
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. *
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 *
27 .\"***************************************************************************
29 .\" $Id: curs_add_wch.3x,v 1.23 2017/05/20 14:45:24 Sven.Joachim Exp $
30 .TH curs_add_wch 3X ""
44 \fBwecho_wchar\fP \- add a complex character and rendition to a \fBcurses\fR window, then advance the cursor
47 \fB#include <curses.h>\fP
49 .B "int add_wch( const cchar_t *\fIwch\fB );"
51 .B "int wadd_wch( WINDOW *\fIwin\fP, const cchar_t *\fIwch\fB );"
53 .B "int mvadd_wch( int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fB );"
55 .B "int mvwadd_wch( WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fB );"
57 .B "int echo_wchar( const cchar_t *\fIwch\fB );"
59 .B "int wecho_wchar( WINDOW *\fIwin\fP, const cchar_t *\fIwch\fB );"
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:
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.
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.
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.
94 function is functionally equivalent to a call to
100 is functionally equivalent to a call to
102 followed by a call to
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.
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
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
156 The wide-character configuration of ncurses also defines symbols
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
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
201 All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success.
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.
211 \fBmvwadd_wch\fP, and
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.
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:
223 NetBSD curses defines the symbols as a \fBwchar_t\fP within a \fBcchar_t\fP.
225 HPUX curses equates some of the \fIACS_\fP symbols
226 to the analogous \fIWACS_\fP symbols as if the \fIACS_\fP symbols were
228 The misdefined symbols are the arrows
229 and other symbols which are not used for line-drawing.
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.
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
246 Ncurses 5.3 (2002) provided a table of Unicode values to solve these problems.
247 NetBSD curses incorporated that table in 2010.
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.
255 Having Unicode available does not solve all of the problems with
256 line-drawing for curses:
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.
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.
268 Lacking documentation, most readers assume that a \fIstorm lantern\fP
270 But there are several possibilities, all with problems.
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
276 They are not storm lanterns, in any case.
278 Most \fIstorm lanterns\fP have a tapering glass chimney
279 (to guard against tipping);
280 some have a wire grid protecting the chimney.
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.
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).
298 \fBcurs_addch\fR(3X),
300 \fBcurs_clear\fR(3X),
301 \fBcurs_outopts\fR(3X),
302 \fBcurs_refresh\fR(3X),