// 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_arial_bold_6_latin1_*, // and separately install each font. Note that the CREATE function call has a // totally different name; it's just 'stb_font_arial_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_arial_bold_6_latin1_BITMAP_WIDTH 256 #define STB_FONT_arial_bold_6_latin1_BITMAP_HEIGHT 24 #define STB_FONT_arial_bold_6_latin1_BITMAP_HEIGHT_POW2 32 #define STB_FONT_arial_bold_6_latin1_FIRST_CHAR 32 #define STB_FONT_arial_bold_6_latin1_NUM_CHARS 224 #define STB_FONT_arial_bold_6_latin1_LINE_SPACING 4 static unsigned int stb__arial_bold_6_latin1_pixels[]={ 0x11c0e333,0xec8072a5,0x0662b8e5,0x1542a875,0xc8e02c47,0x105438c0, 0x2a15c199,0x4288b202,0x20dddc19,0x4c4b261c,0x1c285952,0x44666191, 0x902a0e0c,0x5510dc41,0x0a86a638,0x262190aa,0x870546e2,0x02a0dc2a, 0x98544707,0x48f32748,0x7065c2e7,0x248e4ce8,0x39b11cd8,0x66c47362, 0x644a6351,0xb3298e4c,0x7298b8e5,0x4a62e111,0x23b5298b,0x2e39b129, 0x79735298,0x9c292e4c,0x8e4c5594,0x263931c9,0x3265951c,0x2c98b262, 0x22c98b26,0x49cb2a93,0x724e5357,0x2e0b85c1,0x36e19b70,0x2e19b70c, 0x2a5950cd,0x2577132c,0x24aee58c,0x88b2a95b,0x4724924c,0x58e56395, 0x0d9cd639,0xb11cb737,0x319042b2,0x46422325,0x2e531929,0x958e4a64, 0x1652e531,0x193ca969,0x3ad9672b,0x6ceb675b,0x2d69733a,0x5acb596b, 0x26b192d6,0x3b2b194b,0x064b1929,0x90c83219,0x59156455,0x97315645, 0x7c4d52e6,0x87c49990,0x25ccf623,0x0c924932,0xb0cac32b,0x5329ac32, 0x263962f2,0x8c8e7b52,0x321b9329,0x25319298,0x432534c8,0x2ee53195, 0x90f2a2db,0x2d6572e1,0x54b2a595,0x2f25952c,0x26549954,0x52654995, 0xbcae5c99,0x36b2b974,0x9064b972,0x590c8321,0x55915645,0x29791564, 0x495374bc,0x2512540c,0xc89793ca,0xd9964d14,0x2659b32c,0x259b32cd, 0x166dd623,0x8e088e47,0x98aa0dd9,0x21bb30dd,0x366592db,0x221bb32c, 0x00003aab,0x00000000,0x90000000,0x90640591,0xb90c8321,0x64737239, 0x039b91cd,0x08080080,0x00004000,0x20040800,0x00008020,0x00000c00, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x9b11aa98,0x98eee0e3,0x2a53174c,0x84c7242c, 0x33621cc8,0x93269731,0x21501474,0x48ca4e10,0xb951c375,0x59306e19, 0xb866dc18,0xb8550260,0x150e15c2,0x2a195438,0x0626a189,0x2ea0a897, 0x330f2228,0x28929388,0x43322393,0x4c7b31ca,0x265931aa,0x5d41951c, 0x3231392a,0xb496323b,0x84e4a632,0x73d8e6c9,0x52b1c963,0x95dc5975, 0x2e7953eb,0x56329b90,0x5c3b52db,0x3257d730,0xc996b0dc,0x064e6721, 0x15c2b859,0x2e2ca8ae,0x10aea242,0x64298853,0x5c6e325d,0x2e1f443c, 0x54b59c42,0x222e7190,0x832e3710,0x23592bca,0x549192bb,0x2d71929b, 0xa933258c,0x3253196c,0x2e152d23,0x864b1190,0x3666d955,0xd32c1f10, 0xba5e4325,0x2ee9d95c,0x66de4323,0x32a1b790,0x9ad8b2a4,0x362ec193, 0x99762ec5,0x82b9764b,0x2e620b98,0x6ec2e620,0x75117624,0x5d876ee3, 0x72e6ce62,0x411194a4,0x65491149,0x2b29392b,0x5dcc9734,0x33299b11, 0xd9ac0324,0x32a79b0d,0xc99dca26,0x54b3665e,0x2a1b955b,0x9084f724, 0x6cc06661,0x59003201,0xddc85001,0x47b6a190,0x3db51eda,0xa5e47b6a, 0x89751eda,0x06ca1d8a,0x02f23b15,0x52c8b819,0x47b6a7b9,0x5470b1dc, 0x2e1b931c,0x5cc5972c,0x32e7951b,0x00003972,0x00000000,0x01002006, 0x00000000,0xd8000000,0x2931b498,0x931b498d,0x00126360,0x06400010, 0x24c6c002,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x9930e000,0x8dc0b85c,0x2a23933a,0x46e25932, 0x26edc2ca,0x2a3c9822,0x66dc9b71,0xb8c8d970,0x75219371,0xb729ac48, 0xb833b219,0x654776e2,0x36e19b71,0x2e53570d,0x1702e68b,0x70b95c57, 0xb8224531,0x840a813d,0x2e7574bb,0x5c3a0ccb,0x26e5b74c,0x89d42a3a, 0xae5ce91a,0x9154971a,0x0b96b255,0x3d85c779,0x1485c75b,0x125cd2ee, 0xb1803599,0x321ac8dc,0x3621dc2a,0xd9c93625,0xc864dc5a,0x97616398, 0x29132b9c,0x39591c9c,0x56e4a7b2,0x49990326,0x2b2192d8,0x0eccb52b, 0x260b2a35,0x3e2b193c,0x2a53b190,0x9629973b,0x29904ccb,0x485770cb, 0x3c883231,0xc8f6e1d9,0xb864b190,0xa8645950,0x2f2b193c,0x006bb6e4, 0x3590a832,0x20931564,0xda93a20c,0x92e443d9,0x36a2c731,0x0d8d791e, 0x95d64799,0x9b792dac,0xd96f2064,0x2eb2193c,0x922ea922,0x32a153c9, 0x49de5692,0xe804253b,0x5477b32d,0x0d12b880,0x32175120,0x46432049, 0x9005c325,0x1b02d201,0x044449b9,0xc8190a87,0x819bd1cd,0x4472720c, 0x645d03d6,0x31b160dd,0x6e4ea329,0x2ddc8193,0x36725919,0xa8c93724, 0x64327713,0x44312298,0x02813063,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x3b800000,0x8954aa55,0x238aaa09,0x4aa3792a,0x27919824,0x1ddc550b, 0x00000015,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0xb9d4ee00,0x88eea552,0x84d40608,0x0000c52a,0x00000000,0x00000000, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, 0x00000000,0x00000000,0x00000000, }; static signed short stb__arial_bold_6_latin1_x[224]={ 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,0,0,-1,0,0,-1,0,0,-1,0,0,-1,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,-1,0,0,0,0,-1,-1,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,-1,0,0,0,0,0,-1,0,-1,-1,-1,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,-1,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; static signed short stb__arial_bold_6_latin1_y[224]={ 4,0,0,0,-1,0,0,0,0,0,0,0,3,2, 3,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,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5,4,5,4,4,4,4,4,6,5,6,3,2,1,4,5,4,5,4,4,5,4,4, 6,4,4,3,3,4,5,5,3,4,5,4,3,3,3,5,3,6,6,6,2,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,5,6,5,4,4, 6,6,1,5,3,3,3,1,5,1,2,4,3,3,1,5,6,2,2,3,3,3,5,5,5,5,5,5,5,5, 5,5,4,6,5,5,5,5,5,5,5,5,4,5,6,6,6,6,6,4,6,6,6,6,6,5,4,5,5,5, 5,5,5,6,4,5,5,5,5,5,4,4,4,4,5,4,5,5,5,5,5,4,4,5,5,5,5,6,6,6, }; static unsigned short stb__arial_bold_6_latin1_s[224]={ 255,62,29,53,102,63,69,36,14,57,33, 175,23,45,48,87,91,171,124,100,159,104,114,179,118,122,226,187,190,212,183, 57,119,114,133,95,104,70,65,132,166,163,79,154,149,143,138,177,128,171,119, 186,109,151,98,91,86,80,75,34,164,106,208,17,60,40,137,32,160,24,21, 182,13,10,30,1,252,202,194,237,142,147,247,218,168,210,236,220,198,191,216, 60,69,72,13,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52, 52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,255,253,75, 156,206,214,79,17,51,126,229,232,240,45,108,54,10,195,7,4,42,83,25, 39,26,244,1,251,47,41,35,30,25,74,16,11,6,1,44,87,240,235,230, 225,221,218,214,210,246,201,37,109,42,47,52,199,63,82,114,92,97,57,232, 139,21,245,160,249,193,21,226,131,144,148,152,156,222,203,17,28,126,36,164, 169,174,179,184,242,5,189,197,206,135,10,5,1, }; static unsigned short stb__arial_bold_6_latin1_t[224]={ 7,14,19,8,1,8,8,19,1,1,19, 14,19,19,19,8,8,14,14,8,14,8,8,14,8,8,14,14,14,14,14, 14,1,14,14,8,14,14,14,7,14,14,8,14,14,14,14,7,14,7,14, 7,14,7,14,14,14,14,14,1,7,1,14,19,19,14,7,14,7,14,14, 7,14,14,1,14,7,14,14,7,7,7,14,7,7,7,14,14,14,7,14, 1,1,1,19,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,7,1,1, 7,7,7,1,1,19,7,14,14,14,19,8,19,19,7,19,19,19,8,1, 19,19,14,19,14,8,8,8,8,8,8,8,8,8,8,14,1,1,1,1, 1,1,1,1,1,7,1,1,1,1,1,1,7,1,1,1,1,1,8,7, 1,8,1,1,1,1,1,7,1,1,1,1,1,7,7,14,14,1,14,1, 1,1,1,1,7,14,1,1,1,1,1,1,1, }; static unsigned short stb__arial_bold_6_latin1_a[224]={ 24,29,41,48,48,76,62,20, 29,29,33,50,24,29,24,24,48,48,48,48,48,48,48,48, 48,48,29,29,50,50,50,52,84,62,62,62,62,57,52,67, 62,24,48,62,52,72,62,67,57,67,62,57,52,62,57,81, 57,57,52,29,24,29,50,48,29,48,52,48,52,48,29,52, 52,24,24,48,24,76,52,52,52,52,33,48,29,52,48,67, 48,48,43,33,24,33,50,64,64,64,64,64,64,64,64,64, 64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64, 64,64,64,64,64,64,64,64,24,29,48,48,48,48,24,48, 29,63,32,48,50,29,63,47,34,47,29,29,29,50,48,24, 29,29,31,48,72,72,72,52,62,62,62,62,62,62,86,62, 57,57,57,57,24,24,24,24,62,62,67,67,67,67,67,50, 67,62,62,62,62,57,57,52,48,48,48,48,48,48,76,48, 48,48,48,48,24,24,24,24,52,52,52,52,52,52,52,47, 52,52,52,52,52,48,52,48, }; // Call this function with // font: NULL or array length // data: NULL or specified size // height: STB_FONT_arial_bold_6_latin1_BITMAP_HEIGHT or STB_FONT_arial_bold_6_latin1_BITMAP_HEIGHT_POW2 // return value: spacing between lines static void stb_font_arial_bold_6_latin1(stb_fontchar font[STB_FONT_arial_bold_6_latin1_NUM_CHARS], unsigned char data[STB_FONT_arial_bold_6_latin1_BITMAP_HEIGHT][STB_FONT_arial_bold_6_latin1_BITMAP_WIDTH], int height) { int i,j; if (data != 0) { unsigned int *bits = stb__arial_bold_6_latin1_pixels; unsigned int bitpack = *bits++, numbits = 32; for (i=0; i < STB_FONT_arial_bold_6_latin1_BITMAP_WIDTH*height; ++i) data[0][i] = 0; // zero entire bitmap for (j=1; j < STB_FONT_arial_bold_6_latin1_BITMAP_HEIGHT-1; ++j) { for (i=1; i < STB_FONT_arial_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_arial_bold_6_latin1_BITMAP_WIDTH; float recip_height = 1.0f / height; for (i=0; i < STB_FONT_arial_bold_6_latin1_NUM_CHARS; ++i) { // pad characters so they bilerp from empty space around each character font[i].s0 = (stb__arial_bold_6_latin1_s[i]) * recip_width; font[i].t0 = (stb__arial_bold_6_latin1_t[i]) * recip_height; font[i].s1 = (stb__arial_bold_6_latin1_s[i] + stb__arial_bold_6_latin1_w[i]) * recip_width; font[i].t1 = (stb__arial_bold_6_latin1_t[i] + stb__arial_bold_6_latin1_h[i]) * recip_height; font[i].x0 = stb__arial_bold_6_latin1_x[i]; font[i].y0 = stb__arial_bold_6_latin1_y[i]; font[i].x1 = stb__arial_bold_6_latin1_x[i] + stb__arial_bold_6_latin1_w[i]; font[i].y1 = stb__arial_bold_6_latin1_y[i] + stb__arial_bold_6_latin1_h[i]; font[i].advance_int = (stb__arial_bold_6_latin1_a[i]+8)>>4; font[i].s0f = (stb__arial_bold_6_latin1_s[i] - 0.5f) * recip_width; font[i].t0f = (stb__arial_bold_6_latin1_t[i] - 0.5f) * recip_height; font[i].s1f = (stb__arial_bold_6_latin1_s[i] + stb__arial_bold_6_latin1_w[i] + 0.5f) * recip_width; font[i].t1f = (stb__arial_bold_6_latin1_t[i] + stb__arial_bold_6_latin1_h[i] + 0.5f) * recip_height; font[i].x0f = stb__arial_bold_6_latin1_x[i] - 0.5f; font[i].y0f = stb__arial_bold_6_latin1_y[i] - 0.5f; font[i].x1f = stb__arial_bold_6_latin1_x[i] + stb__arial_bold_6_latin1_w[i] + 0.5f; font[i].y1f = stb__arial_bold_6_latin1_y[i] + stb__arial_bold_6_latin1_h[i] + 0.5f; font[i].advance = stb__arial_bold_6_latin1_a[i]/16.0f; } } } #ifndef STB_SOMEFONT_CREATE #define STB_SOMEFONT_CREATE stb_font_arial_bold_6_latin1 #define STB_SOMEFONT_BITMAP_WIDTH STB_FONT_arial_bold_6_latin1_BITMAP_WIDTH #define STB_SOMEFONT_BITMAP_HEIGHT STB_FONT_arial_bold_6_latin1_BITMAP_HEIGHT #define STB_SOMEFONT_BITMAP_HEIGHT_POW2 STB_FONT_arial_bold_6_latin1_BITMAP_HEIGHT_POW2 #define STB_SOMEFONT_FIRST_CHAR STB_FONT_arial_bold_6_latin1_FIRST_CHAR #define STB_SOMEFONT_NUM_CHARS STB_FONT_arial_bold_6_latin1_NUM_CHARS #define STB_SOMEFONT_LINE_SPACING STB_FONT_arial_bold_6_latin1_LINE_SPACING #endif