69 lines · 1.4 KB · Text
RawDownload
.TH STRINGSIZE 2.SH NAMEstringsize, 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.BPoint	stringsize(Font *f, char *s).PP.Bint	stringwidth(Font *f, char *s).PP.Bint	stringnwidth(Font *f, char *s, int n).PP.BPoint	runestringsize(Font *f, Rune *s).PP.Bint	runestringwidth(Font *f, Rune *s).PP.Bint	runestringnwidth(Font *f, Rune *s, int n).SH DESCRIPTIONThese routines compute the geometrical extent of character strings when drawn on the display.  The most straightforward,.BR stringsize ,returns a.B Pointrepresenting the vector from upper left to lower right of the NUL-terminated string.I sdrawn in font.IR f ..B Stringwidthreturns just the.I xcomponent..B Stringnwidthreturns the width of the first.I ncharacters of.IR s ..PPThe routines beginning with.B runeare 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 DIAGNOSTICSBecause strings are loaded dynamically, these routines may generate I/Oto the server and produce calls to the graphics error function.