File:  [Plan 9 NeXT] / lucent / sys / src / libgnot / f003244
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 18:01:05 2018 UTC (8 years, 1 month ago) by root
Branches: lucent, MAIN
CVS tags: plan9, HEAD
Plan 9 NeXT

#include <u.h>
#include <libc.h>
#include <libg.h>
#include <gnot.h>

Point
gsubfstring(GBitmap *b, Point p, GSubfont *f, char *cs, Fcode fc)
{
	int w, width;
	int full;
	uchar *s;
	Rectangle r;
	Rune c;
	Fontchar *i;

	s = (uchar*)cs;
	fc &= F;
	full = fc==S || fc==notS;	/* for reverse-video */
	if(full){
		r.min.y = 0;
		r.max.y = f->height;
	}
	for(; c=*s; p.x+=width){
		width = 0;
		if(c < Runeself)
			s++;
		else{
			w = chartorune(&c, (char*)s);
			if(w == 0){
				s++;
				continue;
			}
			s += w;
		}
		if(c >= f->n)
			continue;
		i = f->info+c;
		width = i->width;
		if(!full){
			r.min.y = i->top;
			r.max.y = i->bottom;
		}
		r.min.x = i[0].x;
		r.max.x = i[1].x;
		gbitblt(b, Pt(p.x+i->left, p.y+r.min.y), f->bits, r, fc);
	}
	return p;
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.