rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 1 | .TH STRINGSIZE 3 |
| 2 | .SH NAME |
| 3 | stringsize, stringwidth, stringnwidth, runestringsize, runestringwidth, runestringnwidth \- graphical size of strings |
| 4 | .SH SYNOPSIS |
| 5 | .nf |
| 6 | .PP |
| 7 | .ft L |
| 8 | #include <u.h> |
| 9 | #include <libc.h> |
| 10 | #include <draw.h> |
| 11 | .ft P |
| 12 | .ta \w'\fLPoint 'u |
| 13 | .PP |
| 14 | .B |
| 15 | Point stringsize(Font *f, char *s) |
| 16 | .PP |
| 17 | .B |
| 18 | int stringwidth(Font *f, char *s) |
| 19 | .PP |
| 20 | .B |
| 21 | int stringnwidth(Font *f, char *s, int n) |
| 22 | .PP |
| 23 | .B |
| 24 | Point runestringsize(Font *f, Rune *s) |
| 25 | .PP |
| 26 | .B |
| 27 | int runestringwidth(Font *f, Rune *s) |
| 28 | .PP |
| 29 | .B |
| 30 | int runestringnwidth(Font *f, Rune *s, int n) |
| 31 | .SH DESCRIPTION |
| 32 | These routines compute the geometrical extent of character strings when drawn on the display. The most straightforward, |
| 33 | .BR stringsize , |
| 34 | returns a |
| 35 | .B Point |
| 36 | representing the vector from upper left to lower right of the NUL-terminated string |
| 37 | .I s |
| 38 | drawn in font |
| 39 | .IR f . |
| 40 | .B Stringwidth |
| 41 | returns just the |
| 42 | .I x |
| 43 | component. |
| 44 | .B Stringnwidth |
| 45 | returns the width of the first |
| 46 | .I n |
| 47 | characters of |
| 48 | .IR s . |
| 49 | .PP |
| 50 | The routines beginning with |
| 51 | .B rune |
| 52 | are analogous, but accept an array of runes rather than |
| 53 | .SM UTF\c |
| 54 | -encoded bytes. |
| 55 | .SH FILES |
| 56 | .BR /lib/font/bit " directory of fonts |
| 57 | .SH SOURCE |
rsc | b5fdffe | 2004-04-19 19:22:56 +0000 | [diff] [blame] | 58 | .B /usr/local/plan9/src/libdraw |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 59 | .SH "SEE ALSO" |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 60 | .IR addpt (3), |
| 61 | .IR cachechars (3), |
| 62 | .IR subfont (3), |
| 63 | .IR draw (3), |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 64 | .IR draw (3), |
| 65 | .IR image (6), |
| 66 | .IR font (6) |
| 67 | .SH DIAGNOSTICS |
| 68 | Because strings are loaded dynamically, these routines may generate I/O |
| 69 | to the server and produce calls to the graphics error function. |