|
|
1.1 root 1: #include <u.h>
2: #include <libc.h>
3: #include <libg.h>
4: #include <gnot.h>
5:
6: Point
7: gsubfstring(GBitmap *b, Point p, GSubfont *f, char *cs, Fcode fc)
8: {
9: int w, width;
10: int full;
11: uchar *s;
12: Rectangle r;
13: Rune c;
14: Fontchar *i;
15:
16: s = (uchar*)cs;
17: fc &= F;
18: full = fc==S || fc==notS; /* for reverse-video */
19: if(full){
20: r.min.y = 0;
21: r.max.y = f->height;
22: }
23: for(; c=*s; p.x+=width){
24: width = 0;
25: if(c < Runeself)
26: s++;
27: else{
28: w = chartorune(&c, (char*)s);
29: if(w == 0){
30: s++;
31: continue;
32: }
33: s += w;
34: }
35: if(c >= f->n)
36: continue;
37: i = f->info+c;
38: width = i->width;
39: if(!full){
40: r.min.y = i->top;
41: r.max.y = i->bottom;
42: }
43: r.min.x = i[0].x;
44: r.max.x = i[1].x;
45: gbitblt(b, Pt(p.x+i->left, p.y+r.min.y), f->bits, r, fc);
46: }
47: return p;
48: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.