code: 9ferno

ref: caef73363f896a1405ce6b9b6435f91e47a9b188
dir: /libdraw/getsubfont.c/

View raw version
#include "lib9.h"
#include "kernel.h"
#include "draw.h"

 * Default version: treat as file name

_getsubfont(Display *d, char *name)
	int fd;
	Subfont *f;

	fd = libopen(name, OREAD);
	if(fd < 0){
		_drawprint(2, "getsubfont: can't open %s: %r\n", name);
		return 0;
	 * unlock display so i/o happens with display released, unless
	 * user is doing his own locking, in which case this could break things.
	 * _getsubfont is called only from string.c and stringwidth.c,
	 * which are known to be safe to have this done.
	if(d->local == 0)
	f = readsubfont(d, name, fd, d->local == 0);
	if(d->local == 0)
	if(f == 0)
		_drawprint(2, "getsubfont: can't read %s: %r\n", name);
	return f;