henesyinit from p9f47575dc5 years agoHistory
28 lines · 391 B · C
RawDownload
#include <u.h>#include <libc.h>#include <libg.h> longstrwidth(Font *f, char *s){	int wid, twid, n;	enum { Max = 128 };	ushort cbuf[Max]; 	twid = 0;	while(*s){		n = 0;		while(cachechars(f, &s, cbuf, Max, &wid) <= 0)			if(++n > 10)				berror("strwidth");		agefont(f);		twid += wid;	}	return twid;} Pointstrsize(Font *f, char *s){	return Pt(strwidth(f, s), f->height);}