Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_posix/sys/src/cmd/unix/drawterm/libmemdraw/string.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <draw.h>
4
#include <memdraw.h>
5
#include <memlayer.h>
6
 
7
Point
8
memimagestring(Memimage *b, Point p, Memimage *color, Point cp, Memsubfont *f, char *cs)
9
{
10
	int w, width;
11
	uchar *s;
12
	Rune c;
13
	Fontchar *i;
14
 
15
	s = (uchar*)cs;
16
	for(; (c=*s); p.x+=width, cp.x+=width){
17
		width = 0;
18
		if(c < Runeself)
19
			s++;
20
		else{
21
			w = chartorune(&c, (char*)s);
22
			if(w == 0){
23
				s++;
24
				continue;
25
			}
26
			s += w;
27
		}
28
		if(c >= f->n)
29
			continue;
30
//		i = f->info+c;
31
		i = &(f->info[c]);
32
		width = i->width;
33
		memdraw(b, Rect(p.x+i->left, p.y+i->top, p.x+i->left+(i[1].x-i[0].x), p.y+i->bottom),
34
			color, cp, f->bits, Pt(i->x, i->top), SoverD);
35
	}
36
	return p;
37
}
38
 
39
Point
40
memsubfontwidth(Memsubfont *f, char *cs)
41
{
42
	Rune c;
43
	Point p;
44
	uchar *s;
45
	Fontchar *i;
46
	int w, width;
47
 
48
	p = Pt(0, f->height);
49
	s = (uchar*)cs;
50
	for(; (c=*s); p.x+=width){
51
		width = 0;
52
		if(c < Runeself)
53
			s++;
54
		else{
55
			w = chartorune(&c, (char*)s);
56
			if(w == 0){
57
				s++;
58
				continue;
59
			}
60
			s += w;
61
		}
62
		if(c >= f->n)
63
			continue;
64
		i = f->info+c;
65
		width = i->width;
66
	}
67
	return p;
68
}