// Font generated by stb_font_inl_generator.c (4/1 bpp) // // Following instructions show how to use the only included font, whatever it is, in // a generic way so you can replace it with any other font by changing the include. // To use multiple fonts, replace STB_SOMEFONT_* below with STB_FONT_consolas_bold_6_latin1_*, // and separately install each font. Note that the CREATE function call has a // totally different name; it's just 'stb_font_consolas_bold_6_latin1'. // /* // Example usage: static stb_fontchar fontdata[STB_SOMEFONT_NUM_CHARS]; static void init(void) { // optionally replace both STB_SOMEFONT_BITMAP_HEIGHT with STB_SOMEFONT_BITMAP_HEIGHT_POW2 static unsigned char fontpixels[STB_SOMEFONT_BITMAP_HEIGHT][STB_SOMEFONT_BITMAP_WIDTH]; STB_SOMEFONT_CREATE(fontdata, fontpixels, STB_SOMEFONT_BITMAP_HEIGHT); ... create texture ... // for best results rendering 1:1 pixels texels, use nearest-neighbor sampling // if allowed to scale up, use bilerp } // This function positions characters on integer coordinates, and assumes 1:1 texels to pixels // Appropriate if nearest-neighbor sampling is used static void draw_string_integer(int x, int y, char *str) // draw with top-left point x,y { ... use texture ... ... turn on alpha blending and gamma-correct alpha blending ... glBegin(GL_QUADS); while (*str) { int char_codepoint = *str++; stb_fontchar *cd = &fontdata[char_codepoint - STB_SOMEFONT_FIRST_CHAR]; glTexCoord2f(cd->s0, cd->t0); glVertex2i(x + cd->x0, y + cd->y0); glTexCoord2f(cd->s1, cd->t0); glVertex2i(x + cd->x1, y + cd->y0); glTexCoord2f(cd->s1, cd->t1); glVertex2i(x + cd->x1, y + cd->y1); glTexCoord2f(cd->s0, cd->t1); glVertex2i(x + cd->x0, y + cd->y1); // if bilerping, in D3D9 you'll need a half-pixel offset here for 1:1 to behave correct x += cd->advance_int; } glEnd(); } // This function positions characters on float coordinates, and doesn't require 1:1 texels to pixels // Appropriate if bilinear filtering is used static void draw_string_float(float x, float y, char *str) // draw with top-left point x,y { ... use texture ... ... turn on alpha blending and gamma-correct alpha blending ... glBegin(GL_QUADS); while (*str) { int char_codepoint = *str++; stb_fontchar *cd = &fontdata[char_codepoint - STB_SOMEFONT_FIRST_CHAR]; glTexCoord2f(cd->s0f, cd->t0f); glVertex2f(x + cd->x0f, y + cd->y0f); glTexCoord2f(cd->s1f, cd->t0f); glVertex2f(x + cd->x1f, y + cd->y0f); glTexCoord2f(cd->s1f, cd->t1f); glVertex2f(x + cd->x1f, y + cd->y1f); glTexCoord2f(cd->s0f, cd->t1f); glVertex2f(x + cd->x0f, y + cd->y1f); // if bilerping, in D3D9 you'll need a half-pixel offset here for 1:1 to behave correct x += cd->advance; } glEnd(); } */ #ifndef STB_FONTCHAR__TYPEDEF #define STB_FONTCHAR__TYPEDEF typedef struct { // coordinates if using integer positioning float s0,t0,s1,t1; signed short x0,y0,x1,y1; int advance_int; // coordinates if using floating positioning float s0f,t0f,s1f,t1f; float x0f,y0f,x1f,y1f; float advance; } stb_fontchar; #endif #define STB_FONT_consolas_bold_6_latin1_BITMAP_WIDTH 256 #define STB_FONT_consolas_bold_6_latin1_BITMAP_HEIGHT 26 #define STB_FONT_consolas_bold_6_latin1_BITMAP_HEIGHT_POW2 32 #define STB_FONT_consolas_bold_6_latin1_FIRST_CHAR 32 #define STB_FONT_consolas_bold_6_latin1_NUM_CHARS 224 #define STB_FONT_consolas_bold_6_latin1_LINE_SPACING 4 static unsigned int stb__consolas_bold_6_latin1_pixels[]={ 0x84040104,0x98e10113,0x20808260,0x0f660808,0x82010101,0x20808200, 0x81500100,0x04101020,0x87330004,0x0510cc0b,0x88e66086,0x86605c2b, 0x08804028,0x04001040,0x44044102,0x06603229,0x32245237,0x2190dc91, 0x4b994448,0xb8958a62,0x2b88fa60,0x988510cc,0x221982e2,0x70760cc2, 0x15c4a621,0x4510cc17,0x21b125ba,0x1d23a474,0x964d98e9,0x98f663d9, 0xd98f663d,0x20d572a3,0x170dc3d9,0x586ca8a2,0xbf748531,0x990cac6c, 0x4920cacb,0x198e482e,0x4f2a350e,0x49951ccc,0xa932a195,0xca932a5c, 0x4c9932a4,0x99326993,0x43b1694c,0x269734b9,0x2e69734b,0x15e52e64, 0x2564ac07,0x56c9592b,0x564acb0d,0x592b2564,0xb9125ac9,0xb4ad2150, 0x96ca8f2e,0x09f91a96,0x52464975,0x5491c497,0x4330c954,0x32711cc3, 0xda96b1dc,0x596b2d64,0x92d65acb,0x5e52f297,0x25a52f24,0x4d6e63c9, 0x2e6b735b,0xadccb735,0x21b125ac,0x2564ac95,0x70cbd92b,0x432b0cac, 0x58656195,0x0b9b2e19,0x5a4752e4,0x2b165d69,0x2a249695,0x990f4364, 0x492c1e89,0x70cc9243,0x664e21a8,0x197132e4,0x24cb932e,0xb932e4cb, 0x654f2a4c,0x9e547953,0xb96ee5cb,0x32eb975c,0x972eb975,0x2cb595cb, 0x97265c91,0x997265c9,0x6549275c,0x4ca932a4,0x84ca932a,0x24db8e25, 0x2eb971d9,0x65cb595c,0x20a6b975,0x20644a84,0x2292a84a,0x39148dc5, 0x2e64886c,0x02003572,0x00000000,0x06cec000,0x20000000,0x20000000, 0x00000009,0x81428100,0x50006000,0x08082c88,0x84008008,0x04401020, 0x00000006,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x84010000,0x00110100,0x26020b81,0x20000cc1, 0x53220828,0x171e4cb4,0x040b8e66,0x4c793010,0x22b9823c,0x505713da, 0x19811ccc,0x447330a2,0x5c4f262c,0x56288cc2,0x0109930c,0x020001c0, 0x22047b30,0x75019020,0x22cb8ef2,0x897322c9,0x2288763c,0x8b9e5474, 0x6ed4f663,0x90c47950,0x95485a41,0x9eccf2a7,0x5c717298,0x951a363a, 0x8565cae2,0x547390bb,0x0b8f665d,0x1d83b076,0x24bb86f2,0x6ccf661d, 0x0c6c9753,0xb98644b2,0x4b2a7d74,0x1c7b34c9,0x324ac995,0x320b9660, 0x5d472e5c,0x3db872a1,0x26b31232,0x4c99a63c,0x70d446ea,0xba85edc1, 0x320d8d31,0x1baa40ec,0x4d32c375,0xd86ea1a8,0x6656a0cb,0x26215b75, 0x25e49995,0x8f266996,0xc8f263c9,0x64d6ea59,0x43d162c3,0x9312a58d, 0x366496e6,0x982e9793,0x432b2d66,0x4ab925cc,0x9065c919,0xb772e649, 0xbb922664,0xba83a245,0x93d98ee1,0x890dd47b,0xc98194d9,0x86ea3752, 0x770ee245,0x29952654,0x5477558c,0x75cb794c,0x5bb922c4,0x25bb96ee, 0x5d32e5c9,0x4a962c5b,0x44aa36d4,0x53d972e4,0x6ccf2a97,0x2a4cb923, 0x2496324c,0xd89990eb,0x3321b371,0x80c92a0e,0x74c36764,0x2e7b5163, 0x36a01c5a,0x02387d33,0x9ed4f6a0,0x2e7d33ea,0x00b570d8,0x320058c8, 0x7d506278,0x86cecfa6,0x1b3b0d9d,0xa86cec00,0x0027d53e,0x40000000, 0x464003e9,0x166e7d35,0x39500050,0x00000004,0x00000000,0x00000000, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x64d32200,0xb8820e93,0xb922e001,0x410f2239,0x0cc804b4,0x5055c797, 0x9171d2b9,0x02e90a9c,0x97144db8,0x21e5c087,0x59b8e720,0x2248b86a, 0x1d27b32c,0x7953ca82,0x23cb8f32,0xb30ec3cb,0x43b8f261,0x71544000, 0x6d4f2ab9,0x939a8115,0x79064151,0xb316c4ac,0x5cc97767,0x52e545b1, 0x56934417,0xb1ec43ca,0x2a2d64b3,0x17449933,0x96321559,0x3aa2c5cb, 0x6438b393,0x66476258,0x21a97724,0x58ee61cc,0x52c89676,0x5ac6ea15, 0x24ac92aa,0xb02e23c9,0x22d992e2,0x1bb70d84,0x3658da44,0x97c4b990, 0x2a06c4dc,0x23ea92b5,0x217992c8,0x545d358c,0xd8872e4b,0x0f2ab971, 0x92cec997,0x83a2c4b5,0x437722e8,0xb026e4b9,0x75166490,0x59116647, 0x23cb96f2,0xc883721a,0x225ad962,0x2ea3751e,0x22ba96b1,0x716ee5ac, 0x25bd8e41,0x447d53d9,0x21917324,0x407d76b9,0x98d79289,0x32e9974d, 0x2f3202c4,0x8ba6b190,0x113724ab,0x5906a201,0x2c8f321b,0x8c8b26e4, 0x43f1e765,0x9dd4581b,0x0322458c,0x5d278c82,0x16327b50,0x112b3ea8, 0xb3da86a1,0x99266479,0xea86cec9,0x16629d74,0x14d40483,0x00165491, 0x0b000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x20000000,0x04a665ab,0x30880208,0xa8865657, 0x64082022,0x50aaa820,0x02c88e97,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x710fc000,0x22988a29,0x52e61d1b,0x5c9752b9, 0x0cc9753a,0x21b2454b,0x00028199,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x4cb57000,0x88800018,0x20f43310,0x0c059129, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000, }; static signed short stb__consolas_bold_6_latin1_x[224]={ 0,1,0,0,0,0,0,1,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, 0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; static signed short stb__consolas_bold_6_lat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4,4,4,3,4,3,3,4,4,4, }; static unsigned short stb__consolas_bold_6_latin1_h[224]={ 0,6,3,4,6,6,6,3,7,7,4,4,4,1, 3,6,5,4,4,5,4,5,5,4,5,4,5,6,5,3,5,6,7,4,4,5,4,4,4,5,4,4,5,4, 4,4,4,5,4,6,4,5,4,5,4,4,4,4,4,7,6,7,3,2,3,5,6,5,6,5,5,6,5,5, 7,5,5,4,4,5,6,6,4,5,5,4,3,3,3,5,3,7,7,7,3,4,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,6,6,4,4,4, 7,6,3,5,4,3,2,1,4,3,3,4,4,4,3,5,6,2,1,4,4,3,5,5,5,6,5,5,5,5, 5,6,4,5,5,5,5,5,5,5,5,5,4,5,6,6,6,6,6,3,6,6,6,6,6,5,4,6,6,6, 6,6,6,6,5,5,6,6,6,6,5,5,5,5,6,5,6,6,6,6,6,4,5,6,6,6,6,7,7,7, }; static unsigned short stb__consolas_bold_6_latin1_s[224]={ 253,177,43,223,214,10,15,69,16,40,210, 214,219,92,40,244,114,197,201,119,205,132,169,228,174,232,253,148,201,47,205, 30,48,192,187,1,177,173,169,196,160,156,84,147,143,138,133,238,124,58,114, 5,105,9,95,90,85,80,76,36,209,32,72,80,28,209,1,225,236,221,14, 231,243,229,44,251,247,23,28,233,25,205,100,217,213,51,51,249,19,191,236, 26,20,22,240,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,253,145,6, 42,37,32,30,20,32,127,19,56,85,92,55,36,60,110,165,129,64,79,248, 77,89,47,152,24,52,104,109,219,159,154,34,178,164,110,60,75,66,48,88, 92,187,183,96,146,66,136,200,195,190,185,180,245,172,167,162,157,152,43,71, 140,136,131,127,123,119,115,61,57,101,96,92,88,39,70,150,100,68,123,83, 78,63,73,53,119,141,227,105,223,240,11,6,1, }; static unsigned short stb__consolas_bold_6_latin1_t[224]={ 7,1,21,16,1,9,9,21,1,1,16, 16,16,21,21,1,9,16,16,9,16,9,9,16,9,16,1,1,9,21,9, 9,1,16,16,16,16,16,16,9,16,16,9,16,16,16,16,9,16,1,16, 16,16,16,16,16,16,16,16,1,1,1,21,21,21,9,9,9,1,9,16, 1,9,9,1,9,9,16,16,9,9,1,16,9,9,16,21,16,21,9,16, 1,1,1,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,7,1,9, 16,16,16,1,9,21,9,16,21,21,21,16,21,21,16,16,16,21,9,1, 21,21,16,16,21,9,9,9,1,9,9,9,9,9,1,16,9,9,9,9, 9,9,9,9,9,16,9,1,1,1,1,1,16,1,1,1,1,1,9,16, 1,1,1,1,1,1,1,9,9,1,1,1,1,9,9,9,9,1,9,1, 1,1,1,1,16,9,1,1,1,1,1,1,1, }; static unsigned short stb__consolas_bold_6_latin1_a[224]={ 53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53, 53,53,53,53,53,53,53,53, }; // Call this function with // font: NULL or array length // data: NULL or specified size // height: STB_FONT_consolas_bold_6_latin1_BITMAP_HEIGHT or STB_FONT_consolas_bold_6_latin1_BITMAP_HEIGHT_POW2 // return value: spacing between lines static void stb_font_consolas_bold_6_latin1(stb_fontchar font[STB_FONT_consolas_bold_6_latin1_NUM_CHARS], unsigned char data[STB_FONT_consolas_bold_6_latin1_BITMAP_HEIGHT][STB_FONT_consolas_bold_6_latin1_BITMAP_WIDTH], int height) { int i,j; if (data != 0) { unsigned int *bits = stb__consolas_bold_6_latin1_pixels; unsigned int bitpack = *bits++, numbits = 32; for (i=0; i < STB_FONT_consolas_bold_6_latin1_BITMAP_WIDTH*height; ++i) data[0][i] = 0; // zero entire bitmap for (j=1; j < STB_FONT_consolas_bold_6_latin1_BITMAP_HEIGHT-1; ++j) { for (i=1; i < STB_FONT_consolas_bold_6_latin1_BITMAP_WIDTH-1; ++i) { unsigned int value; if (numbits==0) bitpack = *bits++, numbits=32; value = bitpack & 1; bitpack >>= 1, --numbits; if (value) { if (numbits < 3) bitpack = *bits++, numbits = 32; data[j][i] = (bitpack & 7) * 0x20 + 0x1f; bitpack >>= 3, numbits -= 3; } else { data[j][i] = 0; } } } } // build font description if (font != 0) { float recip_width = 1.0f / STB_FONT_consolas_bold_6_latin1_BITMAP_WIDTH; float recip_height = 1.0f / height; for (i=0; i < STB_FONT_consolas_bold_6_latin1_NUM_CHARS; ++i) { // pad characters so they bilerp from empty space around each character font[i].s0 = (stb__consolas_bold_6_latin1_s[i]) * recip_width; font[i].t0 = (stb__consolas_bold_6_latin1_t[i]) * recip_height; font[i].s1 = (stb__consolas_bold_6_latin1_s[i] + stb__consolas_bold_6_latin1_w[i]) * recip_width; font[i].t1 = (stb__consolas_bold_6_latin1_t[i] + stb__consolas_bold_6_latin1_h[i]) * recip_height; font[i].x0 = stb__consolas_bold_6_latin1_x[i]; font[i].y0 = stb__consolas_bold_6_latin1_y[i]; font[i].x1 = stb__consolas_bold_6_latin1_x[i] + stb__consolas_bold_6_latin1_w[i]; font[i].y1 = stb__consolas_bold_6_latin1_y[i] + stb__consolas_bold_6_latin1_h[i]; font[i].advance_int = (stb__consolas_bold_6_latin1_a[i]+8)>>4; font[i].s0f = (stb__consolas_bold_6_latin1_s[i] - 0.5f) * recip_width; font[i].t0f = (stb__consolas_bold_6_latin1_t[i] - 0.5f) * recip_height; font[i].s1f = (stb__consolas_bold_6_latin1_s[i] + stb__consolas_bold_6_latin1_w[i] + 0.5f) * recip_width; font[i].t1f = (stb__consolas_bold_6_latin1_t[i] + stb__consolas_bold_6_latin1_h[i] + 0.5f) * recip_height; font[i].x0f = stb__consolas_bold_6_latin1_x[i] - 0.5f; font[i].y0f = stb__consolas_bold_6_latin1_y[i] - 0.5f; font[i].x1f = stb__consolas_bold_6_latin1_x[i] + stb__consolas_bold_6_latin1_w[i] + 0.5f; font[i].y1f = stb__consolas_bold_6_latin1_y[i] + stb__consolas_bold_6_latin1_h[i] + 0.5f; font[i].advance = stb__consolas_bold_6_latin1_a[i]/16.0f; } } } #ifndef STB_SOMEFONT_CREATE #define STB_SOMEFONT_CREATE stb_font_consolas_bold_6_latin1 #define STB_SOMEFONT_BITMAP_WIDTH STB_FONT_consolas_bold_6_latin1_BITMAP_WIDTH #define STB_SOMEFONT_BITMAP_HEIGHT STB_FONT_consolas_bold_6_latin1_BITMAP_HEIGHT #define STB_SOMEFONT_BITMAP_HEIGHT_POW2 STB_FONT_consolas_bold_6_latin1_BITMAP_HEIGHT_POW2 #define STB_SOMEFONT_FIRST_CHAR STB_FONT_consolas_bold_6_latin1_FIRST_CHAR #define STB_SOMEFONT_NUM_CHARS STB_FONT_consolas_bold_6_latin1_NUM_CHARS #define STB_SOMEFONT_LINE_SPACING STB_FONT_consolas_bold_6_latin1_LINE_SPACING #endif