got rid of iv.vfs
[mmd.git] / x11gfx.d
blob003c5b4766e91fb439334d0af092bebe4822f46a
1 module x11gfx is aliced;
3 import arsd.simpledisplay;
4 //import arsd.color;
7 // ////////////////////////////////////////////////////////////////////////// //
8 // 0:b; 1:g; 2:r; 3: nothing
9 __gshared int vbufW = 256, vbufH = 192;
10 __gshared uint[] vbuf;
11 __gshared bool blit2x = true;
12 enum BlitType { Normal, BlackWhite, Green }
13 __gshared int blitType = BlitType.Normal;
14 __gshared Image vbimg;
15 __gshared SimpleWindow vbwin;
18 // ////////////////////////////////////////////////////////////////////////// //
19 void x11gfxDeinit () {
20 flushGui();
21 if (vbimg !is null) delete vbimg;
22 if (vbwin !is null) { if (!vbwin.closed) vbwin.close(); delete vbwin; }
23 if (vbuf !is null) delete vbuf;
24 vbimg = null;
25 vbwin = null;
26 vbuf = null;
27 flushGui();
31 SimpleWindow x11gfxInit (string title) {
32 if (vbufW < 1 || vbufH < 1 || vbufW > 4096 || vbufH > 4096) assert(0, "invalid dimensions");
33 initVBuf();
34 vbwin = new SimpleWindow(vbufW*(blit2x ? 2 : 1), vbufH*(blit2x ? 2 : 1), title, OpenGlOptions.no, Resizablity.fixedSize);
35 vbimg = new Image(vbufW*(blit2x ? 2 : 1), vbufH*(blit2x ? 2 : 1));
36 return vbwin;
40 void x11gfxBlit () {
41 if (vbwin is null || vbwin.closed) return;
42 auto painter = vbwin.draw();
43 painter.drawImage(Point(0, 0), vbimg);
47 // ////////////////////////////////////////////////////////////////////////// //
48 final class X11Image {
49 int width, height;
50 VColor[] data;
52 this (int w, int h) {
53 assert(w > 0 && w <= 4096);
54 assert(h > 0 && h <= 4096);
55 width = w;
56 height = h;
57 data.length = w*h;
58 data[] = Transparent;
61 VColor getPixel (int x, int y) const {
62 return (x >= 0 && y >= 0 && x < width && y < height ? data[y*width+x] : Transparent);
65 void setPixel (int x, int y, VColor c) {
66 if (x >= 0 && y >= 0 && x < width && y < height) data[y*width+x] = c;
69 void blitFast (int x, int y) const {
70 if (width < 1 || height < 1) return;
71 if (x <= -width || y <= -height) return;
72 if (x >= vbufW || y >= vbufH) return;
73 auto src = cast(const(VColor)*)data.ptr;
74 if (x >= 0 && y >= 0 && x+width < vbufW && y+height < vbufH) {
75 auto d = cast(uint*)vbuf.ptr;
76 d += vbufW*y+x;
77 foreach (int dy; 0..height) {
78 d[0..width] = src[0..width];
79 src += width;
80 d += vbufW;
82 } else {
83 foreach (int dy; 0..height) {
84 foreach (int dx; 0..width) {
85 .setPixel(x+dx, y+dy, *src++);
91 void blit (int x, int y) const {
92 if (width < 1 || height < 1) return;
93 if (x <= -width || y <= -height) return;
94 if (x >= vbufW || y >= vbufH) return;
95 auto src = cast(const(VColor)*)data.ptr;
96 foreach (int dy; 0..height) {
97 foreach (int dx; 0..width) {
98 putPixel(x+dx, y+dy, *src++);
103 void blit2x (int x, int y) const {
104 if (width < 1 || height < 1) return;
105 if (x <= -width || y <= -height) return;
106 if (x >= vbufW || y >= vbufH) return;
107 auto src = cast(const(VColor)*)data.ptr;
108 foreach (immutable int dy; 0..height) {
109 foreach (immutable int dx; 0..width) {
110 putPixel(x+dx*2+0, y+dy*2+0, *src);
111 putPixel(x+dx*2+1, y+dy*2+0, *src);
112 putPixel(x+dx*2+0, y+dy*2+1, *src);
113 putPixel(x+dx*2+1, y+dy*2+1, *src);
114 ++src;
119 private void blit2xImpl(string op) (int x, int y) nothrow @trusted @nogc {
120 if (width < 1 || height < 1) return;
121 if (x <= -width || y <= -height) return;
122 if (x >= vbufW || y >= vbufH) return;
123 auto s = cast(const(ubyte)*)data.ptr;
124 //auto d = cast(uint*)vscr2x;
125 foreach (immutable int dy; 0..height) {
126 foreach (immutable int dx; 0..width) {
127 static if (op.length) mixin(op);
128 immutable uint c1 = ((((c0&0x00ff00ff)*6)>>3)&0x00ff00ff)|(((c0&0x0000ff00)*6)>>3)&0x0000ff00;
129 putPixel(x+dx*2+0, y+dy*2+0, c0);
130 putPixel(x+dx*2+1, y+dy*2+0, c0);
131 putPixel(x+dx*2+0, y+dy*2+1, c1);
132 putPixel(x+dx*2+1, y+dy*2+1, c1);
133 s += 4;
138 alias blit2xTV = blit2xImpl!"immutable uint c0 = (cast(immutable(uint)*)s)[0];";
139 alias blit2xTVBW = blit2xImpl!"immutable ubyte i = cast(ubyte)((s[0]*28+s[1]*151+s[2]*77)/256); immutable uint c0 = (i<<16)|(i<<8)|i;";
140 alias blit2xTVGreen = blit2xImpl!"immutable ubyte i = cast(ubyte)((s[0]*28+s[1]*151+s[2]*77)/256); immutable uint c0 = i<<8;";
144 private void initVBuf () {
145 vbuf.length = vbufW*vbufH;
146 vbuf[] = 0;
150 private {
151 void blit2xImpl(string op, bool scanlines=true) (Image img) {
152 static if (UsingSimpledisplayX11) {
153 auto s = cast(const(ubyte)*)vbuf.ptr;
154 immutable iw = img.width;
155 auto dd = cast(uint*)img.getDataPointer;
156 foreach (immutable int dy; 0..vbufH) {
157 if (dy*2+1 >= img.height) return;
158 auto d = dd+iw*(dy*2);
159 foreach (immutable int dx; 0..vbufW) {
160 if (dx+1 < iw) {
161 static if (op.length) mixin(op);
162 static if (scanlines) {
163 immutable uint c1 = ((((c0&0x00ff00ff)*6)>>3)&0x00ff00ff)|(((c0&0x0000ff00)*6)>>3)&0x0000ff00;
164 } else {
165 alias c1 = c0;
167 d[0] = d[1] = c0;
168 d[iw+0] = d[iw+1] = c1;
169 d += 2;
170 s += 4;
174 } else {
175 // this sux
176 immutable bpp = img.bytesPerPixel();
177 immutable rofs = img.redByteOffset;
178 immutable gofs = img.greenByteOffset;
179 immutable bofs = img.blueByteOffset;
180 immutable nlo = img.adjustmentForNextLine;
181 auto s = cast(const(ubyte)*)vbuf.ptr;
182 immutable iw = img.width;
183 auto dd = cast(ubyte*)img.getDataPointer;
184 foreach (immutable int dy; 0..vbufH) {
185 if (dy*2+1 >= img.height) return;
186 auto d = dd+img.offsetForPixel(0, dy*2);
187 foreach (immutable int dx; 0..vbufW) {
188 if (dx+1 < iw) {
189 static if (op.length) mixin(op);
190 static if (scanlines) {
191 immutable uint c1 = ((((c0&0x00ff00ff)*6)>>3)&0x00ff00ff)|(((c0&0x0000ff00)*6)>>3)&0x0000ff00;
192 } else {
193 alias c1 = c0;
195 d[bofs] = d[bofs+bpp] = c0&0xff;
196 d[gofs] = d[gofs+bpp] = (c0>>8)&0xff;
197 d[rofs] = d[rofs+bpp] = (c0>>16)&0xff;
198 d[bofs+nlo] = d[bofs+nlo+bpp] = c0&0xff;
199 d[gofs+nlo] = d[gofs+nlo+bpp] = (c0>>8)&0xff;
200 d[rofs+nlo] = d[rofs+nlo+bpp] = (c0>>16)&0xff;
201 d += bpp*2;
202 s += 4;
209 alias blit2xTV = blit2xImpl!"immutable uint c0 = (cast(immutable(uint)*)s)[0];";
210 alias blit2xTVBW = blit2xImpl!"immutable ubyte i = cast(ubyte)((s[0]*28+s[1]*151+s[2]*77)/256); immutable uint c0 = (i<<16)|(i<<8)|i;";
211 alias blit2xTVGreen = blit2xImpl!"immutable ubyte i = cast(ubyte)((s[0]*28+s[1]*151+s[2]*77)/256); immutable uint c0 = i<<8;";
215 void realizeVBuf (/*Image img*/) {
216 if (vbimg is null) return;
217 Image img = vbimg;
219 auto sp = vbuf.ptr;
220 auto dp = cast(uint*)img.getDataPointer;
221 import core.stdc.string : memcpy;
222 memcpy(dp, sp, vbufW*vbufH*4);
224 if (blit2x) {
225 if (img.width < vbufW*2 || img.height < vbufH*2) return;
226 switch (blitType) {
227 case BlitType.BlackWhite: blit2xTVBW(img); break;
228 case BlitType.Green: blit2xTVGreen(img); break;
229 default: blit2xTV(img); break;
231 } else {
232 if (img.width < vbufW || img.height < vbufH) return;
233 static if (UsingSimpledisplayX11) {
234 auto dp = cast(uint*)img.getDataPointer;
235 dp[0..vbufW*vbufH] = vbuf.ptr[0..vbufW*vbufH];
236 } else {
237 // this sux
238 auto sp = cast(ubyte*)vbuf.ptr;
239 auto dp = cast(ubyte*)img.getDataPointer;
240 immutable bpp = img.bytesPerPixel();
241 immutable rofs = img.redByteOffset;
242 immutable gofs = img.greenByteOffset;
243 immutable bofs = img.blueByteOffset;
244 foreach (immutable y; 0..vbufH) {
245 auto d = dp+img.offsetForTopLeftPixel;
246 foreach (immutable x; 0..vbufW) {
247 d[bofs] = *sp++;
248 d[gofs] = *sp++;
249 d[rofs] = *sp++;
250 ++sp;
251 d += bpp;
259 // ////////////////////////////////////////////////////////////////////////// //
260 ubyte clampToByte(T) (T n) @safe pure nothrow @nogc
261 if (__traits(isIntegral, T) && (T.sizeof == 2 || T.sizeof == 4))
263 static if (__VERSION__ > 2067) pragma(inline, true);
264 n &= -cast(int)(n >= 0);
265 return cast(ubyte)(n|((255-cast(int)n)>>31));
268 ubyte clampToByte(T) (T n) @safe pure nothrow @nogc
269 if (__traits(isIntegral, T) && T.sizeof == 1)
271 static if (__VERSION__ > 2067) pragma(inline, true);
272 return cast(ubyte)n;
276 // ////////////////////////////////////////////////////////////////////////// //
277 alias VColor = uint;
279 /// vlRGBA struct to ease color components extraction/replacing
280 align(1) struct vlRGBA {
281 align(1):
282 ubyte b, g, r, a;
284 static assert(vlRGBA.sizeof == VColor.sizeof);
287 enum : VColor {
288 vlAMask = 0xff000000u,
289 vlRMask = 0x00ff0000u,
290 vlGMask = 0x0000ff00u,
291 vlBMask = 0x000000ffu
294 enum : VColor {
295 vlAShift = 24,
296 vlRShift = 16,
297 vlGShift = 8,
298 vlBShift = 0
302 enum VColor Transparent = vlAMask; /// completely transparent pixel color
305 bool isTransparent(T : VColor) (T col) @safe pure nothrow @nogc {
306 static if (__VERSION__ > 2067) pragma(inline, true);
307 return ((col&vlAMask) == vlAMask);
310 bool isOpaque(T : VColor) (T col) @safe pure nothrow @nogc {
311 static if (__VERSION__ > 2067) pragma(inline, true);
312 return ((col&vlAMask) == 0);
315 // a=0: opaque
316 VColor rgbcol(TR, TG, TB, TA=ubyte) (TR r, TG g, TB b, TA a=0) @safe pure nothrow @nogc
317 if (__traits(isIntegral, TR) && __traits(isIntegral, TG) && __traits(isIntegral, TB) && __traits(isIntegral, TA)) {
318 static if (__VERSION__ > 2067) pragma(inline, true);
319 return
320 (clampToByte(a)<<vlAShift)|
321 (clampToByte(r)<<vlRShift)|
322 (clampToByte(g)<<vlGShift)|
323 (clampToByte(b)<<vlBShift);
326 alias rgbacol = rgbcol;
329 // generate some templates
330 private enum genRGBGetSet(string cname) =
331 "ubyte rgb"~cname~"() (VColor clr) @safe pure nothrow @nogc {\n"~
332 " static if (__VERSION__ > 2067) pragma(inline, true);\n"~
333 " return ((clr>>vl"~cname[0]~"Shift)&0xff);\n"~
334 "}\n"~
335 "VColor rgbSet"~cname~"(T) (VColor clr, T v) @safe pure nothrow @nogc if (__traits(isIntegral, T)) {\n"~
336 " static if (__VERSION__ > 2067) pragma(inline, true);\n"~
337 " return (clr&~vl"~cname[0]~"Mask)|(clampToByte(v)<<vl"~cname[0]~"Shift);\n"~
338 "}\n";
340 mixin(genRGBGetSet!"Alpha");
341 mixin(genRGBGetSet!"Red");
342 mixin(genRGBGetSet!"Green");
343 mixin(genRGBGetSet!"Blue");
346 void putPixel(TX, TY) (TX x, TY y, VColor col) @trusted
347 if (__traits(isIntegral, TX) && __traits(isIntegral, TY))
349 static if (__VERSION__ > 2067) pragma(inline, true);
350 immutable long xx = cast(long)x;
351 immutable long yy = cast(long)y;
352 if ((col&vlAMask) != vlAMask && xx >= 0 && yy >= 0 && xx < vbufW && yy < vbufH) {
353 uint* da = vbuf.ptr+yy*vbufW+xx;
354 if (col&vlAMask) {
355 immutable uint a = 256-(col>>24); // to not loose bits
356 immutable uint dc = (*da)&0xffffff;
357 immutable uint srb = (col&0xff00ff);
358 immutable uint sg = (col&0x00ff00);
359 immutable uint drb = (dc&0xff00ff);
360 immutable uint dg = (dc&0x00ff00);
361 immutable uint orb = (drb+(((srb-drb)*a+0x800080)>>8))&0xff00ff;
362 immutable uint og = (dg+(((sg-dg)*a+0x008000)>>8))&0x00ff00;
363 *da = orb|og;
364 } else {
365 *da = col;
370 void setPixel(TX, TY) (TX x, TY y, VColor col) @trusted
371 if (__traits(isIntegral, TX) && __traits(isIntegral, TY))
373 static if (__VERSION__ > 2067) pragma(inline, true);
374 immutable long xx = cast(long)x;
375 immutable long yy = cast(long)y;
376 if (xx >= 0 && yy >= 0 && xx < vbufW && yy < vbufH) {
377 uint* da = vbuf.ptr+yy*vbufW+xx;
378 *da = col;
383 void drawLine(bool lastPoint=true) (int x0, int y0, int x1, int y1, immutable VColor col) {
384 enum swap(string a, string b) = "{int tmp_="~a~";"~a~"="~b~";"~b~"=tmp_;}";
386 if ((col&vlAMask) == vlAMask) return;
388 if (x0 == x1 && y0 == y1) {
389 static if (lastPoint) putPixel(x0, y0, col);
390 return;
393 // clip rectange
394 int wx0 = 0, wy0 = 0, wx1 = vbufW-1, wy1 = vbufH-1;
395 // other vars
396 int stx, sty; // "steps" for x and y axes
397 int dsx, dsy; // "lengthes" for x and y axes
398 int dx2, dy2; // "double lengthes" for x and y axes
399 int xd, yd; // current coord
400 int e; // "error" (as in bresenham algo)
401 int rem;
402 int term;
403 int *d0, d1;
404 // horizontal setup
405 if (x0 < x1) {
406 // from left to right
407 if (x0 > wx1 || x1 < wx0) return; // out of screen
408 stx = 1; // going right
409 } else {
410 // from right to left
411 if (x1 > wx1 || x0 < wx0) return; // out of screen
412 stx = -1; // going left
413 x0 = -x0;
414 x1 = -x1;
415 wx0 = -wx0;
416 wx1 = -wx1;
417 mixin(swap!("wx0", "wx1"));
419 // vertical setup
420 if (y0 < y1) {
421 // from top to bottom
422 if (y0 > wy1 || y1 < wy0) return; // out of screen
423 sty = 1; // going down
424 } else {
425 // from bottom to top
426 if (y1 > wy1 || y0 < wy0) return; // out of screen
427 sty = -1; // going up
428 y0 = -y0;
429 y1 = -y1;
430 wy0 = -wy0;
431 wy1 = -wy1;
432 mixin(swap!("wy0", "wy1"));
434 dsx = x1-x0;
435 dsy = y1-y0;
436 if (dsx < dsy) {
437 d0 = &yd;
438 d1 = &xd;
439 mixin(swap!("x0", "y0"));
440 mixin(swap!("x1", "y1"));
441 mixin(swap!("dsx", "dsy"));
442 mixin(swap!("wx0", "wy0"));
443 mixin(swap!("wx1", "wy1"));
444 mixin(swap!("stx", "sty"));
445 } else {
446 d0 = &xd;
447 d1 = &yd;
449 dx2 = 2*dsx;
450 dy2 = 2*dsy;
451 xd = x0;
452 yd = y0;
453 e = 2*dsy-dsx;
454 term = x1;
455 bool xfixed = false;
456 if (y0 < wy0) {
457 // clip at top
458 int temp = dx2*(wy0-y0)-dsx;
459 xd += temp/dy2;
460 rem = temp%dy2;
461 if (xd > wx1) return; // x is moved out of clipping rect, nothing to do
462 if (xd+1 >= wx0) {
463 yd = wy0;
464 e -= rem+dsx;
465 if (rem > 0) { ++xd; e += dy2; }
466 xfixed = true;
469 if (!xfixed && x0 < wx0) {
470 // clip at left
471 int temp = dy2*(wx0-x0);
472 yd += temp/dx2;
473 rem = temp%dx2;
474 if (yd > wy1 || yd == wy1 && rem >= dsx) return;
475 xd = wx0;
476 e += rem;
477 if (rem >= dsx) { ++yd; e -= dx2; }
479 if (y1 > wy1) {
480 // clip at bottom
481 int temp = dx2*(wy1-y0)+dsx;
482 term = x0+temp/dy2;
483 rem = temp%dy2;
484 if (rem == 0) --term;
486 if (term > wx1) term = wx1; // clip at right
487 static if (lastPoint) {
488 // draw last point
489 ++term;
490 } else {
491 if (term == xd) return; // this is the only point, get out of here
493 if (sty == -1) yd = -yd;
494 if (stx == -1) { xd = -xd; term = -term; }
495 dx2 -= dy2;
496 // draw it; `putPixel()` can omit checks
497 while (xd != term) {
498 // inlined `putPixel(*d0, *d1, col)`
499 // this can be made even faster by precalculating `da` and making
500 // separate code branches for mixing and non-mixing drawing, but...
501 // ah, screw it!
502 uint* da = vbuf.ptr+(*d1)*vbufW+(*d0);
503 if (col&vlAMask) {
504 immutable uint a = 256-(col>>24); // to not loose bits
505 immutable uint dc = (*da)&0xffffff;
506 immutable uint srb = (col&0xff00ff);
507 immutable uint sg = (col&0x00ff00);
508 immutable uint drb = (dc&0xff00ff);
509 immutable uint dg = (dc&0x00ff00);
510 immutable uint orb = (drb+(((srb-drb)*a+0x800080)>>8))&0xff00ff;
511 immutable uint og = (dg+(((sg-dg)*a+0x008000)>>8))&0x00ff00;
512 *da = orb|og;
513 } else {
514 *da = col;
516 // done drawing, move coords
517 if (e >= 0) {
518 yd += sty;
519 e -= dx2;
520 } else {
521 e += dy2;
523 xd += stx;
528 // //////////////////////////////////////////////////////////////////////// //
530 * Draw character onto virtual screen in KOI8 encoding.
532 * Params:
533 * x = x coordinate
534 * y = y coordinate
535 * wdt = char width
536 * shift = shl count
537 * ch = character
538 * col = foreground color
539 * bkcol = background color
541 * Returns:
542 * nothing
544 void drawCharWdt (int x, int y, int wdt, int shift, char ch, VColor col, VColor bkcol=Transparent) @trusted {
545 size_t pos = ch*8;
546 if (wdt < 1 || shift >= 8) return;
547 if (col == Transparent && bkcol == Transparent) return;
548 if (wdt > 8) wdt = 8;
549 if (shift < 0) shift = 0;
550 foreach (immutable int dy; 0..8) {
551 ubyte b = cast(ubyte)(vlFont6[pos++]<<shift);
552 foreach (immutable int dx; 0..wdt) {
553 VColor c = (b&0x80 ? col : bkcol);
554 if (!isTransparent(c)) putPixel(x+dx, y+dy, c);
555 b = (b<<1)&0xff;
560 // outline types
561 enum : ubyte {
562 OutLeft = 0x01,
563 OutRight = 0x02,
564 OutUp = 0x04,
565 OutDown = 0x08,
566 OutLU = 0x10, // left-up
567 OutRU = 0x20, // right-up
568 OutLD = 0x40, // left-down
569 OutRD = 0x80, // right-down
570 OutAll = 0xff,
574 * Draw outlined character onto virtual screen in KOI8 encoding.
576 * Params:
577 * x = x coordinate
578 * y = y coordinate
579 * wdt = char width
580 * shift = shl count
581 * ch = character
582 * col = foreground color
583 * outcol = outline color
584 * ot = outline type, OutXXX, ored
586 * Returns:
587 * nothing
589 void drawCharWdtOut (int x, int y, int wdt, int shift, char ch, VColor col, VColor outcol=Transparent, ubyte ot=0) @trusted {
590 if (col == Transparent && outcol == Transparent) return;
591 if (ot == 0 || outcol == Transparent) {
592 // no outline? simple draw
593 drawCharWdt(x, y, wdt, shift, ch, col, Transparent);
594 return;
596 size_t pos = ch*8;
597 if (wdt < 1 || shift >= 8) return;
598 if (wdt > 8) wdt = 8;
599 if (shift < 0) shift = 0;
600 ubyte[8+2][8+2] bmp = 0; // char bitmap; 0: empty; 1: char; 2: outline
601 foreach (immutable dy; 1..9) {
602 ubyte b = cast(ubyte)(vlFont6[pos++]<<shift);
603 foreach (immutable dx; 1..wdt+1) {
604 if (b&0x80) {
605 // put pixel
606 bmp[dy][dx] = 1;
607 // put outlines
608 if ((ot&OutUp) && bmp[dy-1][dx] == 0) bmp[dy-1][dx] = 2;
609 if ((ot&OutDown) && bmp[dy+1][dx] == 0) bmp[dy+1][dx] = 2;
610 if ((ot&OutLeft) && bmp[dy][dx-1] == 0) bmp[dy][dx-1] = 2;
611 if ((ot&OutRight) && bmp[dy][dx+1] == 0) bmp[dy][dx+1] = 2;
612 if ((ot&OutLU) && bmp[dy-1][dx-1] == 0) bmp[dy-1][dx-1] = 2;
613 if ((ot&OutRU) && bmp[dy-1][dx+1] == 0) bmp[dy-1][dx+1] = 2;
614 if ((ot&OutLD) && bmp[dy+1][dx-1] == 0) bmp[dy+1][dx-1] = 2;
615 if ((ot&OutRD) && bmp[dy+1][dx+1] == 0) bmp[dy+1][dx+1] = 2;
617 b = (b<<1)&0xff;
620 // now draw it
621 --x;
622 --y;
623 foreach (immutable int dy; 0..10) {
624 foreach (immutable int dx; 0..10) {
625 if (auto t = bmp[dy][dx]) putPixel(x+dx, y+dy, (t == 1 ? col : outcol));
631 * Draw 6x8 character onto virtual screen in KOI8 encoding.
633 * Params:
634 * x = x coordinate
635 * y = y coordinate
636 * ch = character
637 * col = foreground color
638 * bkcol = background color
640 * Returns:
641 * nothing
643 void drawChar (int x, int y, char ch, VColor col, VColor bkcol=Transparent) @trusted {
644 drawCharWdt(x, y, 6, 0, ch, col, bkcol);
647 void drawCharOut (int x, int y, char ch, VColor col, VColor outcol=Transparent, ubyte ot=OutAll) @trusted {
648 drawCharWdtOut(x, y, 6, 0, ch, col, outcol, ot);
651 void drawStr (int x, int y, string str, VColor col, VColor bkcol=Transparent) @trusted {
652 foreach (immutable char ch; str) {
653 drawChar(x, y, ch, col, bkcol);
654 x += 6;
658 void drawStrOut (int x, int y, string str, VColor col, VColor outcol=Transparent, ubyte ot=OutAll) @trusted {
659 foreach (immutable char ch; str) {
660 drawCharOut(x, y, ch, col, outcol, ot);
661 x += 6;
665 static int charWidthProp (char ch) @trusted pure { return (vlFontPropWidth[ch]&0x0f); }
667 int strWidthProp (string str) @trusted pure {
668 int wdt = 0;
669 foreach (immutable char ch; str) wdt += (vlFontPropWidth[ch]&0x0f)+1;
670 if (wdt > 0) --wdt; // don't count last empty pixel
671 return wdt;
674 int drawCharProp (int x, int y, char ch, VColor col, VColor bkcol=Transparent) @trusted {
675 immutable int wdt = (vlFontPropWidth[ch]&0x0f);
676 drawCharWdt(x, y, wdt, vlFontPropWidth[ch]>>4, ch, col, bkcol);
677 return wdt;
680 int drawCharPropOut (int x, int y, char ch, VColor col, VColor outcol=Transparent, ubyte ot=OutAll) @trusted {
681 immutable int wdt = (vlFontPropWidth[ch]&0x0f);
682 drawCharWdtOut(x, y, wdt, vlFontPropWidth[ch]>>4, ch, col, outcol, ot);
683 return wdt;
686 int drawStrProp (int x, int y, string str, VColor col, VColor bkcol=Transparent) @trusted {
687 bool vline = false;
688 int sx = x;
689 foreach (immutable char ch; str) {
690 if (vline) {
691 if (!isTransparent(bkcol)) foreach (int dy; 0..8) putPixel(x, y+dy, bkcol);
692 ++x;
694 vline = true;
695 x += drawCharProp(x, y, ch, col, bkcol);
697 return x-sx;
700 int drawStrPropOut (int x, int y, string str, VColor col, VColor outcol=Transparent, ubyte ot=OutAll) @trusted {
701 int sx = x;
702 foreach (immutable char ch; str) {
703 x += drawCharPropOut(x, y, ch, col, outcol, ot)+1;
705 if (x > sx) --x; // don't count last empty pixel
706 return x-sx;
709 // ////////////////////////////////////////////////////////////////////////// //
710 void clear (VColor col) @trusted {
711 vbuf.ptr[0..vbufW*vbufH] = col;
715 // ////////////////////////////////////////////////////////////////////////// //
716 public immutable ubyte[256*8] vlFont6 = [
717 /* 0 */
718 0b_00000000,
719 0b_00000000,
720 0b_00000000,
721 0b_00000000,
722 0b_00000000,
723 0b_00000000,
724 0b_00000000,
725 0b_00000000,
726 /* 1 */
727 0b_00111100,
728 0b_01000010,
729 0b_10100101,
730 0b_10000001,
731 0b_10100101,
732 0b_10011001,
733 0b_01000010,
734 0b_00111100,
735 /* 2 */
736 0b_00111100,
737 0b_01111110,
738 0b_11011011,
739 0b_11111111,
740 0b_11111111,
741 0b_11011011,
742 0b_01100110,
743 0b_00111100,
744 /* 3 */
745 0b_01101100,
746 0b_11111110,
747 0b_11111110,
748 0b_11111110,
749 0b_01111100,
750 0b_00111000,
751 0b_00010000,
752 0b_00000000,
753 /* 4 */
754 0b_00010000,
755 0b_00111000,
756 0b_01111100,
757 0b_11111110,
758 0b_01111100,
759 0b_00111000,
760 0b_00010000,
761 0b_00000000,
762 /* 5 */
763 0b_00010000,
764 0b_00111000,
765 0b_01010100,
766 0b_11111110,
767 0b_01010100,
768 0b_00010000,
769 0b_00111000,
770 0b_00000000,
771 /* 6 */
772 0b_00010000,
773 0b_00111000,
774 0b_01111100,
775 0b_11111110,
776 0b_11111110,
777 0b_00010000,
778 0b_00111000,
779 0b_00000000,
780 /* 7 */
781 0b_00000000,
782 0b_00000000,
783 0b_00000000,
784 0b_00110000,
785 0b_00110000,
786 0b_00000000,
787 0b_00000000,
788 0b_00000000,
789 /* 8 */
790 0b_11111111,
791 0b_11111111,
792 0b_11111111,
793 0b_11100111,
794 0b_11100111,
795 0b_11111111,
796 0b_11111111,
797 0b_11111111,
798 /* 9 */
799 0b_00111000,
800 0b_01000100,
801 0b_10000010,
802 0b_10000010,
803 0b_10000010,
804 0b_01000100,
805 0b_00111000,
806 0b_00000000,
807 /* 10 */
808 0b_11000111,
809 0b_10111011,
810 0b_01111101,
811 0b_01111101,
812 0b_01111101,
813 0b_10111011,
814 0b_11000111,
815 0b_11111111,
816 /* 11 */
817 0b_00001111,
818 0b_00000011,
819 0b_00000101,
820 0b_01111001,
821 0b_10001000,
822 0b_10001000,
823 0b_10001000,
824 0b_01110000,
825 /* 12 */
826 0b_00111000,
827 0b_01000100,
828 0b_01000100,
829 0b_01000100,
830 0b_00111000,
831 0b_00010000,
832 0b_01111100,
833 0b_00010000,
834 /* 13 */
835 0b_00110000,
836 0b_00101000,
837 0b_00100100,
838 0b_00100100,
839 0b_00101000,
840 0b_00100000,
841 0b_11100000,
842 0b_11000000,
843 /* 14 */
844 0b_00111100,
845 0b_00100100,
846 0b_00111100,
847 0b_00100100,
848 0b_00100100,
849 0b_11100100,
850 0b_11011100,
851 0b_00011000,
852 /* 15 */
853 0b_00010000,
854 0b_01010100,
855 0b_00111000,
856 0b_11101110,
857 0b_00111000,
858 0b_01010100,
859 0b_00010000,
860 0b_00000000,
861 /* 16 */
862 0b_00010000,
863 0b_00010000,
864 0b_00010000,
865 0b_01111100,
866 0b_00010000,
867 0b_00010000,
868 0b_00010000,
869 0b_00010000,
870 /* 17 */
871 0b_00010000,
872 0b_00010000,
873 0b_00010000,
874 0b_11111111,
875 0b_00000000,
876 0b_00000000,
877 0b_00000000,
878 0b_00000000,
879 /* 18 */
880 0b_00000000,
881 0b_00000000,
882 0b_00000000,
883 0b_11111111,
884 0b_00010000,
885 0b_00010000,
886 0b_00010000,
887 0b_00010000,
888 /* 19 */
889 0b_00010000,
890 0b_00010000,
891 0b_00010000,
892 0b_11110000,
893 0b_00010000,
894 0b_00010000,
895 0b_00010000,
896 0b_00010000,
897 /* 20 */
898 0b_00010000,
899 0b_00010000,
900 0b_00010000,
901 0b_00011111,
902 0b_00010000,
903 0b_00010000,
904 0b_00010000,
905 0b_00010000,
906 /* 21 */
907 0b_00010000,
908 0b_00010000,
909 0b_00010000,
910 0b_11111111,
911 0b_00010000,
912 0b_00010000,
913 0b_00010000,
914 0b_00010000,
915 /* 22 */
916 0b_00010000,
917 0b_00010000,
918 0b_00010000,
919 0b_00010000,
920 0b_00010000,
921 0b_00010000,
922 0b_00010000,
923 0b_00010000,
924 /* 23 */
925 0b_00000000,
926 0b_00000000,
927 0b_00000000,
928 0b_11111111,
929 0b_00000000,
930 0b_00000000,
931 0b_00000000,
932 0b_00000000,
933 /* 24 */
934 0b_00000000,
935 0b_00000000,
936 0b_00000000,
937 0b_00011111,
938 0b_00010000,
939 0b_00010000,
940 0b_00010000,
941 0b_00010000,
942 /* 25 */
943 0b_00000000,
944 0b_00000000,
945 0b_00000000,
946 0b_11110000,
947 0b_00010000,
948 0b_00010000,
949 0b_00010000,
950 0b_00010000,
951 /* 26 */
952 0b_00010000,
953 0b_00010000,
954 0b_00010000,
955 0b_00011111,
956 0b_00000000,
957 0b_00000000,
958 0b_00000000,
959 0b_00000000,
960 /* 27 */
961 0b_00010000,
962 0b_00010000,
963 0b_00010000,
964 0b_11110000,
965 0b_00000000,
966 0b_00000000,
967 0b_00000000,
968 0b_00000000,
969 /* 28 */
970 0b_10000001,
971 0b_01000010,
972 0b_00100100,
973 0b_00011000,
974 0b_00011000,
975 0b_00100100,
976 0b_01000010,
977 0b_10000001,
978 /* 29 */
979 0b_00000001,
980 0b_00000010,
981 0b_00000100,
982 0b_00001000,
983 0b_00010000,
984 0b_00100000,
985 0b_01000000,
986 0b_10000000,
987 /* 30 */
988 0b_10000000,
989 0b_01000000,
990 0b_00100000,
991 0b_00010000,
992 0b_00001000,
993 0b_00000100,
994 0b_00000010,
995 0b_00000001,
996 /* 31 */
997 0b_00000000,
998 0b_00010000,
999 0b_00010000,
1000 0b_11111111,
1001 0b_00010000,
1002 0b_00010000,
1003 0b_00000000,
1004 0b_00000000,
1005 /* 32 ' ' */
1006 0b_00000000,
1007 0b_00000000,
1008 0b_00000000,
1009 0b_00000000,
1010 0b_00000000,
1011 0b_00000000,
1012 0b_00000000,
1013 0b_00000000,
1014 /* 33 '!' */
1015 0b_00100000,
1016 0b_00100000,
1017 0b_00100000,
1018 0b_00100000,
1019 0b_00000000,
1020 0b_00000000,
1021 0b_00100000,
1022 0b_00000000,
1023 /* 34 '"' */
1024 0b_01010000,
1025 0b_01010000,
1026 0b_01010000,
1027 0b_00000000,
1028 0b_00000000,
1029 0b_00000000,
1030 0b_00000000,
1031 0b_00000000,
1032 /* 35 '#' */
1033 0b_01010000,
1034 0b_01010000,
1035 0b_11111000,
1036 0b_01010000,
1037 0b_11111000,
1038 0b_01010000,
1039 0b_01010000,
1040 0b_00000000,
1041 /* 36 '$' */
1042 0b_00100000,
1043 0b_01111000,
1044 0b_10100000,
1045 0b_01110000,
1046 0b_00101000,
1047 0b_11110000,
1048 0b_00100000,
1049 0b_00000000,
1050 /* 37 '%' */
1051 0b_11000000,
1052 0b_11001000,
1053 0b_00010000,
1054 0b_00100000,
1055 0b_01000000,
1056 0b_10011000,
1057 0b_00011000,
1058 0b_00000000,
1059 /* 38 '&' */
1060 0b_01000000,
1061 0b_10100000,
1062 0b_01000000,
1063 0b_10101000,
1064 0b_10010000,
1065 0b_10011000,
1066 0b_01100000,
1067 0b_00000000,
1068 /* 39 ''' */
1069 0b_00010000,
1070 0b_00100000,
1071 0b_01000000,
1072 0b_00000000,
1073 0b_00000000,
1074 0b_00000000,
1075 0b_00000000,
1076 0b_00000000,
1077 /* 40 '(' */
1078 0b_00010000,
1079 0b_00100000,
1080 0b_01000000,
1081 0b_01000000,
1082 0b_01000000,
1083 0b_00100000,
1084 0b_00010000,
1085 0b_00000000,
1086 /* 41 ')' */
1087 0b_01000000,
1088 0b_00100000,
1089 0b_00010000,
1090 0b_00010000,
1091 0b_00010000,
1092 0b_00100000,
1093 0b_01000000,
1094 0b_00000000,
1095 /* 42 '*' */
1096 0b_10001000,
1097 0b_01010000,
1098 0b_00100000,
1099 0b_11111000,
1100 0b_00100000,
1101 0b_01010000,
1102 0b_10001000,
1103 0b_00000000,
1104 /* 43 '+' */
1105 0b_00000000,
1106 0b_00100000,
1107 0b_00100000,
1108 0b_11111000,
1109 0b_00100000,
1110 0b_00100000,
1111 0b_00000000,
1112 0b_00000000,
1113 /* 44 ',' */
1114 0b_00000000,
1115 0b_00000000,
1116 0b_00000000,
1117 0b_00000000,
1118 0b_00000000,
1119 0b_00100000,
1120 0b_00100000,
1121 0b_01000000,
1122 /* 45 '-' */
1123 0b_00000000,
1124 0b_00000000,
1125 0b_00000000,
1126 0b_01111000,
1127 0b_00000000,
1128 0b_00000000,
1129 0b_00000000,
1130 0b_00000000,
1131 /* 46 '.' */
1132 0b_00000000,
1133 0b_00000000,
1134 0b_00000000,
1135 0b_00000000,
1136 0b_00000000,
1137 0b_01100000,
1138 0b_01100000,
1139 0b_00000000,
1140 /* 47 '/' */
1141 0b_00000000,
1142 0b_00000000,
1143 0b_00001000,
1144 0b_00010000,
1145 0b_00100000,
1146 0b_01000000,
1147 0b_10000000,
1148 0b_00000000,
1149 /* 48 '0' */
1150 0b_01110000,
1151 0b_10001000,
1152 0b_10011000,
1153 0b_10101000,
1154 0b_11001000,
1155 0b_10001000,
1156 0b_01110000,
1157 0b_00000000,
1158 /* 49 '1' */
1159 0b_00100000,
1160 0b_01100000,
1161 0b_10100000,
1162 0b_00100000,
1163 0b_00100000,
1164 0b_00100000,
1165 0b_11111000,
1166 0b_00000000,
1167 /* 50 '2' */
1168 0b_01110000,
1169 0b_10001000,
1170 0b_00001000,
1171 0b_00010000,
1172 0b_01100000,
1173 0b_10000000,
1174 0b_11111000,
1175 0b_00000000,
1176 /* 51 '3' */
1177 0b_01110000,
1178 0b_10001000,
1179 0b_00001000,
1180 0b_00110000,
1181 0b_00001000,
1182 0b_10001000,
1183 0b_01110000,
1184 0b_00000000,
1185 /* 52 '4' */
1186 0b_00010000,
1187 0b_00110000,
1188 0b_01010000,
1189 0b_10010000,
1190 0b_11111000,
1191 0b_00010000,
1192 0b_00010000,
1193 0b_00000000,
1194 /* 53 '5' */
1195 0b_11111000,
1196 0b_10000000,
1197 0b_11100000,
1198 0b_00010000,
1199 0b_00001000,
1200 0b_00010000,
1201 0b_11100000,
1202 0b_00000000,
1203 /* 54 '6' */
1204 0b_00110000,
1205 0b_01000000,
1206 0b_10000000,
1207 0b_11110000,
1208 0b_10001000,
1209 0b_10001000,
1210 0b_01110000,
1211 0b_00000000,
1212 /* 55 '7' */
1213 0b_11111000,
1214 0b_10001000,
1215 0b_00010000,
1216 0b_00100000,
1217 0b_00100000,
1218 0b_00100000,
1219 0b_00100000,
1220 0b_00000000,
1221 /* 56 '8' */
1222 0b_01110000,
1223 0b_10001000,
1224 0b_10001000,
1225 0b_01110000,
1226 0b_10001000,
1227 0b_10001000,
1228 0b_01110000,
1229 0b_00000000,
1230 /* 57 '9' */
1231 0b_01110000,
1232 0b_10001000,
1233 0b_10001000,
1234 0b_01111000,
1235 0b_00001000,
1236 0b_00010000,
1237 0b_01100000,
1238 0b_00000000,
1239 /* 58 ':' */
1240 0b_00000000,
1241 0b_00000000,
1242 0b_00100000,
1243 0b_00000000,
1244 0b_00000000,
1245 0b_00100000,
1246 0b_00000000,
1247 0b_00000000,
1248 /* 59 ';' */
1249 0b_00000000,
1250 0b_00000000,
1251 0b_00100000,
1252 0b_00000000,
1253 0b_00000000,
1254 0b_00100000,
1255 0b_00100000,
1256 0b_01000000,
1257 /* 60 '<' */
1258 0b_00011000,
1259 0b_00110000,
1260 0b_01100000,
1261 0b_11000000,
1262 0b_01100000,
1263 0b_00110000,
1264 0b_00011000,
1265 0b_00000000,
1266 /* 61 '=' */
1267 0b_00000000,
1268 0b_00000000,
1269 0b_11111000,
1270 0b_00000000,
1271 0b_11111000,
1272 0b_00000000,
1273 0b_00000000,
1274 0b_00000000,
1275 /* 62 '>' */
1276 0b_11000000,
1277 0b_01100000,
1278 0b_00110000,
1279 0b_00011000,
1280 0b_00110000,
1281 0b_01100000,
1282 0b_11000000,
1283 0b_00000000,
1284 /* 63 '?' */
1285 0b_01110000,
1286 0b_10001000,
1287 0b_00001000,
1288 0b_00010000,
1289 0b_00100000,
1290 0b_00000000,
1291 0b_00100000,
1292 0b_00000000,
1293 /* 64 '@' */
1294 0b_01110000,
1295 0b_10001000,
1296 0b_00001000,
1297 0b_01101000,
1298 0b_10101000,
1299 0b_10101000,
1300 0b_01110000,
1301 0b_00000000,
1302 /* 65 'A' */
1303 0b_00100000,
1304 0b_01010000,
1305 0b_10001000,
1306 0b_10001000,
1307 0b_11111000,
1308 0b_10001000,
1309 0b_10001000,
1310 0b_00000000,
1311 /* 66 'B' */
1312 0b_11110000,
1313 0b_01001000,
1314 0b_01001000,
1315 0b_01110000,
1316 0b_01001000,
1317 0b_01001000,
1318 0b_11110000,
1319 0b_00000000,
1320 /* 67 'C' */
1321 0b_00110000,
1322 0b_01001000,
1323 0b_10000000,
1324 0b_10000000,
1325 0b_10000000,
1326 0b_01001000,
1327 0b_00110000,
1328 0b_00000000,
1329 /* 68 'D' */
1330 0b_11100000,
1331 0b_01010000,
1332 0b_01001000,
1333 0b_01001000,
1334 0b_01001000,
1335 0b_01010000,
1336 0b_11100000,
1337 0b_00000000,
1338 /* 69 'E' */
1339 0b_11111000,
1340 0b_10000000,
1341 0b_10000000,
1342 0b_11110000,
1343 0b_10000000,
1344 0b_10000000,
1345 0b_11111000,
1346 0b_00000000,
1347 /* 70 'F' */
1348 0b_11111000,
1349 0b_10000000,
1350 0b_10000000,
1351 0b_11110000,
1352 0b_10000000,
1353 0b_10000000,
1354 0b_10000000,
1355 0b_00000000,
1356 /* 71 'G' */
1357 0b_01110000,
1358 0b_10001000,
1359 0b_10000000,
1360 0b_10111000,
1361 0b_10001000,
1362 0b_10001000,
1363 0b_01110000,
1364 0b_00000000,
1365 /* 72 'H' */
1366 0b_10001000,
1367 0b_10001000,
1368 0b_10001000,
1369 0b_11111000,
1370 0b_10001000,
1371 0b_10001000,
1372 0b_10001000,
1373 0b_00000000,
1374 /* 73 'I' */
1375 0b_01110000,
1376 0b_00100000,
1377 0b_00100000,
1378 0b_00100000,
1379 0b_00100000,
1380 0b_00100000,
1381 0b_01110000,
1382 0b_00000000,
1383 /* 74 'J' */
1384 0b_00111000,
1385 0b_00010000,
1386 0b_00010000,
1387 0b_00010000,
1388 0b_10010000,
1389 0b_10010000,
1390 0b_01100000,
1391 0b_00000000,
1392 /* 75 'K' */
1393 0b_10001000,
1394 0b_10010000,
1395 0b_10100000,
1396 0b_11000000,
1397 0b_10100000,
1398 0b_10010000,
1399 0b_10001000,
1400 0b_00000000,
1401 /* 76 'L' */
1402 0b_10000000,
1403 0b_10000000,
1404 0b_10000000,
1405 0b_10000000,
1406 0b_10000000,
1407 0b_10000000,
1408 0b_11111000,
1409 0b_00000000,
1410 /* 77 'M' */
1411 0b_10001000,
1412 0b_11011000,
1413 0b_10101000,
1414 0b_10101000,
1415 0b_10001000,
1416 0b_10001000,
1417 0b_10001000,
1418 0b_00000000,
1419 /* 78 'N' */
1420 0b_10001000,
1421 0b_11001000,
1422 0b_11001000,
1423 0b_10101000,
1424 0b_10011000,
1425 0b_10011000,
1426 0b_10001000,
1427 0b_00000000,
1428 /* 79 'O' */
1429 0b_01110000,
1430 0b_10001000,
1431 0b_10001000,
1432 0b_10001000,
1433 0b_10001000,
1434 0b_10001000,
1435 0b_01110000,
1436 0b_00000000,
1437 /* 80 'P' */
1438 0b_11110000,
1439 0b_10001000,
1440 0b_10001000,
1441 0b_11110000,
1442 0b_10000000,
1443 0b_10000000,
1444 0b_10000000,
1445 0b_00000000,
1446 /* 81 'Q' */
1447 0b_01110000,
1448 0b_10001000,
1449 0b_10001000,
1450 0b_10001000,
1451 0b_10101000,
1452 0b_10010000,
1453 0b_01101000,
1454 0b_00000000,
1455 /* 82 'R' */
1456 0b_11110000,
1457 0b_10001000,
1458 0b_10001000,
1459 0b_11110000,
1460 0b_10100000,
1461 0b_10010000,
1462 0b_10001000,
1463 0b_00000000,
1464 /* 83 'S' */
1465 0b_01110000,
1466 0b_10001000,
1467 0b_10000000,
1468 0b_01110000,
1469 0b_00001000,
1470 0b_10001000,
1471 0b_01110000,
1472 0b_00000000,
1473 /* 84 'T' */
1474 0b_11111000,
1475 0b_00100000,
1476 0b_00100000,
1477 0b_00100000,
1478 0b_00100000,
1479 0b_00100000,
1480 0b_00100000,
1481 0b_00000000,
1482 /* 85 'U' */
1483 0b_10001000,
1484 0b_10001000,
1485 0b_10001000,
1486 0b_10001000,
1487 0b_10001000,
1488 0b_10001000,
1489 0b_01110000,
1490 0b_00000000,
1491 /* 86 'V' */
1492 0b_10001000,
1493 0b_10001000,
1494 0b_10001000,
1495 0b_10001000,
1496 0b_01010000,
1497 0b_01010000,
1498 0b_00100000,
1499 0b_00000000,
1500 /* 87 'W' */
1501 0b_10001000,
1502 0b_10001000,
1503 0b_10001000,
1504 0b_10101000,
1505 0b_10101000,
1506 0b_11011000,
1507 0b_10001000,
1508 0b_00000000,
1509 /* 88 'X' */
1510 0b_10001000,
1511 0b_10001000,
1512 0b_01010000,
1513 0b_00100000,
1514 0b_01010000,
1515 0b_10001000,
1516 0b_10001000,
1517 0b_00000000,
1518 /* 89 'Y' */
1519 0b_10001000,
1520 0b_10001000,
1521 0b_10001000,
1522 0b_01110000,
1523 0b_00100000,
1524 0b_00100000,
1525 0b_00100000,
1526 0b_00000000,
1527 /* 90 'Z' */
1528 0b_11111000,
1529 0b_00001000,
1530 0b_00010000,
1531 0b_00100000,
1532 0b_01000000,
1533 0b_10000000,
1534 0b_11111000,
1535 0b_00000000,
1536 /* 91 '[' */
1537 0b_01110000,
1538 0b_01000000,
1539 0b_01000000,
1540 0b_01000000,
1541 0b_01000000,
1542 0b_01000000,
1543 0b_01110000,
1544 0b_00000000,
1545 /* 92 '\' */
1546 0b_00000000,
1547 0b_00000000,
1548 0b_10000000,
1549 0b_01000000,
1550 0b_00100000,
1551 0b_00010000,
1552 0b_00001000,
1553 0b_00000000,
1554 /* 93 ']' */
1555 0b_01110000,
1556 0b_00010000,
1557 0b_00010000,
1558 0b_00010000,
1559 0b_00010000,
1560 0b_00010000,
1561 0b_01110000,
1562 0b_00000000,
1563 /* 94 '^' */
1564 0b_00100000,
1565 0b_01010000,
1566 0b_10001000,
1567 0b_00000000,
1568 0b_00000000,
1569 0b_00000000,
1570 0b_00000000,
1571 0b_00000000,
1572 /* 95 '_' */
1573 0b_00000000,
1574 0b_00000000,
1575 0b_00000000,
1576 0b_00000000,
1577 0b_00000000,
1578 0b_00000000,
1579 0b_11111000,
1580 0b_00000000,
1581 /* 96 '`' */
1582 0b_01000000,
1583 0b_00100000,
1584 0b_00010000,
1585 0b_00000000,
1586 0b_00000000,
1587 0b_00000000,
1588 0b_00000000,
1589 0b_00000000,
1590 /* 97 'a' */
1591 0b_00000000,
1592 0b_00000000,
1593 0b_01110000,
1594 0b_00001000,
1595 0b_01111000,
1596 0b_10001000,
1597 0b_01111000,
1598 0b_00000000,
1599 /* 98 'b' */
1600 0b_10000000,
1601 0b_10000000,
1602 0b_10110000,
1603 0b_11001000,
1604 0b_10001000,
1605 0b_11001000,
1606 0b_10110000,
1607 0b_00000000,
1608 /* 99 'c' */
1609 0b_00000000,
1610 0b_00000000,
1611 0b_01110000,
1612 0b_10001000,
1613 0b_10000000,
1614 0b_10001000,
1615 0b_01110000,
1616 0b_00000000,
1617 /* 100 'd' */
1618 0b_00001000,
1619 0b_00001000,
1620 0b_01101000,
1621 0b_10011000,
1622 0b_10001000,
1623 0b_10011000,
1624 0b_01101000,
1625 0b_00000000,
1626 /* 101 'e' */
1627 0b_00000000,
1628 0b_00000000,
1629 0b_01110000,
1630 0b_10001000,
1631 0b_11111000,
1632 0b_10000000,
1633 0b_01110000,
1634 0b_00000000,
1635 /* 102 'f' */
1636 0b_00010000,
1637 0b_00101000,
1638 0b_00100000,
1639 0b_11111000,
1640 0b_00100000,
1641 0b_00100000,
1642 0b_00100000,
1643 0b_00000000,
1644 /* 103 'g' */
1645 0b_00000000,
1646 0b_00000000,
1647 0b_01101000,
1648 0b_10011000,
1649 0b_10011000,
1650 0b_01101000,
1651 0b_00001000,
1652 0b_01110000,
1653 /* 104 'h' */
1654 0b_10000000,
1655 0b_10000000,
1656 0b_11110000,
1657 0b_10001000,
1658 0b_10001000,
1659 0b_10001000,
1660 0b_10001000,
1661 0b_00000000,
1662 /* 105 'i' */
1663 0b_00100000,
1664 0b_00000000,
1665 0b_01100000,
1666 0b_00100000,
1667 0b_00100000,
1668 0b_00100000,
1669 0b_01110000,
1670 0b_00000000,
1671 /* 106 'j' */
1672 0b_00010000,
1673 0b_00000000,
1674 0b_00110000,
1675 0b_00010000,
1676 0b_00010000,
1677 0b_00010000,
1678 0b_10010000,
1679 0b_01100000,
1680 /* 107 'k' */
1681 0b_01000000,
1682 0b_01000000,
1683 0b_01001000,
1684 0b_01010000,
1685 0b_01100000,
1686 0b_01010000,
1687 0b_01001000,
1688 0b_00000000,
1689 /* 108 'l' */
1690 0b_01100000,
1691 0b_00100000,
1692 0b_00100000,
1693 0b_00100000,
1694 0b_00100000,
1695 0b_00100000,
1696 0b_01110000,
1697 0b_00000000,
1698 /* 109 'm' */
1699 0b_00000000,
1700 0b_00000000,
1701 0b_11010000,
1702 0b_10101000,
1703 0b_10101000,
1704 0b_10101000,
1705 0b_10101000,
1706 0b_00000000,
1707 /* 110 'n' */
1708 0b_00000000,
1709 0b_00000000,
1710 0b_10110000,
1711 0b_11001000,
1712 0b_10001000,
1713 0b_10001000,
1714 0b_10001000,
1715 0b_00000000,
1716 /* 111 'o' */
1717 0b_00000000,
1718 0b_00000000,
1719 0b_01110000,
1720 0b_10001000,
1721 0b_10001000,
1722 0b_10001000,
1723 0b_01110000,
1724 0b_00000000,
1725 /* 112 'p' */
1726 0b_00000000,
1727 0b_00000000,
1728 0b_10110000,
1729 0b_11001000,
1730 0b_11001000,
1731 0b_10110000,
1732 0b_10000000,
1733 0b_10000000,
1734 /* 113 'q' */
1735 0b_00000000,
1736 0b_00000000,
1737 0b_01101000,
1738 0b_10011000,
1739 0b_10011000,
1740 0b_01101000,
1741 0b_00001000,
1742 0b_00001000,
1743 /* 114 'r' */
1744 0b_00000000,
1745 0b_00000000,
1746 0b_10110000,
1747 0b_11001000,
1748 0b_10000000,
1749 0b_10000000,
1750 0b_10000000,
1751 0b_00000000,
1752 /* 115 's' */
1753 0b_00000000,
1754 0b_00000000,
1755 0b_01111000,
1756 0b_10000000,
1757 0b_11110000,
1758 0b_00001000,
1759 0b_11110000,
1760 0b_00000000,
1761 /* 116 't' */
1762 0b_01000000,
1763 0b_01000000,
1764 0b_11110000,
1765 0b_01000000,
1766 0b_01000000,
1767 0b_01001000,
1768 0b_00110000,
1769 0b_00000000,
1770 /* 117 'u' */
1771 0b_00000000,
1772 0b_00000000,
1773 0b_10010000,
1774 0b_10010000,
1775 0b_10010000,
1776 0b_10010000,
1777 0b_01101000,
1778 0b_00000000,
1779 /* 118 'v' */
1780 0b_00000000,
1781 0b_00000000,
1782 0b_10001000,
1783 0b_10001000,
1784 0b_10001000,
1785 0b_01010000,
1786 0b_00100000,
1787 0b_00000000,
1788 /* 119 'w' */
1789 0b_00000000,
1790 0b_00000000,
1791 0b_10001000,
1792 0b_10101000,
1793 0b_10101000,
1794 0b_10101000,
1795 0b_01010000,
1796 0b_00000000,
1797 /* 120 'x' */
1798 0b_00000000,
1799 0b_00000000,
1800 0b_10001000,
1801 0b_01010000,
1802 0b_00100000,
1803 0b_01010000,
1804 0b_10001000,
1805 0b_00000000,
1806 /* 121 'y' */
1807 0b_00000000,
1808 0b_00000000,
1809 0b_10001000,
1810 0b_10001000,
1811 0b_10011000,
1812 0b_01101000,
1813 0b_00001000,
1814 0b_01110000,
1815 /* 122 'z' */
1816 0b_00000000,
1817 0b_00000000,
1818 0b_11111000,
1819 0b_00010000,
1820 0b_00100000,
1821 0b_01000000,
1822 0b_11111000,
1823 0b_00000000,
1824 /* 123 '{' */
1825 0b_00011000,
1826 0b_00100000,
1827 0b_00100000,
1828 0b_01000000,
1829 0b_00100000,
1830 0b_00100000,
1831 0b_00011000,
1832 0b_00000000,
1833 /* 124 '|' */
1834 0b_00100000,
1835 0b_00100000,
1836 0b_00100000,
1837 0b_00000000,
1838 0b_00100000,
1839 0b_00100000,
1840 0b_00100000,
1841 0b_00000000,
1842 /* 125 '}' */
1843 0b_11000000,
1844 0b_00100000,
1845 0b_00100000,
1846 0b_00010000,
1847 0b_00100000,
1848 0b_00100000,
1849 0b_11000000,
1850 0b_00000000,
1851 /* 126 '~' */
1852 0b_01000000,
1853 0b_10101000,
1854 0b_00010000,
1855 0b_00000000,
1856 0b_00000000,
1857 0b_00000000,
1858 0b_00000000,
1859 0b_00000000,
1860 /* 127 */
1861 0b_00000000,
1862 0b_00000000,
1863 0b_00100000,
1864 0b_01010000,
1865 0b_11111000,
1866 0b_00000000,
1867 0b_00000000,
1868 0b_00000000,
1869 /* 128 */
1870 0b_00000000,
1871 0b_00000000,
1872 0b_00000000,
1873 0b_00000000,
1874 0b_00000000,
1875 0b_00000000,
1876 0b_11111111,
1877 0b_11111111,
1878 /* 129 */
1879 0b_11110000,
1880 0b_11110000,
1881 0b_11110000,
1882 0b_11110000,
1883 0b_00001111,
1884 0b_00001111,
1885 0b_00001111,
1886 0b_00001111,
1887 /* 130 */
1888 0b_00000000,
1889 0b_00000000,
1890 0b_11111111,
1891 0b_11111111,
1892 0b_11111111,
1893 0b_11111111,
1894 0b_11111111,
1895 0b_11111111,
1896 /* 131 */
1897 0b_11111111,
1898 0b_11111111,
1899 0b_00000000,
1900 0b_00000000,
1901 0b_00000000,
1902 0b_00000000,
1903 0b_00000000,
1904 0b_00000000,
1905 /* 132 */
1906 0b_00000000,
1907 0b_00000000,
1908 0b_00000000,
1909 0b_00111100,
1910 0b_00111100,
1911 0b_00000000,
1912 0b_00000000,
1913 0b_00000000,
1914 /* 133 */
1915 0b_11111111,
1916 0b_11111111,
1917 0b_11111111,
1918 0b_11111111,
1919 0b_11111111,
1920 0b_11111111,
1921 0b_00000000,
1922 0b_00000000,
1923 /* 134 */
1924 0b_11000000,
1925 0b_11000000,
1926 0b_11000000,
1927 0b_11000000,
1928 0b_11000000,
1929 0b_11000000,
1930 0b_11000000,
1931 0b_11000000,
1932 /* 135 */
1933 0b_00001111,
1934 0b_00001111,
1935 0b_00001111,
1936 0b_00001111,
1937 0b_11110000,
1938 0b_11110000,
1939 0b_11110000,
1940 0b_11110000,
1941 /* 136 */
1942 0b_11111100,
1943 0b_11111100,
1944 0b_11111100,
1945 0b_11111100,
1946 0b_11111100,
1947 0b_11111100,
1948 0b_11111100,
1949 0b_11111100,
1950 /* 137 */
1951 0b_00000011,
1952 0b_00000011,
1953 0b_00000011,
1954 0b_00000011,
1955 0b_00000011,
1956 0b_00000011,
1957 0b_00000011,
1958 0b_00000011,
1959 /* 138 */
1960 0b_00111111,
1961 0b_00111111,
1962 0b_00111111,
1963 0b_00111111,
1964 0b_00111111,
1965 0b_00111111,
1966 0b_00111111,
1967 0b_00111111,
1968 /* 139 */
1969 0b_00010001,
1970 0b_00100010,
1971 0b_01000100,
1972 0b_10001000,
1973 0b_00010001,
1974 0b_00100010,
1975 0b_01000100,
1976 0b_10001000,
1977 /* 140 */
1978 0b_10001000,
1979 0b_01000100,
1980 0b_00100010,
1981 0b_00010001,
1982 0b_10001000,
1983 0b_01000100,
1984 0b_00100010,
1985 0b_00010001,
1986 /* 141 */
1987 0b_11111110,
1988 0b_01111100,
1989 0b_00111000,
1990 0b_00010000,
1991 0b_00000000,
1992 0b_00000000,
1993 0b_00000000,
1994 0b_00000000,
1995 /* 142 */
1996 0b_00000000,
1997 0b_00000000,
1998 0b_00000000,
1999 0b_00000000,
2000 0b_00010000,
2001 0b_00111000,
2002 0b_01111100,
2003 0b_11111110,
2004 /* 143 */
2005 0b_10000000,
2006 0b_11000000,
2007 0b_11100000,
2008 0b_11110000,
2009 0b_11100000,
2010 0b_11000000,
2011 0b_10000000,
2012 0b_00000000,
2013 /* 144 */
2014 0b_00000001,
2015 0b_00000011,
2016 0b_00000111,
2017 0b_00001111,
2018 0b_00000111,
2019 0b_00000011,
2020 0b_00000001,
2021 0b_00000000,
2022 /* 145 */
2023 0b_11111111,
2024 0b_01111110,
2025 0b_00111100,
2026 0b_00011000,
2027 0b_00011000,
2028 0b_00111100,
2029 0b_01111110,
2030 0b_11111111,
2031 /* 146 */
2032 0b_10000001,
2033 0b_11000011,
2034 0b_11100111,
2035 0b_11111111,
2036 0b_11111111,
2037 0b_11100111,
2038 0b_11000011,
2039 0b_10000001,
2040 /* 147 */
2041 0b_11110000,
2042 0b_11110000,
2043 0b_11110000,
2044 0b_11110000,
2045 0b_00000000,
2046 0b_00000000,
2047 0b_00000000,
2048 0b_00000000,
2049 /* 148 */
2050 0b_00000000,
2051 0b_00000000,
2052 0b_00000000,
2053 0b_00000000,
2054 0b_00001111,
2055 0b_00001111,
2056 0b_00001111,
2057 0b_00001111,
2058 /* 149 */
2059 0b_00001111,
2060 0b_00001111,
2061 0b_00001111,
2062 0b_00001111,
2063 0b_00000000,
2064 0b_00000000,
2065 0b_00000000,
2066 0b_00000000,
2067 /* 150 */
2068 0b_00000000,
2069 0b_00000000,
2070 0b_00000000,
2071 0b_00000000,
2072 0b_11110000,
2073 0b_11110000,
2074 0b_11110000,
2075 0b_11110000,
2076 /* 151 */
2077 0b_00110011,
2078 0b_00110011,
2079 0b_11001100,
2080 0b_11001100,
2081 0b_00110011,
2082 0b_00110011,
2083 0b_11001100,
2084 0b_11001100,
2085 /* 152 */
2086 0b_00000000,
2087 0b_00100000,
2088 0b_00100000,
2089 0b_01010000,
2090 0b_01010000,
2091 0b_10001000,
2092 0b_11111000,
2093 0b_00000000,
2094 /* 153 */
2095 0b_00100000,
2096 0b_00100000,
2097 0b_01110000,
2098 0b_00100000,
2099 0b_01110000,
2100 0b_00100000,
2101 0b_00100000,
2102 0b_00000000,
2103 /* 154 */
2104 0b_00000000,
2105 0b_00000000,
2106 0b_00000000,
2107 0b_01010000,
2108 0b_10001000,
2109 0b_10101000,
2110 0b_01010000,
2111 0b_00000000,
2112 /* 155 */
2113 0b_11111111,
2114 0b_11111111,
2115 0b_11111111,
2116 0b_11111111,
2117 0b_11111111,
2118 0b_11111111,
2119 0b_11111111,
2120 0b_11111111,
2121 /* 156 */
2122 0b_00000000,
2123 0b_00000000,
2124 0b_00000000,
2125 0b_00000000,
2126 0b_11111111,
2127 0b_11111111,
2128 0b_11111111,
2129 0b_11111111,
2130 /* 157 */
2131 0b_11110000,
2132 0b_11110000,
2133 0b_11110000,
2134 0b_11110000,
2135 0b_11110000,
2136 0b_11110000,
2137 0b_11110000,
2138 0b_11110000,
2139 /* 158 */
2140 0b_00001111,
2141 0b_00001111,
2142 0b_00001111,
2143 0b_00001111,
2144 0b_00001111,
2145 0b_00001111,
2146 0b_00001111,
2147 0b_00001111,
2148 /* 159 */
2149 0b_11111111,
2150 0b_11111111,
2151 0b_11111111,
2152 0b_11111111,
2153 0b_00000000,
2154 0b_00000000,
2155 0b_00000000,
2156 0b_00000000,
2157 /* 160 */
2158 0b_00000000,
2159 0b_00000000,
2160 0b_01101000,
2161 0b_10010000,
2162 0b_10010000,
2163 0b_10010000,
2164 0b_01101000,
2165 0b_00000000,
2166 /* 161 */
2167 0b_00110000,
2168 0b_01001000,
2169 0b_01001000,
2170 0b_01110000,
2171 0b_01001000,
2172 0b_01001000,
2173 0b_01110000,
2174 0b_11000000,
2175 /* 162 */
2176 0b_11111000,
2177 0b_10001000,
2178 0b_10000000,
2179 0b_10000000,
2180 0b_10000000,
2181 0b_10000000,
2182 0b_10000000,
2183 0b_00000000,
2184 /* 163 */
2185 0b_00000000,
2186 0b_01010000,
2187 0b_01110000,
2188 0b_10001000,
2189 0b_11111000,
2190 0b_10000000,
2191 0b_01110000,
2192 0b_00000000,
2193 /* 164 */
2194 0b_00000000,
2195 0b_00000000,
2196 0b_01111000,
2197 0b_10000000,
2198 0b_11110000,
2199 0b_10000000,
2200 0b_01111000,
2201 0b_00000000,
2202 /* 165 */
2203 0b_00000000,
2204 0b_00000000,
2205 0b_01111000,
2206 0b_10010000,
2207 0b_10010000,
2208 0b_10010000,
2209 0b_01100000,
2210 0b_00000000,
2211 /* 166 */
2212 0b_00100000,
2213 0b_00000000,
2214 0b_01100000,
2215 0b_00100000,
2216 0b_00100000,
2217 0b_00100000,
2218 0b_01110000,
2219 0b_00000000,
2220 /* 167 */
2221 0b_01010000,
2222 0b_00000000,
2223 0b_01110000,
2224 0b_00100000,
2225 0b_00100000,
2226 0b_00100000,
2227 0b_01110000,
2228 0b_00000000,
2229 /* 168 */
2230 0b_11111000,
2231 0b_00100000,
2232 0b_01110000,
2233 0b_10101000,
2234 0b_10101000,
2235 0b_01110000,
2236 0b_00100000,
2237 0b_11111000,
2238 /* 169 */
2239 0b_00100000,
2240 0b_01010000,
2241 0b_10001000,
2242 0b_11111000,
2243 0b_10001000,
2244 0b_01010000,
2245 0b_00100000,
2246 0b_00000000,
2247 /* 170 */
2248 0b_01110000,
2249 0b_10001000,
2250 0b_10001000,
2251 0b_10001000,
2252 0b_01010000,
2253 0b_01010000,
2254 0b_11011000,
2255 0b_00000000,
2256 /* 171 */
2257 0b_00110000,
2258 0b_01000000,
2259 0b_01000000,
2260 0b_00100000,
2261 0b_01010000,
2262 0b_01010000,
2263 0b_01010000,
2264 0b_00100000,
2265 /* 172 */
2266 0b_00000000,
2267 0b_00000000,
2268 0b_00000000,
2269 0b_01010000,
2270 0b_10101000,
2271 0b_10101000,
2272 0b_01010000,
2273 0b_00000000,
2274 /* 173 */
2275 0b_00001000,
2276 0b_01110000,
2277 0b_10101000,
2278 0b_10101000,
2279 0b_10101000,
2280 0b_01110000,
2281 0b_10000000,
2282 0b_00000000,
2283 /* 174 */
2284 0b_00111000,
2285 0b_01000000,
2286 0b_10000000,
2287 0b_11111000,
2288 0b_10000000,
2289 0b_01000000,
2290 0b_00111000,
2291 0b_00000000,
2292 /* 175 */
2293 0b_01110000,
2294 0b_10001000,
2295 0b_10001000,
2296 0b_10001000,
2297 0b_10001000,
2298 0b_10001000,
2299 0b_10001000,
2300 0b_00000000,
2301 /* 176 */
2302 0b_00000000,
2303 0b_11111000,
2304 0b_00000000,
2305 0b_11111000,
2306 0b_00000000,
2307 0b_11111000,
2308 0b_00000000,
2309 0b_00000000,
2310 /* 177 */
2311 0b_00100000,
2312 0b_00100000,
2313 0b_11111000,
2314 0b_00100000,
2315 0b_00100000,
2316 0b_00000000,
2317 0b_11111000,
2318 0b_00000000,
2319 /* 178 */
2320 0b_11000000,
2321 0b_00110000,
2322 0b_00001000,
2323 0b_00110000,
2324 0b_11000000,
2325 0b_00000000,
2326 0b_11111000,
2327 0b_00000000,
2328 /* 179 */
2329 0b_01010000,
2330 0b_11111000,
2331 0b_10000000,
2332 0b_11110000,
2333 0b_10000000,
2334 0b_10000000,
2335 0b_11111000,
2336 0b_00000000,
2337 /* 180 */
2338 0b_01111000,
2339 0b_10000000,
2340 0b_10000000,
2341 0b_11110000,
2342 0b_10000000,
2343 0b_10000000,
2344 0b_01111000,
2345 0b_00000000,
2346 /* 181 */
2347 0b_00100000,
2348 0b_00100000,
2349 0b_00100000,
2350 0b_00100000,
2351 0b_00100000,
2352 0b_00100000,
2353 0b_10100000,
2354 0b_01000000,
2355 /* 182 */
2356 0b_01110000,
2357 0b_00100000,
2358 0b_00100000,
2359 0b_00100000,
2360 0b_00100000,
2361 0b_00100000,
2362 0b_01110000,
2363 0b_00000000,
2364 /* 183 */
2365 0b_01010000,
2366 0b_01110000,
2367 0b_00100000,
2368 0b_00100000,
2369 0b_00100000,
2370 0b_00100000,
2371 0b_01110000,
2372 0b_00000000,
2373 /* 184 */
2374 0b_00000000,
2375 0b_00011000,
2376 0b_00100100,
2377 0b_00100100,
2378 0b_00011000,
2379 0b_00000000,
2380 0b_00000000,
2381 0b_00000000,
2382 /* 185 */
2383 0b_00000000,
2384 0b_00110000,
2385 0b_01111000,
2386 0b_01111000,
2387 0b_00110000,
2388 0b_00000000,
2389 0b_00000000,
2390 0b_00000000,
2391 /* 186 */
2392 0b_00000000,
2393 0b_00000000,
2394 0b_00000000,
2395 0b_00000000,
2396 0b_00110000,
2397 0b_00000000,
2398 0b_00000000,
2399 0b_00000000,
2400 /* 187 */
2401 0b_00111110,
2402 0b_00100000,
2403 0b_00100000,
2404 0b_00100000,
2405 0b_10100000,
2406 0b_01100000,
2407 0b_00100000,
2408 0b_00000000,
2409 /* 188 */
2410 0b_10100000,
2411 0b_01010000,
2412 0b_01010000,
2413 0b_01010000,
2414 0b_00000000,
2415 0b_00000000,
2416 0b_00000000,
2417 0b_00000000,
2418 /* 189 */
2419 0b_01000000,
2420 0b_10100000,
2421 0b_00100000,
2422 0b_01000000,
2423 0b_11100000,
2424 0b_00000000,
2425 0b_00000000,
2426 0b_00000000,
2427 /* 190 */
2428 0b_00000000,
2429 0b_00111000,
2430 0b_00111000,
2431 0b_00111000,
2432 0b_00111000,
2433 0b_00111000,
2434 0b_00111000,
2435 0b_00000000,
2436 /* 191 */
2437 0b_00111100,
2438 0b_01000010,
2439 0b_10011001,
2440 0b_10100001,
2441 0b_10100001,
2442 0b_10011001,
2443 0b_01000010,
2444 0b_00111100,
2445 /* 192 */
2446 0b_00000000,
2447 0b_00000000,
2448 0b_10010000,
2449 0b_10101000,
2450 0b_11101000,
2451 0b_10101000,
2452 0b_10010000,
2453 0b_00000000,
2454 /* 193 */
2455 0b_00000000,
2456 0b_00000000,
2457 0b_01100000,
2458 0b_00010000,
2459 0b_01110000,
2460 0b_10010000,
2461 0b_01101000,
2462 0b_00000000,
2463 /* 194 */
2464 0b_00000000,
2465 0b_00000000,
2466 0b_11110000,
2467 0b_10000000,
2468 0b_11110000,
2469 0b_10001000,
2470 0b_11110000,
2471 0b_00000000,
2472 /* 195 */
2473 0b_00000000,
2474 0b_00000000,
2475 0b_10010000,
2476 0b_10010000,
2477 0b_10010000,
2478 0b_11111000,
2479 0b_00001000,
2480 0b_00000000,
2481 /* 196 */
2482 0b_00000000,
2483 0b_00000000,
2484 0b_00110000,
2485 0b_01010000,
2486 0b_01010000,
2487 0b_01110000,
2488 0b_10001000,
2489 0b_00000000,
2490 /* 197 */
2491 0b_00000000,
2492 0b_00000000,
2493 0b_01110000,
2494 0b_10001000,
2495 0b_11111000,
2496 0b_10000000,
2497 0b_01110000,
2498 0b_00000000,
2499 /* 198 */
2500 0b_00000000,
2501 0b_00100000,
2502 0b_01110000,
2503 0b_10101000,
2504 0b_10101000,
2505 0b_01110000,
2506 0b_00100000,
2507 0b_00000000,
2508 /* 199 */
2509 0b_00000000,
2510 0b_00000000,
2511 0b_01111000,
2512 0b_01001000,
2513 0b_01000000,
2514 0b_01000000,
2515 0b_01000000,
2516 0b_00000000,
2517 /* 200 */
2518 0b_00000000,
2519 0b_00000000,
2520 0b_10001000,
2521 0b_01010000,
2522 0b_00100000,
2523 0b_01010000,
2524 0b_10001000,
2525 0b_00000000,
2526 /* 201 */
2527 0b_00000000,
2528 0b_00000000,
2529 0b_10001000,
2530 0b_10011000,
2531 0b_10101000,
2532 0b_11001000,
2533 0b_10001000,
2534 0b_00000000,
2535 /* 202 */
2536 0b_00000000,
2537 0b_01010000,
2538 0b_00100000,
2539 0b_00000000,
2540 0b_10011000,
2541 0b_10101000,
2542 0b_11001000,
2543 0b_00000000,
2544 /* 203 */
2545 0b_00000000,
2546 0b_00000000,
2547 0b_10010000,
2548 0b_10100000,
2549 0b_11000000,
2550 0b_10100000,
2551 0b_10010000,
2552 0b_00000000,
2553 /* 204 */
2554 0b_00000000,
2555 0b_00000000,
2556 0b_00111000,
2557 0b_00101000,
2558 0b_00101000,
2559 0b_01001000,
2560 0b_10001000,
2561 0b_00000000,
2562 /* 205 */
2563 0b_00000000,
2564 0b_00000000,
2565 0b_10001000,
2566 0b_11011000,
2567 0b_10101000,
2568 0b_10001000,
2569 0b_10001000,
2570 0b_00000000,
2571 /* 206 */
2572 0b_00000000,
2573 0b_00000000,
2574 0b_10001000,
2575 0b_10001000,
2576 0b_11111000,
2577 0b_10001000,
2578 0b_10001000,
2579 0b_00000000,
2580 /* 207 */
2581 0b_00000000,
2582 0b_00000000,
2583 0b_01110000,
2584 0b_10001000,
2585 0b_10001000,
2586 0b_10001000,
2587 0b_01110000,
2588 0b_00000000,
2589 /* 208 */
2590 0b_00000000,
2591 0b_00000000,
2592 0b_01111000,
2593 0b_01001000,
2594 0b_01001000,
2595 0b_01001000,
2596 0b_01001000,
2597 0b_00000000,
2598 /* 209 */
2599 0b_00000000,
2600 0b_00000000,
2601 0b_01111000,
2602 0b_10001000,
2603 0b_01111000,
2604 0b_00101000,
2605 0b_01001000,
2606 0b_00000000,
2607 /* 210 */
2608 0b_00000000,
2609 0b_00000000,
2610 0b_11110000,
2611 0b_10001000,
2612 0b_11110000,
2613 0b_10000000,
2614 0b_10000000,
2615 0b_00000000,
2616 /* 211 */
2617 0b_00000000,
2618 0b_00000000,
2619 0b_01111000,
2620 0b_10000000,
2621 0b_10000000,
2622 0b_10000000,
2623 0b_01111000,
2624 0b_00000000,
2625 /* 212 */
2626 0b_00000000,
2627 0b_00000000,
2628 0b_11111000,
2629 0b_00100000,
2630 0b_00100000,
2631 0b_00100000,
2632 0b_00100000,
2633 0b_00000000,
2634 /* 213 */
2635 0b_00000000,
2636 0b_00000000,
2637 0b_10001000,
2638 0b_01010000,
2639 0b_00100000,
2640 0b_01000000,
2641 0b_10000000,
2642 0b_00000000,
2643 /* 214 */
2644 0b_00000000,
2645 0b_00000000,
2646 0b_10101000,
2647 0b_01110000,
2648 0b_00100000,
2649 0b_01110000,
2650 0b_10101000,
2651 0b_00000000,
2652 /* 215 */
2653 0b_00000000,
2654 0b_00000000,
2655 0b_11110000,
2656 0b_01001000,
2657 0b_01110000,
2658 0b_01001000,
2659 0b_11110000,
2660 0b_00000000,
2661 /* 216 */
2662 0b_00000000,
2663 0b_00000000,
2664 0b_01000000,
2665 0b_01000000,
2666 0b_01110000,
2667 0b_01001000,
2668 0b_01110000,
2669 0b_00000000,
2670 /* 217 */
2671 0b_00000000,
2672 0b_00000000,
2673 0b_10001000,
2674 0b_10001000,
2675 0b_11001000,
2676 0b_10101000,
2677 0b_11001000,
2678 0b_00000000,
2679 /* 218 */
2680 0b_00000000,
2681 0b_00000000,
2682 0b_11110000,
2683 0b_00001000,
2684 0b_01110000,
2685 0b_00001000,
2686 0b_11110000,
2687 0b_00000000,
2688 /* 219 */
2689 0b_00000000,
2690 0b_00000000,
2691 0b_10101000,
2692 0b_10101000,
2693 0b_10101000,
2694 0b_10101000,
2695 0b_11111000,
2696 0b_00000000,
2697 /* 220 */
2698 0b_00000000,
2699 0b_00000000,
2700 0b_01110000,
2701 0b_10001000,
2702 0b_00111000,
2703 0b_10001000,
2704 0b_01110000,
2705 0b_00000000,
2706 /* 221 */
2707 0b_00000000,
2708 0b_00000000,
2709 0b_10101000,
2710 0b_10101000,
2711 0b_10101000,
2712 0b_11111000,
2713 0b_00001000,
2714 0b_00000000,
2715 /* 222 */
2716 0b_00000000,
2717 0b_00000000,
2718 0b_01001000,
2719 0b_01001000,
2720 0b_01111000,
2721 0b_00001000,
2722 0b_00001000,
2723 0b_00000000,
2724 /* 223 */
2725 0b_00000000,
2726 0b_00000000,
2727 0b_11000000,
2728 0b_01000000,
2729 0b_01110000,
2730 0b_01001000,
2731 0b_01110000,
2732 0b_00000000,
2733 /* 224 */
2734 0b_10010000,
2735 0b_10101000,
2736 0b_10101000,
2737 0b_11101000,
2738 0b_10101000,
2739 0b_10101000,
2740 0b_10010000,
2741 0b_00000000,
2742 /* 225 */
2743 0b_00100000,
2744 0b_01010000,
2745 0b_10001000,
2746 0b_10001000,
2747 0b_11111000,
2748 0b_10001000,
2749 0b_10001000,
2750 0b_00000000,
2751 /* 226 */
2752 0b_11111000,
2753 0b_10001000,
2754 0b_10000000,
2755 0b_11110000,
2756 0b_10001000,
2757 0b_10001000,
2758 0b_11110000,
2759 0b_00000000,
2760 /* 227 */
2761 0b_10010000,
2762 0b_10010000,
2763 0b_10010000,
2764 0b_10010000,
2765 0b_10010000,
2766 0b_11111000,
2767 0b_00001000,
2768 0b_00000000,
2769 /* 228 */
2770 0b_00111000,
2771 0b_00101000,
2772 0b_00101000,
2773 0b_01001000,
2774 0b_01001000,
2775 0b_11111000,
2776 0b_10001000,
2777 0b_00000000,
2778 /* 229 */
2779 0b_11111000,
2780 0b_10000000,
2781 0b_10000000,
2782 0b_11110000,
2783 0b_10000000,
2784 0b_10000000,
2785 0b_11111000,
2786 0b_00000000,
2787 /* 230 */
2788 0b_00100000,
2789 0b_01110000,
2790 0b_10101000,
2791 0b_10101000,
2792 0b_10101000,
2793 0b_01110000,
2794 0b_00100000,
2795 0b_00000000,
2796 /* 231 */
2797 0b_11111000,
2798 0b_10001000,
2799 0b_10001000,
2800 0b_10000000,
2801 0b_10000000,
2802 0b_10000000,
2803 0b_10000000,
2804 0b_00000000,
2805 /* 232 */
2806 0b_10001000,
2807 0b_10001000,
2808 0b_01010000,
2809 0b_00100000,
2810 0b_01010000,
2811 0b_10001000,
2812 0b_10001000,
2813 0b_00000000,
2814 /* 233 */
2815 0b_10001000,
2816 0b_10001000,
2817 0b_10011000,
2818 0b_10101000,
2819 0b_11001000,
2820 0b_10001000,
2821 0b_10001000,
2822 0b_00000000,
2823 /* 234 */
2824 0b_01010000,
2825 0b_00100000,
2826 0b_10001000,
2827 0b_10011000,
2828 0b_10101000,
2829 0b_11001000,
2830 0b_10001000,
2831 0b_00000000,
2832 /* 235 */
2833 0b_10001000,
2834 0b_10010000,
2835 0b_10100000,
2836 0b_11000000,
2837 0b_10100000,
2838 0b_10010000,
2839 0b_10001000,
2840 0b_00000000,
2841 /* 236 */
2842 0b_00011000,
2843 0b_00101000,
2844 0b_01001000,
2845 0b_01001000,
2846 0b_01001000,
2847 0b_01001000,
2848 0b_10001000,
2849 0b_00000000,
2850 /* 237 */
2851 0b_10001000,
2852 0b_11011000,
2853 0b_10101000,
2854 0b_10101000,
2855 0b_10001000,
2856 0b_10001000,
2857 0b_10001000,
2858 0b_00000000,
2859 /* 238 */
2860 0b_10001000,
2861 0b_10001000,
2862 0b_10001000,
2863 0b_11111000,
2864 0b_10001000,
2865 0b_10001000,
2866 0b_10001000,
2867 0b_00000000,
2868 /* 239 */
2869 0b_01110000,
2870 0b_10001000,
2871 0b_10001000,
2872 0b_10001000,
2873 0b_10001000,
2874 0b_10001000,
2875 0b_01110000,
2876 0b_00000000,
2877 /* 240 */
2878 0b_11111000,
2879 0b_10001000,
2880 0b_10001000,
2881 0b_10001000,
2882 0b_10001000,
2883 0b_10001000,
2884 0b_10001000,
2885 0b_00000000,
2886 /* 241 */
2887 0b_01111000,
2888 0b_10001000,
2889 0b_10001000,
2890 0b_01111000,
2891 0b_00101000,
2892 0b_01001000,
2893 0b_10001000,
2894 0b_00000000,
2895 /* 242 */
2896 0b_11110000,
2897 0b_10001000,
2898 0b_10001000,
2899 0b_11110000,
2900 0b_10000000,
2901 0b_10000000,
2902 0b_10000000,
2903 0b_00000000,
2904 /* 243 */
2905 0b_01110000,
2906 0b_10001000,
2907 0b_10000000,
2908 0b_10000000,
2909 0b_10000000,
2910 0b_10001000,
2911 0b_01110000,
2912 0b_00000000,
2913 /* 244 */
2914 0b_11111000,
2915 0b_00100000,
2916 0b_00100000,
2917 0b_00100000,
2918 0b_00100000,
2919 0b_00100000,
2920 0b_00100000,
2921 0b_00000000,
2922 /* 245 */
2923 0b_10001000,
2924 0b_10001000,
2925 0b_10001000,
2926 0b_01010000,
2927 0b_00100000,
2928 0b_01000000,
2929 0b_10000000,
2930 0b_00000000,
2931 /* 246 */
2932 0b_10101000,
2933 0b_10101000,
2934 0b_01110000,
2935 0b_00100000,
2936 0b_01110000,
2937 0b_10101000,
2938 0b_10101000,
2939 0b_00000000,
2940 /* 247 */
2941 0b_11110000,
2942 0b_01001000,
2943 0b_01001000,
2944 0b_01110000,
2945 0b_01001000,
2946 0b_01001000,
2947 0b_11110000,
2948 0b_00000000,
2949 /* 248 */
2950 0b_10000000,
2951 0b_10000000,
2952 0b_10000000,
2953 0b_11110000,
2954 0b_10001000,
2955 0b_10001000,
2956 0b_11110000,
2957 0b_00000000,
2958 /* 249 */
2959 0b_10001000,
2960 0b_10001000,
2961 0b_10001000,
2962 0b_11001000,
2963 0b_10101000,
2964 0b_10101000,
2965 0b_11001000,
2966 0b_00000000,
2967 /* 250 */
2968 0b_11110000,
2969 0b_00001000,
2970 0b_00001000,
2971 0b_00110000,
2972 0b_00001000,
2973 0b_00001000,
2974 0b_11110000,
2975 0b_00000000,
2976 /* 251 */
2977 0b_10101000,
2978 0b_10101000,
2979 0b_10101000,
2980 0b_10101000,
2981 0b_10101000,
2982 0b_10101000,
2983 0b_11111000,
2984 0b_00000000,
2985 /* 252 */
2986 0b_01110000,
2987 0b_10001000,
2988 0b_00001000,
2989 0b_01111000,
2990 0b_00001000,
2991 0b_10001000,
2992 0b_01110000,
2993 0b_00000000,
2994 /* 253 */
2995 0b_10101000,
2996 0b_10101000,
2997 0b_10101000,
2998 0b_10101000,
2999 0b_10101000,
3000 0b_11111000,
3001 0b_00001000,
3002 0b_00000000,
3003 /* 254 */
3004 0b_10001000,
3005 0b_10001000,
3006 0b_10001000,
3007 0b_10001000,
3008 0b_01111000,
3009 0b_00001000,
3010 0b_00001000,
3011 0b_00000000,
3012 /* 255 */
3013 0b_11000000,
3014 0b_01000000,
3015 0b_01000000,
3016 0b_01110000,
3017 0b_01001000,
3018 0b_01001000,
3019 0b_01110000,
3020 0b_00000000,
3024 // bits 0..3: width
3025 // bits 4..7: lshift
3026 public immutable ubyte[256] vlFontPropWidth = () {
3027 ubyte[256] res;
3028 foreach (immutable cnum; 0..256) {
3029 import core.bitop : bsf, bsr;
3030 immutable doshift =
3031 (cnum >= 32 && cnum <= 127) ||
3032 (cnum >= 143 && cnum <= 144) ||
3033 (cnum >= 166 && cnum <= 167) ||
3034 (cnum >= 192 && cnum <= 255);
3035 int shift = 0;
3036 if (doshift) {
3037 shift = 8;
3038 foreach (immutable dy; 0..8) {
3039 immutable b = vlFont6[cnum*8+dy];
3040 if (b) {
3041 immutable mn = 7-bsr(b);
3042 if (mn < shift) shift = mn;
3046 ubyte wdt = 0;
3047 foreach (immutable dy; 0..8) {
3048 immutable b = (vlFont6[cnum*8+dy]<<shift);
3049 immutable cwdt = (b ? 8-bsf(b) : 0);
3050 if (cwdt > wdt) wdt = cast(ubyte)cwdt;
3052 switch (cnum) {
3053 case 0: wdt = 8; break; // 8px space
3054 case 32: wdt = 5; break; // 5px space
3055 case 17: .. case 27: wdt = 8; break; // single frames
3056 case 48: .. case 57: wdt = 5; break; // digits are monospaced
3057 case 127: .. case 142: wdt = 8; break; // filled frames
3058 case 145: .. case 151: wdt = 8; break; // filled frames
3059 case 155: .. case 159: wdt = 8; break; // filled frames
3060 default:
3062 res[cnum] = (wdt&0x0f)|((shift<<4)&0xf0);
3064 return res;
3065 }();