Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | '\" |
2 | '\" Copyright (c) 1996 Sun Microsystems, Inc. | |
3 | '\" | |
4 | '\" See the file "license.terms" for information on usage and redistribution | |
5 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | |
6 | '\" | |
7 | '\" RCS: @(#) $Id: TextLayout.3,v 1.5 1999/04/21 21:53:22 rjohnson Exp $ | |
8 | '\" | |
9 | '\" The definitions below are for supplemental macros used in Tcl/Tk | |
10 | '\" manual entries. | |
11 | '\" | |
12 | '\" .AP type name in/out ?indent? | |
13 | '\" Start paragraph describing an argument to a library procedure. | |
14 | '\" type is type of argument (int, etc.), in/out is either "in", "out", | |
15 | '\" or "in/out" to describe whether procedure reads or modifies arg, | |
16 | '\" and indent is equivalent to second arg of .IP (shouldn't ever be | |
17 | '\" needed; use .AS below instead) | |
18 | '\" | |
19 | '\" .AS ?type? ?name? | |
20 | '\" Give maximum sizes of arguments for setting tab stops. Type and | |
21 | '\" name are examples of largest possible arguments that will be passed | |
22 | '\" to .AP later. If args are omitted, default tab stops are used. | |
23 | '\" | |
24 | '\" .BS | |
25 | '\" Start box enclosure. From here until next .BE, everything will be | |
26 | '\" enclosed in one large box. | |
27 | '\" | |
28 | '\" .BE | |
29 | '\" End of box enclosure. | |
30 | '\" | |
31 | '\" .CS | |
32 | '\" Begin code excerpt. | |
33 | '\" | |
34 | '\" .CE | |
35 | '\" End code excerpt. | |
36 | '\" | |
37 | '\" .VS ?version? ?br? | |
38 | '\" Begin vertical sidebar, for use in marking newly-changed parts | |
39 | '\" of man pages. The first argument is ignored and used for recording | |
40 | '\" the version when the .VS was added, so that the sidebars can be | |
41 | '\" found and removed when they reach a certain age. If another argument | |
42 | '\" is present, then a line break is forced before starting the sidebar. | |
43 | '\" | |
44 | '\" .VE | |
45 | '\" End of vertical sidebar. | |
46 | '\" | |
47 | '\" .DS | |
48 | '\" Begin an indented unfilled display. | |
49 | '\" | |
50 | '\" .DE | |
51 | '\" End of indented unfilled display. | |
52 | '\" | |
53 | '\" .SO | |
54 | '\" Start of list of standard options for a Tk widget. The | |
55 | '\" options follow on successive lines, in four columns separated | |
56 | '\" by tabs. | |
57 | '\" | |
58 | '\" .SE | |
59 | '\" End of list of standard options for a Tk widget. | |
60 | '\" | |
61 | '\" .OP cmdName dbName dbClass | |
62 | '\" Start of description of a specific option. cmdName gives the | |
63 | '\" option's name as specified in the class command, dbName gives | |
64 | '\" the option's name in the option database, and dbClass gives | |
65 | '\" the option's class in the option database. | |
66 | '\" | |
67 | '\" .UL arg1 arg2 | |
68 | '\" Print arg1 underlined, then print arg2 normally. | |
69 | '\" | |
70 | '\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $ | |
71 | '\" | |
72 | '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. | |
73 | .if t .wh -1.3i ^B | |
74 | .nr ^l \n(.l | |
75 | .ad b | |
76 | '\" # Start an argument description | |
77 | .de AP | |
78 | .ie !"\\$4"" .TP \\$4 | |
79 | .el \{\ | |
80 | . ie !"\\$2"" .TP \\n()Cu | |
81 | . el .TP 15 | |
82 | .\} | |
83 | .ta \\n()Au \\n()Bu | |
84 | .ie !"\\$3"" \{\ | |
85 | \&\\$1 \\fI\\$2\\fP (\\$3) | |
86 | .\".b | |
87 | .\} | |
88 | .el \{\ | |
89 | .br | |
90 | .ie !"\\$2"" \{\ | |
91 | \&\\$1 \\fI\\$2\\fP | |
92 | .\} | |
93 | .el \{\ | |
94 | \&\\fI\\$1\\fP | |
95 | .\} | |
96 | .\} | |
97 | .. | |
98 | '\" # define tabbing values for .AP | |
99 | .de AS | |
100 | .nr )A 10n | |
101 | .if !"\\$1"" .nr )A \\w'\\$1'u+3n | |
102 | .nr )B \\n()Au+15n | |
103 | .\" | |
104 | .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n | |
105 | .nr )C \\n()Bu+\\w'(in/out)'u+2n | |
106 | .. | |
107 | .AS Tcl_Interp Tcl_CreateInterp in/out | |
108 | '\" # BS - start boxed text | |
109 | '\" # ^y = starting y location | |
110 | '\" # ^b = 1 | |
111 | .de BS | |
112 | .br | |
113 | .mk ^y | |
114 | .nr ^b 1u | |
115 | .if n .nf | |
116 | .if n .ti 0 | |
117 | .if n \l'\\n(.lu\(ul' | |
118 | .if n .fi | |
119 | .. | |
120 | '\" # BE - end boxed text (draw box now) | |
121 | .de BE | |
122 | .nf | |
123 | .ti 0 | |
124 | .mk ^t | |
125 | .ie n \l'\\n(^lu\(ul' | |
126 | .el \{\ | |
127 | .\" Draw four-sided box normally, but don't draw top of | |
128 | .\" box if the box started on an earlier page. | |
129 | .ie !\\n(^b-1 \{\ | |
130 | \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' | |
131 | .\} | |
132 | .el \}\ | |
133 | \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' | |
134 | .\} | |
135 | .\} | |
136 | .fi | |
137 | .br | |
138 | .nr ^b 0 | |
139 | .. | |
140 | '\" # VS - start vertical sidebar | |
141 | '\" # ^Y = starting y location | |
142 | '\" # ^v = 1 (for troff; for nroff this doesn't matter) | |
143 | .de VS | |
144 | .if !"\\$2"" .br | |
145 | .mk ^Y | |
146 | .ie n 'mc \s12\(br\s0 | |
147 | .el .nr ^v 1u | |
148 | .. | |
149 | '\" # VE - end of vertical sidebar | |
150 | .de VE | |
151 | .ie n 'mc | |
152 | .el \{\ | |
153 | .ev 2 | |
154 | .nf | |
155 | .ti 0 | |
156 | .mk ^t | |
157 | \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' | |
158 | .sp -1 | |
159 | .fi | |
160 | .ev | |
161 | .\} | |
162 | .nr ^v 0 | |
163 | .. | |
164 | '\" # Special macro to handle page bottom: finish off current | |
165 | '\" # box/sidebar if in box/sidebar mode, then invoked standard | |
166 | '\" # page bottom macro. | |
167 | .de ^B | |
168 | .ev 2 | |
169 | 'ti 0 | |
170 | 'nf | |
171 | .mk ^t | |
172 | .if \\n(^b \{\ | |
173 | .\" Draw three-sided box if this is the box's first page, | |
174 | .\" draw two sides but no top otherwise. | |
175 | .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c | |
176 | .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c | |
177 | .\} | |
178 | .if \\n(^v \{\ | |
179 | .nr ^x \\n(^tu+1v-\\n(^Yu | |
180 | \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c | |
181 | .\} | |
182 | .bp | |
183 | 'fi | |
184 | .ev | |
185 | .if \\n(^b \{\ | |
186 | .mk ^y | |
187 | .nr ^b 2 | |
188 | .\} | |
189 | .if \\n(^v \{\ | |
190 | .mk ^Y | |
191 | .\} | |
192 | .. | |
193 | '\" # DS - begin display | |
194 | .de DS | |
195 | .RS | |
196 | .nf | |
197 | .sp | |
198 | .. | |
199 | '\" # DE - end display | |
200 | .de DE | |
201 | .fi | |
202 | .RE | |
203 | .sp | |
204 | .. | |
205 | '\" # SO - start of list of standard options | |
206 | .de SO | |
207 | .SH "STANDARD OPTIONS" | |
208 | .LP | |
209 | .nf | |
210 | .ta 5.5c 11c | |
211 | .ft B | |
212 | .. | |
213 | '\" # SE - end of list of standard options | |
214 | .de SE | |
215 | .fi | |
216 | .ft R | |
217 | .LP | |
218 | See the \\fBoptions\\fR manual entry for details on the standard options. | |
219 | .. | |
220 | '\" # OP - start of full description for a single option | |
221 | .de OP | |
222 | .LP | |
223 | .nf | |
224 | .ta 4c | |
225 | Command-Line Name: \\fB\\$1\\fR | |
226 | Database Name: \\fB\\$2\\fR | |
227 | Database Class: \\fB\\$3\\fR | |
228 | .fi | |
229 | .IP | |
230 | .. | |
231 | '\" # CS - begin code excerpt | |
232 | .de CS | |
233 | .RS | |
234 | .nf | |
235 | .ta .25i .5i .75i 1i | |
236 | .. | |
237 | '\" # CE - end code excerpt | |
238 | .de CE | |
239 | .fi | |
240 | .RE | |
241 | .. | |
242 | .de UL | |
243 | \\$1\l'|0\(ul'\\$2 | |
244 | .. | |
245 | .TH Tk_ComputeTextLayout 3 8.1 Tk "Tk Library Procedures" | |
246 | .BS | |
247 | .SH NAME | |
248 | Tk_ComputeTextLayout, Tk_FreeTextLayout, Tk_DrawTextLayout, Tk_UnderlineTextLayout, Tk_PointToChar, Tk_CharBbox, Tk_DistanceToTextLayout, Tk_IntersectTextLayout, Tk_TextLayoutToPostscript \- routines to measure and display single-font, multi-line, justified text. | |
249 | .SH SYNOPSIS | |
250 | .nf | |
251 | \fB#include <tk.h>\fR | |
252 | .sp | |
253 | Tk_TextLayout | |
254 | \fBTk_ComputeTextLayout(\fItkfont, string, numChars, wrapLength, justify, flags, widthPtr, heightPtr\fB)\fR | |
255 | .sp | |
256 | void | |
257 | \fBTk_FreeTextLayout(\fIlayout\fB)\fR | |
258 | .sp | |
259 | void | |
260 | \fBTk_DrawTextLayout(\fIdisplay, drawable, gc, layout, x, y, firstChar, lastChar\fB)\fR | |
261 | .sp | |
262 | void | |
263 | \fBTk_UnderlineTextLayout(\fIdisplay, drawable, gc, layout, x, y, underline\fB)\fR | |
264 | .sp | |
265 | int | |
266 | \fBTk_PointToChar(\fIlayout, x, y\fB)\fR | |
267 | .sp | |
268 | int | |
269 | \fBTk_CharBbox(\fIlayout, index, xPtr, yPtr, widthPtr, heightPtr\fB)\fR | |
270 | .sp | |
271 | int | |
272 | \fBTk_DistanceToTextLayout(\fIlayout, x, y\fB)\fR | |
273 | .sp | |
274 | int | |
275 | \fBTk_IntersectTextLayout(\fIlayout, x, y, width, height\fB)\fR | |
276 | .sp | |
277 | void | |
278 | \fBTk_TextLayoutToPostscript(\fIinterp, layout\fB)\fR | |
279 | ||
280 | .SH ARGUMENTS | |
281 | .AS Tk_TextLayout "*xPtr, *yPtr" | |
282 | .AP Tk_Font tkfont in | |
283 | Font to use when constructing and displaying a text layout. The | |
284 | \fItkfont\fR must remain valid for the lifetime of the text layout. Must | |
285 | have been returned by a previous call to \fBTk_GetFont\fR. | |
286 | .AP "const char" *string in | |
287 | Potentially multi-line string whose dimensions are to be computed and | |
288 | stored in the text layout. The \fIstring\fR must remain valid for the | |
289 | lifetime of the text layout. | |
290 | .AP int numChars in | |
291 | The number of characters to consider from \fIstring\fR. If | |
292 | \fInumChars\fR is less than 0, then assumes \fIstring\fR is null | |
293 | .VS 8.1 | |
294 | terminated and uses \fBTcl_NumUtfChars\fR to determine the length of | |
295 | \fIstring\fR. | |
296 | .VE | |
297 | .AP int wrapLength in | |
298 | Longest permissible line length, in pixels. Lines in \fIstring\fR will | |
299 | automatically be broken at word boundaries and wrapped when they reach | |
300 | this length. If \fIwrapLength\fR is too small for even a single | |
301 | character to fit on a line, it will be expanded to allow one character to | |
302 | fit on each line. If \fIwrapLength\fR is <= 0, there is no automatic | |
303 | wrapping; lines will get as long as they need to be and only wrap if a | |
304 | newline/return character is encountered. | |
305 | .AP Tk_Justify justify in | |
306 | How to justify the lines in a multi-line text layout. Possible values | |
307 | are TK_JUSTIFY_LEFT, TK_JUSTIFY_CENTER, or TK_JUSTIFY_RIGHT. If the text | |
308 | layout only occupies a single line, then \fIjustify\fR is irrelevant. | |
309 | .AP int flags in | |
310 | Various flag bits OR-ed together. TK_IGNORE_TABS means that tab characters | |
311 | should not be expanded to the next tab stop. TK_IGNORE_NEWLINES means that | |
312 | newline/return characters should not cause a line break. If either tabs or | |
313 | newlines/returns are ignored, then they will be treated as regular | |
314 | characters, being measured and displayed in a platform-dependent manner as | |
315 | described in \fBTk_MeasureChars\fR, and will not have any special behaviors. | |
316 | .AP int *widthPtr out | |
317 | If non-NULL, filled with either the width, in pixels, of the widest | |
318 | line in the text layout, or the width, in pixels, of the bounding box for the | |
319 | character specified by \fIindex\fR. | |
320 | .AP int *heightPtr out | |
321 | If non-NULL, filled with either the total height, in pixels, of all | |
322 | the lines in the text layout, or the height, in pixels, of the bounding | |
323 | box for the character specified by \fIindex\fR. | |
324 | .AP Tk_TextLayout layout in | |
325 | A token that represents the cached layout information about the single-font, | |
326 | multi-line, justified piece of text. This token is returned by | |
327 | \fBTk_ComputeTextLayout\fR. | |
328 | .AP Display *display in | |
329 | Display on which to draw. | |
330 | .AP Drawable drawable in | |
331 | Window or pixmap in which to draw. | |
332 | .AP GC gc in | |
333 | Graphics context to use for drawing text layout. The font selected in | |
334 | this GC must correspond to the \fItkfont\fR used when constructing the | |
335 | text layout. | |
336 | .AP int "x, y" in | |
337 | Point, in pixels, at which to place the upper-left hand corner of the | |
338 | text layout when it is being drawn, or the coordinates of a point (with | |
339 | respect to the upper-left hand corner of the text layout) to check | |
340 | against the text layout. | |
341 | .AP int firstChar in | |
342 | The index of the first character to draw from the given text layout. | |
343 | The number 0 means to draw from the beginning. | |
344 | .AP int lastChar in | |
345 | The index of the last character up to which to draw. The character | |
346 | specified by \fIlastChar\fR itself will not be drawn. A number less | |
347 | than 0 means to draw all characters in the text layout. | |
348 | .AP int underline in | |
349 | Index of the single character to underline in the text layout, or a number | |
350 | less than 0 for no underline. | |
351 | .AP int index in | |
352 | The index of the character whose bounding box is desired. The bounding | |
353 | box is computed with respect to the upper-left hand corner of the text layout. | |
354 | .AP int "*xPtr, *yPtr" out | |
355 | Filled with the upper-left hand corner, in pixels, of the bounding box | |
356 | for the character specified by \fIindex\fR. Either or both \fIxPtr\fR | |
357 | and \fIyPtr\fR may be NULL, in which case the corresponding value | |
358 | is not calculated. | |
359 | .AP int "width, height" in | |
360 | Specifies the width and height, in pixels, of the rectangular area to | |
361 | compare for intersection against the text layout. | |
362 | .AP Tcl_Interp *interp out | |
363 | Postscript code that will print the text layout is appended to | |
364 | \fIinterp->result\fR. | |
365 | .BE | |
366 | ||
367 | .SH DESCRIPTION | |
368 | .PP | |
369 | These routines are for measuring and displaying single-font, multi-line, | |
370 | justified text. To measure and display simple single-font, single-line | |
371 | strings, refer to the documentation for \fBTk_MeasureChars\fR. There is | |
372 | no programming interface in the core of Tk that supports multi-font, | |
373 | multi-line text; support for that behavior must be built on top of | |
374 | simpler layers. | |
375 | .VS 8.1 | |
376 | Note that unlike the lower level text display routines, the functions | |
377 | described here all operate on character-oriented lengths and indices | |
378 | rather than byte-oriented values. See the description of | |
379 | \fBTcl_UtfAtIndex\fR for more details on converting between character | |
380 | and byte offsets. | |
381 | .VE 8.1 | |
382 | .PP | |
383 | The routines described here are built on top of the programming interface | |
384 | described in the \fBTk_MeasureChars\fR documentation. Tab characters and | |
385 | newline/return characters may be treated specially by these procedures, | |
386 | but all other characters are passed through to the lower level. | |
387 | .PP | |
388 | \fBTk_ComputeTextLayout\fR computes the layout information needed to | |
389 | display a single-font, multi-line, justified \fIstring\fR of text and | |
390 | returns a Tk_TextLayout token that holds this information. This token is | |
391 | used in subsequent calls to procedures such as \fBTk_DrawTextLayout\fR, | |
392 | \fBTk_DistanceToTextLayout\fR, and \fBTk_FreeTextLayout\fR. The | |
393 | \fIstring\fR and \fItkfont\fR used when computing the layout must remain | |
394 | valid for the lifetime of this token. | |
395 | .PP | |
396 | \fBTk_FreeTextLayout\fR is called to release the storage associated with | |
397 | \fIlayout\fR when it is no longer needed. A \fIlayout\fR should not be used | |
398 | in any other text layout procedures once it has been released. | |
399 | .PP | |
400 | \fBTk_DrawTextLayout\fR uses the information in \fIlayout\fR to display a | |
401 | single-font, multi-line, justified string of text at the specified location. | |
402 | .PP | |
403 | \fBTk_UnderlineTextLayout\fR uses the information in \fIlayout\fR to | |
404 | display an underline below an individual character. This procedure does | |
405 | not draw the text, just the underline. To produce natively underlined | |
406 | text, an underlined font should be constructed and used. All characters, | |
407 | including tabs, newline/return characters, and spaces at the ends of | |
408 | lines, can be underlined using this method. However, the underline will | |
409 | never be drawn outside of the computed width of \fIlayout\fR; the | |
410 | underline will stop at the edge for any character that would extend | |
411 | partially outside of \fIlayout\fR, and the underline will not be visible | |
412 | at all for any character that would be located completely outside of the | |
413 | layout. | |
414 | .PP | |
415 | \fBTk_PointToChar\fR uses the information in \fIlayout\fR to determine the | |
416 | character closest to the given point. The point is specified with respect | |
417 | to the upper-left hand corner of the \fIlayout\fR, which is considered to be | |
418 | located at (0, 0). Any point whose \fIy\fR-value is less that 0 will be | |
419 | considered closest to the first character in the text layout; any point | |
420 | whose \fIy\fR-value is greater than the height of the text layout will be | |
421 | considered closest to the last character in the text layout. Any point | |
422 | whose \fIx\fR-value is less than 0 will be considered closest to the first | |
423 | character on that line; any point whose \fIx\fR-value is greater than the | |
424 | width of the text layout will be considered closest to the last character on | |
425 | that line. The return value is the index of the character that was closest | |
426 | to the point. Given a \fIlayout\fR with no characters, the value 0 will | |
427 | always be returned, referring to a hypothetical zero-width placeholder | |
428 | character. | |
429 | .PP | |
430 | \fBTk_CharBbox\fR uses the information in \fIlayout\fR to return the | |
431 | bounding box for the character specified by \fIindex\fR. The width of the | |
432 | bounding box is the advance width of the character, and does not include any | |
433 | left or right bearing. Any character that extends partially outside of | |
434 | \fIlayout\fR is considered to be truncated at the edge. Any character | |
435 | that would be located completely outside of \fIlayout\fR is considered to | |
436 | be zero-width and pegged against the edge. The height of the bounding | |
437 | box is the line height for this font, extending from the top of the | |
438 | ascent to the bottom of the descent; information about the actual height | |
439 | of individual letters is not available. For measurement purposes, a | |
440 | \fIlayout\fR that contains no characters is considered to contain a | |
441 | single zero-width placeholder character at index 0. If \fIindex\fR was | |
442 | not a valid character index, the return value is 0 and \fI*xPtr\fR, | |
443 | \fI*yPtr\fR, \fI*widthPtr\fR, and \fI*heightPtr\fR are unmodified. | |
444 | Otherwise, if \fIindex\fR did specify a valid, the return value is | |
445 | non-zero, and \fI*xPtr\fR, \fI*yPtr\fR, \fI*widthPtr\fR, and | |
446 | \fI*heightPtr\fR are filled with the bounding box information for the | |
447 | character. If any of \fIxPtr\fR, \fIyPtr\fR, \fIwidthPtr\fR, or | |
448 | \fIheightPtr\fR are NULL, the corresponding value is not calculated or | |
449 | stored. | |
450 | .PP | |
451 | \fBTk_DistanceToTextLayout\fR computes the shortest distance in pixels from | |
452 | the given point (\fIx, y\fR) to the characters in \fIlayout\fR. | |
453 | Newline/return characters and non-displaying space characters that occur at | |
454 | the end of individual lines in the text layout are ignored for hit detection | |
455 | purposes, but tab characters are not. The return value is 0 if the point | |
456 | actually hits the \fIlayout\fR. If the point didn't hit the \fIlayout\fR | |
457 | then the return value is the distance in pixels from the point to the | |
458 | \fIlayout\fR. | |
459 | .PP | |
460 | \fBTk_IntersectTextLayout\fR determines whether a \fIlayout\fR lies | |
461 | entirely inside, entirely outside, or overlaps a given rectangle. | |
462 | Newline/return characters and non-displaying space characters that occur | |
463 | at the end of individual lines in the \fIlayout\fR are ignored for | |
464 | intersection calculations. The return value is \-1 if the \fIlayout\fR is | |
465 | entirely outside of the rectangle, 0 if it overlaps, and 1 if it is | |
466 | entirely inside of the rectangle. | |
467 | .PP | |
468 | \fBTk_TextLayoutToPostscript\fR outputs code consisting of a Postscript | |
469 | array of strings that represent the individual lines in \fIlayout\fR. It | |
470 | is the responsibility of the caller to take the Postscript array of | |
471 | strings and add some Postscript function operate on the array to render | |
472 | each of the lines. The code that represents the Postscript array of | |
473 | strings is appended to \fIinterp->result\fR. | |
474 | .PP | |
475 | .SH DISPLAY MODEL | |
476 | When measuring a text layout, space characters that occur at the end of a | |
477 | line are ignored. The space characters still exist and the insertion point | |
478 | can be positioned amongst them, but their additional width is ignored when | |
479 | justifying lines or returning the total width of a text layout. All | |
480 | end-of-line space characters are considered to be attached to the right edge | |
481 | of the line; this behavior is logical for left-justified text and reasonable | |
482 | for center-justified text, but not very useful when editing right-justified | |
483 | text. Spaces are considered variable width characters; the first space that | |
484 | extends past the edge of the text layout is clipped to the edge, and any | |
485 | subsequent spaces on the line are considered zero width and pegged against | |
486 | the edge. Space characters that occur in the middle of a line of text are | |
487 | not suppressed and occupy their normal space width. | |
488 | .PP | |
489 | Tab characters are not ignored for measurement calculations. If wrapping | |
490 | is turned on and there are enough tabs on a line, the next tab will wrap | |
491 | to the beginning of the next line. There are some possible strange | |
492 | interactions between tabs and justification; tab positions are calculated | |
493 | and the line length computed in a left-justified world, and then the | |
494 | whole resulting line is shifted so it is centered or right-justified, | |
495 | causing the tab columns not to align any more. | |
496 | .PP | |
497 | When wrapping is turned on, lines may wrap at word breaks (space or tab | |
498 | characters) or newline/returns. A dash or hyphen character in the middle | |
499 | of a word is not considered a word break. \fBTk_ComputeTextLayout\fR | |
500 | always attempts to place at least one word on each line. If it cannot | |
501 | because the \fIwrapLength\fR is too small, the word will be broken and as | |
502 | much as fits placed on the line and the rest on subsequent line(s). If | |
503 | \fIwrapLength\fR is so small that not even one character can fit on a | |
504 | given line, the \fIwrapLength\fR is ignored for that line and one | |
505 | character will be placed on the line anyhow. When wrapping is turned | |
506 | off, only newline/return characters may cause a line break. | |
507 | .PP | |
508 | When a text layout has been created using an underlined \fItkfont\fR, | |
509 | then any space characters that occur at the end of individual lines, | |
510 | newlines/returns, and tabs will not be displayed underlined when | |
511 | \fBTk_DrawTextLayout\fR is called, because those characters are never | |
512 | actually drawn \- they are merely placeholders maintained in the | |
513 | \fIlayout\fR. | |
514 | .SH KEYWORDS | |
515 | font |