ref: 628dbef470f318d598ffc0b1eca50c4f4986997c
parent: f42963da048fb40a82ed4be55ddf464aa6089b83
author: halfwit <michaelmisch1985@gmail.com>
date: Thu Oct 15 09:06:27 PDT 2020
Add in a few more, see where we're at
--- /dev/null
+++ b/libdraw/buildfont.c
@@ -1,0 +1,138 @@
+#include "draw.h"
+
+static char*
+skip(char *s)
+{
+ while(*s==' ' || *s=='\n' || *s=='\t')
+ s++;
+ return s;
+}
+
+_Font*
+buildfont(Display *d, char *buf, char *name)
+{
+ _Font *fnt;
+ Cachefont *c, **sub;
+ char *s, *t;
+ ulong min, max;
+ int offset;
+ char badform[] = "bad font format: number expected (char position %d)";
+
+ s = buf;
+ fnt = malloc(sizeof(_Font));
+ if(fnt == nil)
+ return nil;
+ memset(fnt, 0, sizeof(_Font));
+ fnt->display = d;
+ fnt->name = strdup(name);
+ fnt->ncache = NFCACHE+NFLOOK;
+ fnt->nsubf = NFSUBF;
+ fnt->cache = malloc(fnt->ncache * sizeof(fnt->cache[0]));
+ fnt->subf = malloc(fnt->nsubf * sizeof(fnt->subf[0]));
+ if(fnt->name==nil || fnt->cache==nil || fnt->subf==nil){
+ Err2:
+ free(fnt->name);
+ free(fnt->cache);
+ free(fnt->subf);
+ free(fnt->sub);
+ free(fnt);
+ return nil;
+ }
+ fnt->height = strtol(s, &s, 0);
+ s = skip(s);
+ fnt->ascent = strtol(s, &s, 0);
+ s = skip(s);
+ if(fnt->height<=0 || fnt->ascent<=0){
+ werrstr("bad height or ascent in font file");
+ goto Err2;
+ }
+ fnt->width = 0;
+ fnt->nsub = 0;
+ fnt->sub = nil;
+
+ memset(fnt->subf, 0, fnt->nsubf * sizeof(fnt->subf[0]));
+ memset(fnt->cache, 0, fnt->ncache*sizeof(fnt->cache[0]));
+ fnt->age = 1;
+ do{
+ /* must be looking at a number now */
+ if(*s<'0' || '9'<*s){
+ werrstr(badform, s-buf);
+ goto Err3;
+ }
+ min = strtol(s, &s, 0);
+ s = skip(s);
+ /* must be looking at a number now */
+ if(*s<'0' || '9'<*s){
+ werrstr(badform, s-buf);
+ goto Err3;
+ }
+ max = strtol(s, &s, 0);
+ s = skip(s);
+ if(*s==0 || min>Runemax || max>Runemax || min>max){
+ werrstr("illegal subfont range");
+ Err3:
+ freefont(fnt);
+ return 0;
+ }
+ t = s;
+ offset = strtol(s, &t, 0);
+ if(t>s && (*t==' ' || *t=='\t' || *t=='\n'))
+ s = skip(t);
+ else
+ offset = 0;
+ sub = realloc(fnt->sub, (fnt->nsub+1)*sizeof(Cachefont*));
+ if(sub == nil)
+ goto Err3;
+ fnt->sub = sub;
+ c = malloc(sizeof(Cachefont));
+ if(c == nil)
+ goto Err3;
+ c->min = min;
+ c->max = max;
+ c->offset = offset;
+ t = s;
+ while(*s && *s!=' ' && *s!='\n' && *s!='\t')
+ s++;
+ *s++ = 0;
+ c->subfontname = nil;
+ c->name = strdup(t);
+ if(c->name == nil){
+ free(c);
+ goto Err3;
+ }
+ sub[fnt->nsub++] = c;
+ s = skip(s);
+ }while(*s);
+ return fnt;
+}
+
+void
+freefont(_Font *f)
+{
+ int i;
+ Cachefont *c;
+ Subfont *s;
+
+ if(f == nil)
+ return;
+
+ for(i=0; i<f->nsub; i++){
+ c = f->sub[i];
+ free(c->subfontname);
+ free(c->name);
+ free(c);
+ }
+ for(i=0; i<f->nsubf; i++){
+ s = f->subf[i].f;
+ if(s != nil){
+ if(f->display == nil || s != f->display->defaultsubfont)
+ freesubfont(s);
+ }
+ }
+ freeimage(f->cacheimage);
+ free(f->name);
+ free(f->cache);
+ free(f->subf);
+ free(f->sub);
+ free(f);
+}
--- /dev/null
+++ b/libdraw/chan.c
@@ -1,0 +1,79 @@
+#include "draw.h"
+
+static char channames[] = "rgbkamx";
+char*
+chantostr(char *buf, ulong cc)
+{
+ ulong c, rc;
+ char *p;
+
+ if(chantodepth(cc) == 0)
+ return nil;
+
+ /* reverse the channel descriptor so we can easily generate the string in the right order */
+ rc = 0;
+ for(c=cc; c; c>>=8){
+ rc <<= 8;
+ rc |= c&0xFF;
+ }
+
+ p = buf;
+ for(c=rc; c; c>>=8) {
+ *p++ = channames[TYPE(c)];
+ *p++ = '0'+NBITS(c);
+ }
+ *p = 0;
+
+ return buf;
+}
+
+/* avoid pulling in ctype when using with drawterm etc. */
+static int
+isspace(char c)
+{
+ return c==' ' || c== '\t' || c=='\r' || c=='\n';
+}
+
+ulong
+strtochan(char *s)
+{
+ char *p, *q;
+ ulong c;
+ int t, n, d;
+
+ c = 0;
+ d = 0;
+ p=s;
+ while(*p && isspace(*p))
+ p++;
+
+ while(*p && !isspace(*p)){
+ if((q = strchr(channames, p[0])) == nil)
+ return 0;
+ t = q-channames;
+ if(p[1] < '0' || p[1] > '9')
+ return 0;
+ n = p[1]-'0';
+ d += n;
+ c = (c<<8) | __DC(t, n);
+ p += 2;
+ }
+ if(d==0 || (d>8 && d%8) || (d<8 && 8%d))
+ return 0;
+ return c;
+}
+
+int
+chantodepth(ulong c)
+{
+ int n;
+
+ for(n=0; c; c>>=8){
+ if(TYPE(c) >= NChan || NBITS(c) > 8 || NBITS(c) <= 0)
+ return 0;
+ n += NBITS(c);
+ }
+ if(n==0 || (n>8 && n%8) || (n<8 && 8%n))
+ return 0;
+ return n;
+}
--- /dev/null
+++ b/libdraw/defont.c
@@ -1,0 +1,386 @@
+#include "draw.h"
+
+/*
+ * vga/vga00, in uncompressed form
+ */
+uchar
+defontdata[] =
+{
+0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x30,0x20,0x20,0x20,0x20,0x20,
+0x20,0x20,0x20,0x20,0x20,0x20,0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+0x20,0x20,0x30,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x32,0x30,0x34,0x38,0x20,
+0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x31,0x36,0x20,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x30,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x0c,0x10,0x76,
+0x6c,0x38,0x00,0x00,0x30,0x0c,0x10,0x6c,0x30,0x0c,0x18,0x66,0x00,0x76,0x60,0x0c,
+0x10,0x76,0x6c,0x00,0x00,0x60,0x0c,0x10,0x6c,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xe0,
+0xe0,0xe0,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xe0,0xe0,0xe0,
+0xe0,0x90,0x70,0xe0,0x70,0x00,0x70,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x00,
+0x18,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x30,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x38,
+0x00,0x00,0x00,0x7c,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x70,0x70,
+0x00,0x00,0x00,0x00,0x00,0x30,0x38,0x00,0xc0,0xc0,0xe0,0x00,0x30,0x18,0x38,0xdc,
+0x6c,0x6c,0x00,0x00,0x18,0x18,0x38,0x6c,0x18,0x18,0x3c,0x66,0x00,0xdc,0x30,0x18,
+0x38,0xdc,0x6c,0x00,0x00,0x30,0x18,0x38,0x6c,0x18,0x00,0x00,0x00,0x00,0x10,0x00,
+0x00,0x38,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,
+0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0xda,0x00,0x80,0x80,
+0x80,0x80,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x90,0x90,0x90,
+0x90,0xd0,0x80,0x80,0x90,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x18,0x66,0x00,
+0x7c,0x00,0x38,0x30,0x0c,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x18,0x7c,0x7c,
+0x0c,0xfe,0x38,0xfe,0x7c,0x7c,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x10,0xfc,0x3c,
+0xf8,0xfe,0xfe,0x3c,0xc6,0x3c,0x1e,0xe6,0xf0,0xc6,0xc6,0x7c,0xfc,0x7c,0xfc,0x7c,
+0x7e,0xc6,0xc6,0xc6,0xc6,0x66,0xfe,0x3c,0x00,0x3c,0x6c,0x00,0x18,0x00,0xe0,0x00,
+0x1c,0x00,0x38,0x00,0xe0,0x18,0x06,0xe0,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x18,0x70,0x76,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x6c,
+0x00,0x66,0x18,0xc6,0x6c,0x3c,0x6c,0x00,0x00,0x00,0x38,0x00,0x6c,0x00,0xd8,0xd8,
+0x0c,0x00,0x7f,0x00,0x00,0x70,0x6c,0x00,0xc0,0xc0,0x30,0x30,0x00,0x00,0x6c,0x00,
+0x00,0x38,0x3e,0x3c,0x00,0x00,0x44,0x00,0x00,0x00,0x42,0x00,0xf8,0x00,0x00,0x00,
+0x44,0x00,0x00,0x00,0x7a,0x00,0x00,0x44,0x00,0x00,0xf0,0x3c,0x60,0x18,0x38,0x76,
+0x6c,0x6c,0x00,0x00,0x60,0x0c,0x38,0x6c,0x30,0x0c,0x38,0x66,0x76,0x76,0x60,0x0c,
+0x38,0x76,0x6c,0x00,0x00,0x60,0x18,0x38,0xcc,0x0c,0xe0,0x6c,0x02,0x00,0xe0,0xe0,
+0xe0,0xe0,0xf0,0x18,0x70,0x48,0x20,0x48,0x70,0x38,0x38,0x38,0x90,0x90,0x90,0x90,
+0x90,0xb0,0x60,0xe0,0x80,0xe0,0x60,0xe0,0x70,0x38,0x70,0x48,0x00,0x3c,0x66,0x6c,
+0xc6,0x00,0x6c,0x30,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x38,0xc6,0xc6,
+0x1c,0xc0,0x60,0xc6,0xc6,0xc6,0x00,0x00,0x06,0x00,0x60,0xc6,0x7c,0x38,0x66,0x66,
+0x6c,0x66,0x66,0x66,0xc6,0x18,0x0c,0x66,0x60,0xee,0xe6,0xc6,0x66,0xc6,0x66,0xc6,
+0x7e,0xc6,0xc6,0xc6,0xc6,0x66,0xc6,0x30,0x80,0x0c,0xc6,0x00,0x00,0x00,0x60,0x00,
+0x0c,0x00,0x6c,0x00,0x60,0x18,0x06,0x60,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xdc,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3c,0x64,
+0x00,0x66,0x18,0x60,0x6c,0x42,0x6c,0x00,0x00,0x00,0x44,0x7c,0x6c,0x00,0x30,0x30,
+0x18,0x00,0xdb,0x00,0x00,0x30,0x6c,0x00,0xc2,0xc2,0x62,0x30,0x10,0x10,0x10,0x10,
+0x10,0x10,0x6c,0x66,0xfe,0xfe,0xfe,0xfe,0x3c,0x3c,0x3c,0x3c,0x6c,0xc6,0x7c,0x7c,
+0x7c,0x7c,0x7c,0x00,0xc4,0xc6,0xc6,0xc6,0xc6,0x66,0x60,0x66,0x30,0x30,0x6c,0xdc,
+0x6c,0x38,0x00,0x00,0x30,0x18,0x6c,0x6c,0x18,0x18,0x6c,0x66,0x1c,0xdc,0x30,0x18,
+0x6c,0xdc,0x6c,0x00,0x00,0x30,0x30,0x6c,0xcc,0x18,0x60,0x6c,0x80,0x00,0x10,0x80,
+0x80,0x80,0x90,0x3c,0x48,0x48,0x20,0x48,0x40,0x48,0x40,0x40,0x90,0x90,0x90,0x90,
+0x90,0x90,0x10,0x80,0x80,0x80,0x10,0x80,0x40,0x40,0x48,0x48,0x00,0x3c,0x24,0x6c,
+0xc2,0xc2,0x6c,0x20,0x30,0x0c,0x00,0x00,0x00,0x00,0x00,0x02,0xc6,0x78,0x06,0x06,
+0x3c,0xc0,0xc0,0x06,0xc6,0xc6,0x18,0x18,0x0c,0x00,0x30,0xc6,0xc6,0x6c,0x66,0xc2,
+0x66,0x62,0x62,0xc2,0xc6,0x18,0x0c,0x66,0x60,0xfe,0xf6,0xc6,0x66,0xc6,0x66,0xc6,
+0x5a,0xc6,0xc6,0xc6,0x6c,0x66,0x86,0x30,0xc0,0x0c,0x00,0x00,0x00,0x00,0x60,0x00,
+0x0c,0x00,0x64,0x00,0x60,0x00,0x00,0x60,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x00,0x10,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x60,
+0x66,0x3c,0x18,0x38,0x00,0x99,0x3e,0x00,0x00,0x00,0xba,0x00,0x38,0x18,0x60,0x18,
+0x00,0x00,0xdb,0x00,0x00,0x30,0x38,0x00,0xc6,0xc6,0x36,0x00,0x38,0x38,0x38,0x38,
+0x38,0x38,0xcc,0xc2,0x66,0x66,0x66,0x66,0x18,0x18,0x18,0x18,0x66,0xe6,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x00,0xce,0xc6,0xc6,0xc6,0xc6,0x66,0x7c,0x66,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,
+0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x82,0x00,0xe0,0xe0,
+0xe0,0xe0,0x90,0x3c,0x70,0x78,0x20,0x48,0x70,0x40,0x30,0x30,0xe0,0xe0,0xe0,0xe0,
+0xe0,0x90,0xe0,0xe0,0x70,0xe0,0xe0,0xe0,0x70,0x58,0x70,0x48,0x00,0x3c,0x00,0xfe,
+0xc0,0xc6,0x38,0x00,0x30,0x0c,0x66,0x18,0x00,0x00,0x00,0x06,0xc6,0x18,0x0c,0x06,
+0x6c,0xc0,0xc0,0x06,0xc6,0xc6,0x18,0x18,0x18,0x7e,0x18,0x0c,0xc6,0xc6,0x66,0xc0,
+0x66,0x68,0x68,0xc0,0xc6,0x18,0x0c,0x6c,0x60,0xfe,0xfe,0xc6,0x66,0xc6,0x66,0x60,
+0x18,0xc6,0xc6,0xc6,0x7c,0x66,0x0c,0x30,0xe0,0x0c,0x00,0x00,0x00,0x78,0x78,0x7c,
+0x3c,0x7c,0x60,0x76,0x6c,0x38,0x0e,0x66,0x18,0xec,0xdc,0x7c,0xdc,0x76,0xdc,0x7c,
+0xfc,0xcc,0x66,0xc6,0xc6,0xc6,0xfe,0x18,0x18,0x18,0x00,0x38,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x60,0xf0,
+0x3c,0x18,0x18,0x6c,0x00,0xa5,0x00,0x36,0x00,0x00,0xb2,0x00,0x00,0x18,0xc8,0xd8,
+0x00,0xcc,0xdb,0x00,0x00,0x30,0x00,0xd8,0xcc,0xcc,0xec,0x30,0x6c,0x6c,0x6c,0x6c,
+0x6c,0x6c,0xcc,0xc0,0x62,0x62,0x62,0x62,0x18,0x18,0x18,0x18,0x66,0xf6,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x66,0xce,0xc6,0xc6,0xc6,0xc6,0x66,0x66,0x66,0x78,0x78,0x78,0x78,
+0x78,0x78,0xcc,0x7c,0x7c,0x7c,0x7c,0x7c,0x38,0x38,0x38,0x38,0x06,0xdc,0x7c,0x7c,
+0x7c,0x7c,0x7c,0x18,0x7a,0xcc,0xcc,0xcc,0xcc,0xc6,0x7c,0xc6,0x02,0x00,0x1c,0x1c,
+0x18,0x24,0x1c,0x3c,0x48,0x48,0x20,0x30,0x40,0x40,0x08,0x08,0x10,0x1c,0x1c,0x1c,
+0x1c,0x0c,0x44,0x1c,0x0c,0x80,0x24,0x1c,0x40,0x48,0x50,0x48,0x00,0x18,0x00,0x6c,
+0x7c,0x0c,0x76,0x00,0x30,0x0c,0x3c,0x18,0x00,0x00,0x00,0x0c,0xd6,0x18,0x18,0x3c,
+0xcc,0xfc,0xfc,0x0c,0x7c,0x7e,0x00,0x00,0x30,0x00,0x0c,0x18,0xde,0xc6,0x7c,0xc0,
+0x66,0x78,0x78,0xc0,0xfe,0x18,0x0c,0x78,0x60,0xd6,0xde,0xc6,0x7c,0xc6,0x7c,0x38,
+0x18,0xc6,0xc6,0xd6,0x38,0x3c,0x18,0x30,0x70,0x0c,0x00,0x00,0x00,0x0c,0x6c,0xc6,
+0x6c,0xc6,0xf0,0xcc,0x76,0x18,0x06,0x6c,0x18,0xfe,0x66,0xc6,0x66,0xcc,0x76,0xc6,
+0x30,0xcc,0x66,0xc6,0x6c,0xc6,0xcc,0x70,0x00,0x0e,0x00,0x6c,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x60,0x60,
+0x66,0x7e,0x00,0xc6,0x00,0xa1,0x7e,0x6c,0xfe,0x00,0xaa,0x00,0x00,0x7e,0xf8,0x70,
+0x00,0xcc,0x7b,0x00,0x00,0x78,0x7c,0x6c,0x18,0x18,0x18,0x30,0xc6,0xc6,0xc6,0xc6,
+0xc6,0xc6,0xfe,0xc0,0x68,0x68,0x68,0x68,0x18,0x18,0x18,0x18,0xf6,0xfe,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x3c,0xd6,0xc6,0xc6,0xc6,0xc6,0x3c,0x66,0x6c,0x0c,0x0c,0x0c,0x0c,
+0x0c,0x0c,0x76,0xc6,0xc6,0xc6,0xc6,0xc6,0x18,0x18,0x18,0x18,0x7e,0x66,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x00,0xc4,0xcc,0xcc,0xcc,0xcc,0xc6,0x66,0xc6,0x80,0x00,0x08,0x08,
+0x24,0x34,0x24,0x3c,0x70,0x48,0x38,0x30,0x40,0x38,0x70,0x70,0x10,0x24,0x24,0x24,
+0x24,0x12,0x28,0x08,0x12,0xe0,0x24,0x20,0x40,0x38,0x48,0x30,0x00,0x18,0x00,0x6c,
+0x06,0x18,0xdc,0x00,0x30,0x0c,0xff,0x7e,0x00,0xfe,0x00,0x18,0xd6,0x18,0x30,0x06,
+0xfe,0x06,0xc6,0x18,0xc6,0x06,0x00,0x00,0x60,0x00,0x06,0x18,0xde,0xfe,0x66,0xc0,
+0x66,0x68,0x68,0xde,0xc6,0x18,0x0c,0x78,0x60,0xc6,0xce,0xc6,0x60,0xc6,0x6c,0x0c,
+0x18,0xc6,0xc6,0xd6,0x38,0x18,0x30,0x30,0x38,0x0c,0x00,0x00,0x00,0x7c,0x66,0xc0,
+0xcc,0xfe,0x60,0xcc,0x66,0x18,0x06,0x78,0x18,0xd6,0x66,0xc6,0x66,0xcc,0x66,0x60,
+0x30,0xcc,0x66,0xd6,0x38,0xc6,0x18,0x18,0x18,0x18,0x00,0xc6,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x60,0x60,
+0x66,0x18,0x18,0xc6,0x00,0xa1,0x00,0xd8,0x06,0x3c,0x44,0x00,0x00,0x18,0x00,0x00,
+0x00,0xcc,0x1b,0x00,0x00,0x00,0x00,0x36,0x30,0x30,0x30,0x60,0xc6,0xc6,0xc6,0xc6,
+0xc6,0xc6,0xcc,0xc0,0x78,0x78,0x78,0x78,0x18,0x18,0x18,0x18,0x66,0xde,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x18,0xd6,0xc6,0xc6,0xc6,0xc6,0x18,0x66,0x66,0x7c,0x7c,0x7c,0x7c,
+0x7c,0x7c,0x36,0xc0,0xfe,0xfe,0xfe,0xfe,0x18,0x18,0x18,0x18,0xc6,0x66,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x7e,0xce,0xcc,0xcc,0xcc,0xcc,0xc6,0x66,0xc6,0x82,0x00,0x08,0x08,
+0x24,0x2c,0x20,0x66,0x07,0x07,0x07,0x07,0x0e,0x00,0x06,0x07,0x10,0x20,0x20,0x20,
+0x20,0x1e,0x10,0x08,0x1e,0x11,0x24,0x18,0x0e,0x07,0x07,0x07,0x00,0x18,0x00,0x6c,
+0x06,0x30,0xcc,0x00,0x30,0x0c,0x3c,0x18,0x00,0x00,0x00,0x30,0xc6,0x18,0x60,0x06,
+0x0c,0x06,0xc6,0x30,0xc6,0x06,0x00,0x00,0x30,0x7e,0x0c,0x18,0xde,0xc6,0x66,0xc0,
+0x66,0x60,0x60,0xc6,0xc6,0x18,0xcc,0x6c,0x60,0xc6,0xc6,0xc6,0x60,0xc6,0x66,0x06,
+0x18,0xc6,0xc6,0xd6,0x7c,0x18,0x60,0x30,0x1c,0x0c,0x00,0x00,0x00,0xcc,0x66,0xc0,
+0xcc,0xc0,0x60,0xcc,0x66,0x18,0x06,0x78,0x18,0xd6,0x66,0xc6,0x66,0xcc,0x60,0x38,
+0x30,0xcc,0x66,0xd6,0x38,0xc6,0x30,0x18,0x18,0x18,0x00,0xc6,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x66,0x60,
+0x66,0x7e,0x18,0x6c,0x00,0xa5,0x00,0x6c,0x06,0x00,0x38,0x00,0x00,0x18,0x00,0x00,
+0x00,0xcc,0x1b,0x18,0x00,0x00,0x00,0x6c,0x66,0x60,0x66,0xc0,0xfe,0xfe,0xfe,0xfe,
+0xfe,0xfe,0xcc,0xc0,0x68,0x68,0x68,0x68,0x18,0x18,0x18,0x18,0x66,0xce,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x3c,0xe6,0xc6,0xc6,0xc6,0xc6,0x18,0x66,0x66,0xcc,0xcc,0xcc,0xcc,
+0xcc,0xcc,0x7e,0xc0,0xc0,0xc0,0xc0,0xc0,0x18,0x18,0x18,0x18,0xc6,0x66,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x00,0xd6,0xcc,0xcc,0xcc,0xcc,0xc6,0x66,0xc6,0x02,0x00,0x08,0x08,
+0x24,0x24,0x20,0xc3,0x08,0x02,0x04,0x02,0x08,0x0e,0x09,0x02,0x10,0x20,0x20,0x20,
+0x20,0x12,0x10,0x08,0x12,0x1b,0x24,0x04,0x10,0x08,0x08,0x08,0x00,0x00,0x00,0xfe,
+0x86,0x60,0xcc,0x00,0x30,0x0c,0x66,0x18,0x18,0x00,0x00,0x60,0xc6,0x18,0xc0,0x06,
+0x0c,0x06,0xc6,0x30,0xc6,0x06,0x18,0x18,0x18,0x00,0x18,0x00,0xdc,0xc6,0x66,0xc2,
+0x66,0x62,0x60,0xc6,0xc6,0x18,0xcc,0x66,0x62,0xc6,0xc6,0xc6,0x60,0xd6,0x66,0xc6,
+0x18,0xc6,0x6c,0xfe,0x6c,0x18,0xc2,0x30,0x0e,0x0c,0x00,0x00,0x00,0xcc,0x66,0xc0,
+0xcc,0xc0,0x60,0xcc,0x66,0x18,0x06,0x6c,0x18,0xd6,0x66,0xc6,0x66,0xcc,0x60,0x0c,
+0x30,0xcc,0x66,0xd6,0x38,0xc6,0x60,0x18,0x18,0x18,0x00,0xc6,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x3c,0x60,
+0x3c,0x18,0x18,0x38,0x00,0x99,0x00,0x36,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0xcc,0x1b,0x00,0x00,0x00,0x00,0xd8,0xce,0xdc,0xce,0xc6,0xc6,0xc6,0xc6,0xc6,
+0xc6,0xc6,0xcc,0xc2,0x62,0x62,0x62,0x62,0x18,0x18,0x18,0x18,0x66,0xc6,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x66,0xe6,0xc6,0xc6,0xc6,0xc6,0x18,0x7c,0x66,0xcc,0xcc,0xcc,0xcc,
+0xcc,0xcc,0xd8,0xc0,0xc0,0xc0,0xc0,0xc0,0x18,0x18,0x18,0x18,0xc6,0x66,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x18,0xe6,0xcc,0xcc,0xcc,0xcc,0xc6,0x66,0xc6,0x80,0x00,0x08,0x08,
+0x18,0x24,0x1c,0xff,0x06,0x02,0x07,0x02,0x0e,0x09,0x09,0x02,0x1c,0x1c,0x1c,0x1c,
+0x1c,0x12,0x10,0x08,0x12,0x15,0x18,0x38,0x0c,0x06,0x06,0x06,0x00,0x18,0x00,0x6c,
+0xc6,0xc6,0xcc,0x00,0x18,0x18,0x00,0x00,0x18,0x00,0x18,0xc0,0x6c,0x18,0xc6,0xc6,
+0x0c,0xc6,0xc6,0x30,0xc6,0x0c,0x18,0x18,0x0c,0x00,0x30,0x18,0xc0,0xc6,0x66,0x66,
+0x6c,0x66,0x60,0x66,0xc6,0x18,0xcc,0x66,0x66,0xc6,0xc6,0xc6,0x60,0xde,0x66,0xc6,
+0x18,0xc6,0x38,0xee,0xc6,0x18,0xc6,0x30,0x06,0x0c,0x00,0x00,0x00,0xcc,0x66,0xc6,
+0xcc,0xc6,0x60,0xcc,0x66,0x18,0x06,0x66,0x18,0xd6,0x66,0xc6,0x66,0xcc,0x60,0xc6,
+0x36,0xcc,0x3c,0xfe,0x6c,0xc6,0xc6,0x18,0x18,0x18,0x00,0xfe,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x18,0xe6,
+0x66,0x18,0x18,0x0c,0x00,0x42,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,
+0x00,0xcc,0x1b,0x00,0x00,0x00,0x00,0x00,0x9e,0x86,0x9e,0xc6,0xc6,0xc6,0xc6,0xc6,
+0xc6,0xc6,0xcc,0x66,0x66,0x66,0x66,0x66,0x18,0x18,0x18,0x18,0x6c,0xc6,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x00,0x46,0xc6,0xc6,0xc6,0xc6,0x18,0x60,0x66,0xcc,0xcc,0xcc,0xcc,
+0xcc,0xcc,0xd8,0xc6,0xc6,0xc6,0xc6,0xc6,0x18,0x18,0x18,0x18,0xc6,0x66,0xc6,0xc6,
+0xc6,0xc6,0xc6,0x18,0x46,0xcc,0xcc,0xcc,0xcc,0xc6,0x66,0xc6,0xb6,0x00,0x05,0x05,
+0x07,0x0c,0x09,0x18,0x01,0x02,0x04,0x02,0x08,0x0e,0x09,0x02,0x07,0x02,0x06,0x06,
+0x02,0x09,0x09,0x0e,0x09,0x15,0x0e,0x07,0x02,0x01,0x01,0x01,0x00,0x18,0x00,0x6c,
+0x7c,0x86,0x76,0x00,0x0c,0x30,0x00,0x00,0x18,0x00,0x18,0x80,0x38,0x7e,0xfe,0x7c,
+0x1e,0x7c,0x7c,0x30,0x7c,0x78,0x00,0x30,0x06,0x00,0x60,0x18,0x7c,0xc6,0xfc,0x3c,
+0xf8,0xfe,0xf0,0x3a,0xc6,0x3c,0x78,0xe6,0xfe,0xc6,0xc6,0x7c,0xf0,0x7c,0xe6,0x7c,
+0x3c,0x7c,0x10,0x6c,0xc6,0x3c,0xfe,0x3c,0x02,0x3c,0x00,0x00,0x00,0x76,0x7c,0x7c,
+0x76,0x7c,0xf0,0x7c,0xe6,0x3c,0x06,0xe6,0x3c,0xc6,0x66,0x7c,0x7c,0x7c,0xf0,0x7c,
+0x1c,0x76,0x18,0x6c,0xc6,0x7e,0xfe,0x0e,0x18,0x70,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0xfc,
+0x00,0x18,0x18,0xc6,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0xf6,0x1b,0x00,0x00,0x00,0x00,0x00,0x3e,0x0c,0x3e,0x7c,0xc6,0xc6,0xc6,0xc6,
+0xc6,0xc6,0xce,0x3c,0xfe,0xfe,0xfe,0xfe,0x3c,0x3c,0x3c,0x3c,0xf8,0xc6,0x7c,0x7c,
+0x7c,0x7c,0x7c,0x00,0xbc,0x7c,0x7c,0x7c,0x7c,0x3c,0xf0,0xec,0x76,0x76,0x76,0x76,
+0x76,0x76,0x6e,0x7c,0x7c,0x7c,0x7c,0x7c,0x3c,0x3c,0x3c,0x3c,0x7c,0x66,0x7c,0x7c,
+0x7c,0x7c,0x7c,0x00,0xbc,0x76,0x76,0x76,0x76,0x7e,0x7c,0x7e,0x00,0x00,0x05,0x05,
+0x02,0x12,0x0a,0x00,0x0e,0x02,0x04,0x02,0x08,0x0a,0x06,0x07,0x04,0x06,0x09,0x01,
+0x06,0x0a,0x0d,0x09,0x0d,0x11,0x09,0x09,0x1c,0x0e,0x0e,0x0e,0x00,0x00,0x00,0x00,
+0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x0c,0x00,0x00,0x66,0x00,0x00,0x00,0x00,0x00,0x60,0x0c,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0xc0,0x00,0x00,0x18,0x00,0x00,0x00,0x06,0x18,0x06,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x60,0x06,0x00,0x00,0x02,0x02,
+0x02,0x12,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x07,0x02,0x02,0x06,
+0x0a,0x0c,0x0b,0x0e,0x0b,0x00,0x0e,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0xcc,0x00,0x00,0x66,0x00,0x00,0x00,0x00,0x00,0x60,0x0c,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0xc0,0x00,0x00,0x0c,0x00,0x00,0x00,0x06,0x3e,0x06,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x60,0x0c,0x00,0x00,0x05,0x05,
+0x02,0x16,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x02,0x04,0x01,
+0x1f,0x0a,0x09,0x09,0x09,0x00,0x09,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x78,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0xf0,0x1e,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0xc0,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xf0,0xf8,0x00,0x00,0x05,0x05,
+0x02,0x0d,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x0f,0x06,
+0x02,0x09,0x09,0x0e,0x09,0x00,0x0e,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x35,0x36,0x20,
+0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x31,0x36,0x20,0x20,0x20,0x20,0x20,0x20,
+0x20,0x20,0x20,0x20,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
+0x00,0x00,0x00,0x0f,0x00,0x08,0x08,0x00,0x00,0x0f,0x00,0x08,0x10,0x00,0x00,0x0f,
+0x00,0x08,0x18,0x00,0x00,0x0f,0x00,0x08,0x20,0x00,0x00,0x0f,0x00,0x08,0x28,0x00,
+0x00,0x0f,0x00,0x08,0x30,0x00,0x00,0x0f,0x00,0x08,0x38,0x00,0x00,0x0f,0x00,0x08,
+0x40,0x00,0x00,0x0f,0x00,0x08,0x48,0x00,0x00,0x0f,0x00,0x08,0x50,0x00,0x00,0x0f,
+0x00,0x08,0x58,0x00,0x00,0x0f,0x00,0x08,0x60,0x00,0x00,0x0f,0x00,0x08,0x68,0x00,
+0x00,0x0f,0x00,0x08,0x70,0x00,0x00,0x0f,0x00,0x08,0x78,0x00,0x00,0x0f,0x00,0x08,
+0x80,0x00,0x00,0x0f,0x00,0x08,0x88,0x00,0x00,0x0f,0x00,0x08,0x90,0x00,0x00,0x0f,
+0x00,0x08,0x98,0x00,0x00,0x0f,0x00,0x08,0xa0,0x00,0x00,0x0f,0x00,0x08,0xa8,0x00,
+0x00,0x0f,0x00,0x08,0xb0,0x00,0x00,0x0f,0x00,0x08,0xb8,0x00,0x00,0x0f,0x00,0x08,
+0xc0,0x00,0x00,0x0f,0x00,0x08,0xc8,0x00,0x00,0x0f,0x00,0x08,0xd0,0x00,0x00,0x0f,
+0x00,0x08,0xd8,0x00,0x00,0x0f,0x00,0x08,0xe0,0x00,0x00,0x0f,0x00,0x08,0xe8,0x00,
+0x00,0x0f,0x00,0x08,0xf0,0x00,0x00,0x0f,0x00,0x08,0xf8,0x00,0x00,0x0f,0x00,0x08,
+0x00,0x01,0x00,0x0f,0x00,0x08,0x08,0x01,0x00,0x0f,0x00,0x08,0x10,0x01,0x00,0x0f,
+0x00,0x08,0x18,0x01,0x00,0x0f,0x00,0x08,0x20,0x01,0x00,0x0f,0x00,0x08,0x28,0x01,
+0x00,0x0f,0x00,0x08,0x30,0x01,0x00,0x0f,0x00,0x08,0x38,0x01,0x00,0x0f,0x00,0x08,
+0x40,0x01,0x00,0x0f,0x00,0x08,0x48,0x01,0x00,0x0f,0x00,0x08,0x50,0x01,0x00,0x0f,
+0x00,0x08,0x58,0x01,0x00,0x0f,0x00,0x08,0x60,0x01,0x00,0x0f,0x00,0x08,0x68,0x01,
+0x00,0x0f,0x00,0x08,0x70,0x01,0x00,0x0f,0x00,0x08,0x78,0x01,0x00,0x0f,0x00,0x08,
+0x80,0x01,0x00,0x0f,0x00,0x08,0x88,0x01,0x00,0x0f,0x00,0x08,0x90,0x01,0x00,0x0f,
+0x00,0x08,0x98,0x01,0x00,0x0f,0x00,0x08,0xa0,0x01,0x00,0x0f,0x00,0x08,0xa8,0x01,
+0x00,0x0f,0x00,0x08,0xb0,0x01,0x00,0x0f,0x00,0x08,0xb8,0x01,0x00,0x0f,0x00,0x08,
+0xc0,0x01,0x00,0x0f,0x00,0x08,0xc8,0x01,0x00,0x0f,0x00,0x08,0xd0,0x01,0x00,0x0f,
+0x00,0x08,0xd8,0x01,0x00,0x0f,0x00,0x08,0xe0,0x01,0x00,0x0f,0x00,0x08,0xe8,0x01,
+0x00,0x0f,0x00,0x08,0xf0,0x01,0x00,0x0f,0x00,0x08,0xf8,0x01,0x00,0x0f,0x00,0x08,
+0x00,0x02,0x00,0x0f,0x00,0x08,0x08,0x02,0x00,0x0f,0x00,0x08,0x10,0x02,0x00,0x0f,
+0x00,0x08,0x18,0x02,0x00,0x0f,0x00,0x08,0x20,0x02,0x00,0x0f,0x00,0x08,0x28,0x02,
+0x00,0x0f,0x00,0x08,0x30,0x02,0x00,0x0f,0x00,0x08,0x38,0x02,0x00,0x0f,0x00,0x08,
+0x40,0x02,0x00,0x0f,0x00,0x08,0x48,0x02,0x00,0x0f,0x00,0x08,0x50,0x02,0x00,0x0f,
+0x00,0x08,0x58,0x02,0x00,0x0f,0x00,0x08,0x60,0x02,0x00,0x0f,0x00,0x08,0x68,0x02,
+0x00,0x0f,0x00,0x08,0x70,0x02,0x00,0x0f,0x00,0x08,0x78,0x02,0x00,0x0f,0x00,0x08,
+0x80,0x02,0x00,0x0f,0x00,0x08,0x88,0x02,0x00,0x0f,0x00,0x08,0x90,0x02,0x00,0x0f,
+0x00,0x08,0x98,0x02,0x00,0x0f,0x00,0x08,0xa0,0x02,0x00,0x0f,0x00,0x08,0xa8,0x02,
+0x00,0x0f,0x00,0x08,0xb0,0x02,0x00,0x0f,0x00,0x08,0xb8,0x02,0x00,0x0f,0x00,0x08,
+0xc0,0x02,0x00,0x0f,0x00,0x08,0xc8,0x02,0x00,0x0f,0x00,0x08,0xd0,0x02,0x00,0x0f,
+0x00,0x08,0xd8,0x02,0x00,0x0f,0x00,0x08,0xe0,0x02,0x00,0x0f,0x00,0x08,0xe8,0x02,
+0x00,0x0f,0x00,0x08,0xf0,0x02,0x00,0x0f,0x00,0x08,0xf8,0x02,0x00,0x0f,0x00,0x08,
+0x00,0x03,0x00,0x0f,0x00,0x08,0x08,0x03,0x00,0x0f,0x00,0x08,0x10,0x03,0x00,0x0f,
+0x00,0x08,0x18,0x03,0x00,0x0f,0x00,0x08,0x20,0x03,0x00,0x0f,0x00,0x08,0x28,0x03,
+0x00,0x0f,0x00,0x08,0x30,0x03,0x00,0x0f,0x00,0x08,0x38,0x03,0x00,0x0f,0x00,0x08,
+0x40,0x03,0x00,0x0f,0x00,0x08,0x48,0x03,0x00,0x0f,0x00,0x08,0x50,0x03,0x00,0x0f,
+0x00,0x08,0x58,0x03,0x00,0x0f,0x00,0x08,0x60,0x03,0x00,0x0f,0x00,0x08,0x68,0x03,
+0x00,0x0f,0x00,0x08,0x70,0x03,0x00,0x0f,0x00,0x08,0x78,0x03,0x00,0x0f,0x00,0x08,
+0x80,0x03,0x00,0x0f,0x00,0x08,0x88,0x03,0x00,0x0f,0x00,0x08,0x90,0x03,0x00,0x0f,
+0x00,0x08,0x98,0x03,0x00,0x0f,0x00,0x08,0xa0,0x03,0x00,0x0f,0x00,0x08,0xa8,0x03,
+0x00,0x0f,0x00,0x08,0xb0,0x03,0x00,0x0f,0x00,0x08,0xb8,0x03,0x00,0x0f,0x00,0x08,
+0xc0,0x03,0x00,0x0f,0x00,0x08,0xc8,0x03,0x00,0x0f,0x00,0x08,0xd0,0x03,0x00,0x0f,
+0x00,0x08,0xd8,0x03,0x00,0x0f,0x00,0x08,0xe0,0x03,0x00,0x0f,0x00,0x08,0xe8,0x03,
+0x00,0x0f,0x00,0x08,0xf0,0x03,0x00,0x0f,0x00,0x08,0xf8,0x03,0x00,0x0f,0x00,0x08,
+0x00,0x04,0x00,0x0f,0x00,0x08,0x08,0x04,0x00,0x0f,0x00,0x08,0x10,0x04,0x00,0x0f,
+0x00,0x08,0x18,0x04,0x00,0x0f,0x00,0x08,0x20,0x04,0x00,0x0f,0x00,0x08,0x28,0x04,
+0x00,0x0f,0x00,0x08,0x30,0x04,0x00,0x0f,0x00,0x08,0x38,0x04,0x00,0x0f,0x00,0x08,
+0x40,0x04,0x00,0x0f,0x00,0x08,0x48,0x04,0x00,0x0f,0x00,0x08,0x50,0x04,0x00,0x0f,
+0x00,0x08,0x58,0x04,0x00,0x0f,0x00,0x08,0x60,0x04,0x00,0x0f,0x00,0x08,0x68,0x04,
+0x00,0x0f,0x00,0x08,0x70,0x04,0x00,0x0f,0x00,0x08,0x78,0x04,0x00,0x0f,0x00,0x08,
+0x80,0x04,0x00,0x0f,0x00,0x08,0x88,0x04,0x00,0x0f,0x00,0x08,0x90,0x04,0x00,0x0f,
+0x00,0x08,0x98,0x04,0x00,0x0f,0x00,0x08,0xa0,0x04,0x00,0x0f,0x00,0x08,0xa8,0x04,
+0x00,0x0f,0x00,0x08,0xb0,0x04,0x00,0x0f,0x00,0x08,0xb8,0x04,0x00,0x0f,0x00,0x08,
+0xc0,0x04,0x00,0x0f,0x00,0x08,0xc8,0x04,0x00,0x0f,0x00,0x08,0xd0,0x04,0x00,0x0f,
+0x00,0x08,0xd8,0x04,0x00,0x0f,0x00,0x08,0xe0,0x04,0x00,0x0f,0x00,0x08,0xe8,0x04,
+0x00,0x0f,0x00,0x08,0xf0,0x04,0x00,0x0f,0x00,0x08,0xf8,0x04,0x00,0x0f,0x00,0x08,
+0x00,0x05,0x00,0x0f,0x00,0x08,0x08,0x05,0x00,0x0f,0x00,0x08,0x10,0x05,0x00,0x0f,
+0x00,0x08,0x18,0x05,0x00,0x0f,0x00,0x08,0x20,0x05,0x00,0x0f,0x00,0x08,0x28,0x05,
+0x00,0x0f,0x00,0x08,0x30,0x05,0x00,0x0f,0x00,0x08,0x38,0x05,0x00,0x0f,0x00,0x08,
+0x40,0x05,0x00,0x0f,0x00,0x08,0x48,0x05,0x00,0x0f,0x00,0x08,0x50,0x05,0x00,0x0f,
+0x00,0x08,0x58,0x05,0x00,0x0f,0x00,0x08,0x60,0x05,0x00,0x0f,0x00,0x08,0x68,0x05,
+0x00,0x0f,0x00,0x08,0x70,0x05,0x00,0x0f,0x00,0x08,0x78,0x05,0x00,0x0f,0x00,0x08,
+0x80,0x05,0x00,0x0f,0x00,0x08,0x88,0x05,0x00,0x0f,0x00,0x08,0x90,0x05,0x00,0x0f,
+0x00,0x08,0x98,0x05,0x00,0x0f,0x00,0x08,0xa0,0x05,0x00,0x0f,0x00,0x08,0xa8,0x05,
+0x00,0x0f,0x00,0x08,0xb0,0x05,0x00,0x0f,0x00,0x08,0xb8,0x05,0x00,0x0f,0x00,0x08,
+0xc0,0x05,0x00,0x0f,0x00,0x08,0xc8,0x05,0x00,0x0f,0x00,0x08,0xd0,0x05,0x00,0x0f,
+0x00,0x08,0xd8,0x05,0x00,0x0f,0x00,0x08,0xe0,0x05,0x00,0x0f,0x00,0x08,0xe8,0x05,
+0x00,0x0f,0x00,0x08,0xf0,0x05,0x00,0x0f,0x00,0x08,0xf8,0x05,0x00,0x0f,0x00,0x08,
+0x00,0x06,0x00,0x0f,0x00,0x08,0x08,0x06,0x00,0x0f,0x00,0x08,0x10,0x06,0x00,0x0f,
+0x00,0x08,0x18,0x06,0x00,0x0f,0x00,0x08,0x20,0x06,0x00,0x0f,0x00,0x08,0x28,0x06,
+0x00,0x0f,0x00,0x08,0x30,0x06,0x00,0x0f,0x00,0x08,0x38,0x06,0x00,0x0f,0x00,0x08,
+0x40,0x06,0x00,0x0f,0x00,0x08,0x48,0x06,0x00,0x0f,0x00,0x08,0x50,0x06,0x00,0x0f,
+0x00,0x08,0x58,0x06,0x00,0x0f,0x00,0x08,0x60,0x06,0x00,0x0f,0x00,0x08,0x68,0x06,
+0x00,0x0f,0x00,0x08,0x70,0x06,0x00,0x0f,0x00,0x08,0x78,0x06,0x00,0x0f,0x00,0x08,
+0x80,0x06,0x00,0x0f,0x00,0x08,0x88,0x06,0x00,0x0f,0x00,0x08,0x90,0x06,0x00,0x0f,
+0x00,0x08,0x98,0x06,0x00,0x0f,0x00,0x08,0xa0,0x06,0x00,0x0f,0x00,0x08,0xa8,0x06,
+0x00,0x0f,0x00,0x08,0xb0,0x06,0x00,0x0f,0x00,0x08,0xb8,0x06,0x00,0x0f,0x00,0x08,
+0xc0,0x06,0x00,0x0f,0x00,0x08,0xc8,0x06,0x00,0x0f,0x00,0x08,0xd0,0x06,0x00,0x0f,
+0x00,0x08,0xd8,0x06,0x00,0x0f,0x00,0x08,0xe0,0x06,0x00,0x0f,0x00,0x08,0xe8,0x06,
+0x00,0x0f,0x00,0x08,0xf0,0x06,0x00,0x0f,0x00,0x08,0xf8,0x06,0x00,0x0f,0x00,0x08,
+0x00,0x07,0x00,0x0f,0x00,0x08,0x08,0x07,0x00,0x0f,0x00,0x08,0x10,0x07,0x00,0x0f,
+0x00,0x08,0x18,0x07,0x00,0x0f,0x00,0x08,0x20,0x07,0x00,0x0f,0x00,0x08,0x28,0x07,
+0x00,0x0f,0x00,0x08,0x30,0x07,0x00,0x0f,0x00,0x08,0x38,0x07,0x00,0x0f,0x00,0x08,
+0x40,0x07,0x00,0x0f,0x00,0x08,0x48,0x07,0x00,0x0f,0x00,0x08,0x50,0x07,0x00,0x0f,
+0x00,0x08,0x58,0x07,0x00,0x0f,0x00,0x08,0x60,0x07,0x00,0x0f,0x00,0x08,0x68,0x07,
+0x00,0x0f,0x00,0x08,0x70,0x07,0x00,0x0f,0x00,0x08,0x78,0x07,0x00,0x0f,0x00,0x08,
+0x80,0x07,0x00,0x0f,0x00,0x08,0x88,0x07,0x00,0x0f,0x00,0x08,0x90,0x07,0x00,0x0f,
+0x00,0x08,0x98,0x07,0x00,0x0f,0x00,0x08,0xa0,0x07,0x00,0x0f,0x00,0x08,0xa8,0x07,
+0x00,0x0f,0x00,0x08,0xb0,0x07,0x00,0x0f,0x00,0x08,0xb8,0x07,0x00,0x0f,0x00,0x08,
+0xc0,0x07,0x00,0x0f,0x00,0x08,0xc8,0x07,0x00,0x0f,0x00,0x08,0xd0,0x07,0x00,0x0f,
+0x00,0x08,0xd8,0x07,0x00,0x0f,0x00,0x08,0xe0,0x07,0x00,0x0f,0x00,0x08,0xe8,0x07,
+0x00,0x0f,0x00,0x08,0xf0,0x07,0x00,0x0f,0x00,0x08,0xf8,0x07,0x00,0x0f,0x00,0x08,
+0x00,0x08,0x00,0x0f,0x00,0x08,
+};
+
+int sizeofdefont = sizeof defontdata;
+
+void
+_unpackinfo(Fontchar *fc, uchar *p, int n)
+{
+ int j;
+
+ for(j=0; j<=n; j++){
+ fc->x = p[0]|(p[1]<<8);
+ fc->top = p[2];
+ fc->bottom = p[3];
+ fc->left = p[4];
+ fc->width = p[5];
+ fc++;
+ p += 6;
+ }
+}
--- /dev/null
+++ b/libdraw/getdefont.c
@@ -1,0 +1,58 @@
+#include "draw.h"
+
+Subfont*
+getdefont(Display *d)
+{
+ char *hdr, *p;
+ int n;
+ Fontchar *fc;
+ Subfont *f;
+ int ld;
+ Rectangle r;
+ Image *i;
+
+ /*
+ * make sure data is word-aligned. this is true with Plan 9 compilers
+ * but not in general. the byte order is right because the data is
+ * declared as char*, not ulong*.
+ */
+ p = (char*)defontdata;
+ n = (int)(unsigned long long)p & 3; /* stupid ape */
+ if(n != 0){
+ memmove(p+(4-n), p, sizeofdefont-n);
+ p += 4-n;
+ }
+ ld = atoi(p+0*12);
+ r.min.x = atoi(p+1*12);
+ r.min.y = atoi(p+2*12);
+ r.max.x = atoi(p+3*12);
+ r.max.y = atoi(p+4*12);
+
+ i = allocimage(d, r, drawld2chan[ld], 0, 0);
+ if(i == 0)
+ return 0;
+
+ p += 5*12;
+ n = loadimage(i, r, (uchar*)p, (defontdata+sizeofdefont)-(uchar*)p);
+ if(n < 0){
+ freeimage(i);
+ return 0;
+ }
+
+ hdr = p+n;
+ n = atoi(hdr);
+ p = hdr+3*12;
+ fc = malloc(sizeof(Fontchar)*(n+1));
+ if(fc == 0){
+ freeimage(i);
+ return 0;
+ }
+ _unpackinfo(fc, (uchar*)p, n);
+ f = allocsubfont("*default*", n, atoi(hdr+12), atoi(hdr+24), fc, i);
+ if(f == 0){
+ freeimage(i);
+ free(fc);
+ return 0;
+ }
+ return f;
+}
--- a/libdraw/meson.build
+++ b/libdraw/meson.build
@@ -1,9 +1,14 @@
libdraw_src = [
'arith.c',
+ 'buildfont.c',
'bytesperline.c',
+ 'chan.c',
+ 'defont.c',
'draw.c',
+ 'getdefont.c',
'init.c',
'loadimage.c',
+ 'openfont.c',
]
libdraw = static_library(
--- /dev/null
+++ b/libdraw/openfont.c
@@ -1,0 +1,47 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include "draw.h"
+
+static char*
+readfile(char *name)
+{
+ enum { HUNK = 8*1024, };
+ int f, n, r;
+ char *s, *p;
+
+ n = 0;
+ r = -1;
+ if((s = malloc(HUNK)) != nil){
+ if((f = open(name, O_RDONLY)) >= 0){
+ while((r = read(f, s+n, HUNK)) > 0){
+ n += r;
+ r = -1;
+ if((p = realloc(s, n+HUNK)) == nil)
+ break;
+ s = p;
+ }
+ close(f);
+ }
+ }
+ if(r < 0 || (p = realloc(s, n+1)) == nil){
+ free(s);
+ return nil;
+ }
+ p[n] = 0;
+ return p;
+}
+
+_Font*
+openfont(Display *d, char *name)
+{
+ _Font *fnt;
+ char *buf;
+
+ if((buf = readfile(name)) == nil){
+ werrstr("openfont: %r");
+ return nil;
+ }
+ fnt = buildfont(d, buf, name);
+ free(buf);
+ return fnt;
+}