import stb_truetype; import core.stdc.stdio; import core.stdc.stdlib; ubyte[] FONT_DATA = cast(ubyte[])import("pc-9800.ttf"); stbtt_bakedchar[96] cdata; void main(string[] args) { char arg1 = args.length > 1 ? args[1][0] : 'a'; stbtt_fontinfo font; ubyte* bitmap; int w,h,i,j,c = (arg1), s = (args.length > 2 ? atoi(args[2].ptr) : 20); stbtt_InitFont(&font, FONT_DATA.ptr, stbtt_GetFontOffsetForIndex(FONT_DATA.ptr, 0)); bitmap = stbtt_GetCodepointBitmap(&font, 0, stbtt_ScaleForPixelHeight(&font, s), c, &w, &h, null, null); for (j=0; j < h; ++j) { for (i=0; i < w; ++i) putchar(" .:ioVM@"[bitmap[j*w+i]>>5]); putchar('\n'); } }