aboutsummaryrefslogtreecommitdiff
path: root/man/man3/stringsize.3
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-04-10 18:53:55 +0000
committerrsc <devnull@localhost>2004-04-10 18:53:55 +0000
commitcfa37a7b1131abbab2e7d339b451f5f0e3198cc8 (patch)
treea7fe52416e9d27efe2af2d54910112674c0fd7c6 /man/man3/stringsize.3
parent08df2a433e69c94f9db002c83380cb2b693fee60 (diff)
downloadplan9port-cfa37a7b1131abbab2e7d339b451f5f0e3198cc8.tar.gz
plan9port-cfa37a7b1131abbab2e7d339b451f5f0e3198cc8.tar.bz2
plan9port-cfa37a7b1131abbab2e7d339b451f5f0e3198cc8.zip
Lots of man pages.
Diffstat (limited to 'man/man3/stringsize.3')
-rw-r--r--man/man3/stringsize.369
1 files changed, 69 insertions, 0 deletions
diff --git a/man/man3/stringsize.3 b/man/man3/stringsize.3
new file mode 100644
index 00000000..3ae28231
--- /dev/null
+++ b/man/man3/stringsize.3
@@ -0,0 +1,69 @@
+.TH STRINGSIZE 3
+.SH NAME
+stringsize, stringwidth, stringnwidth, runestringsize, runestringwidth, runestringnwidth \- graphical size of strings
+.SH SYNOPSIS
+.nf
+.PP
+.ft L
+#include <u.h>
+#include <libc.h>
+#include <draw.h>
+.ft P
+.ta \w'\fLPoint 'u
+.PP
+.B
+Point stringsize(Font *f, char *s)
+.PP
+.B
+int stringwidth(Font *f, char *s)
+.PP
+.B
+int stringnwidth(Font *f, char *s, int n)
+.PP
+.B
+Point runestringsize(Font *f, Rune *s)
+.PP
+.B
+int runestringwidth(Font *f, Rune *s)
+.PP
+.B
+int runestringnwidth(Font *f, Rune *s, int n)
+.SH DESCRIPTION
+These routines compute the geometrical extent of character strings when drawn on the display. The most straightforward,
+.BR stringsize ,
+returns a
+.B Point
+representing the vector from upper left to lower right of the NUL-terminated string
+.I s
+drawn in font
+.IR f .
+.B Stringwidth
+returns just the
+.I x
+component.
+.B Stringnwidth
+returns the width of the first
+.I n
+characters of
+.IR s .
+.PP
+The routines beginning with
+.B rune
+are analogous, but accept an array of runes rather than
+.SM UTF\c
+-encoded bytes.
+.SH FILES
+.BR /lib/font/bit " directory of fonts
+.SH SOURCE
+.B /sys/src/libdraw
+.SH "SEE ALSO"
+.IR addpt (2),
+.IR cachechars (2),
+.IR subfont (2),
+.IR draw (2),
+.IR draw (3),
+.IR image (6),
+.IR font (6)
+.SH DIAGNOSTICS
+Because strings are loaded dynamically, these routines may generate I/O
+to the server and produce calls to the graphics error function.