2#include "nuklear_internal.h" 
    4#ifdef NK_INCLUDE_FONT_BAKING 
   11#include "stb_rect_pack.h" 
   20#define STBTT_MAX_OVERSAMPLE   8 
   21#include "stb_truetype.h" 
   28struct nk_font_bake_data {
 
   38    struct nk_font_bake_data *build;
 
   44NK_GLOBAL 
const nk_size nk_rect_align = NK_ALIGNOF(
struct stbrp_rect);
 
   47NK_GLOBAL 
const nk_size nk_build_align = NK_ALIGNOF(
struct nk_font_bake_data);
 
   48NK_GLOBAL 
const nk_size nk_baker_align = NK_ALIGNOF(
struct nk_font_baker);
 
   51nk_range_count(
const nk_rune *range)
 
   53    const nk_rune *iter = range;
 
   56    while (*(iter++) != 0);
 
   57    return (iter == range) ? 0 : (int)((iter - range)/2);
 
   60nk_range_glyph_count(
const nk_rune *range, 
int count)
 
   64    for (i = 0; i < count; ++i) {
 
   66        nk_rune f = range[(i*2)+0];
 
   67        nk_rune t = range[(i*2)+1];
 
   69        diff = (int)((t - f) + 1);
 
   75nk_font_default_glyph_ranges(
void)
 
   77    NK_STORAGE 
const nk_rune ranges[] = {0x0020, 0x00FF, 0};
 
   81nk_font_chinese_glyph_ranges(
void)
 
   83    NK_STORAGE 
const nk_rune ranges[] = {
 
   94nk_font_cyrillic_glyph_ranges(
void)
 
   96    NK_STORAGE 
const nk_rune ranges[] = {
 
  106nk_font_korean_glyph_ranges(
void)
 
  108    NK_STORAGE 
const nk_rune ranges[] = {
 
  117nk_font_baker_memory(nk_size *temp, 
int *glyph_count,
 
  118    struct nk_font_config *config_list, 
int count)
 
  121    int total_range_count = 0;
 
  122    struct nk_font_config *iter, *i;
 
  124    NK_ASSERT(config_list);
 
  125    NK_ASSERT(glyph_count);
 
  132    for (iter = config_list; iter; iter = iter->next) {
 
  134        do {
if (!i->range) iter->range = nk_font_default_glyph_ranges();
 
  135            range_count = nk_range_count(i->range);
 
  136            total_range_count += range_count;
 
  137            *glyph_count += nk_range_glyph_count(i->range, range_count);
 
  138        } 
while ((i = i->n) != iter);
 
  140    *temp = (nk_size)*glyph_count * 
sizeof(
struct stbrp_rect);
 
  143    *temp += (nk_size)count * 
sizeof(
struct nk_font_bake_data);
 
  144    *temp += 
sizeof(
struct nk_font_baker);
 
  145    *temp += nk_rect_align + nk_range_align + nk_char_align;
 
  146    *temp += nk_build_align + nk_baker_align;
 
  148NK_INTERN 
struct nk_font_baker*
 
  149nk_font_baker(
void *memory, 
int glyph_count, 
int count, 
const struct nk_allocator *alloc)
 
  151    struct nk_font_baker *baker;
 
  152    if (!memory) 
return 0;
 
  154    baker = (
struct nk_font_baker*)NK_ALIGN_PTR(memory, nk_baker_align);
 
  155    baker->build = (
struct nk_font_bake_data*)NK_ALIGN_PTR((baker + 1), nk_build_align);
 
  156    baker->packed_chars = (
stbtt_packedchar*)NK_ALIGN_PTR((baker->build + count), nk_char_align);
 
  157    baker->rects = (
struct stbrp_rect*)NK_ALIGN_PTR((baker->packed_chars + glyph_count), nk_rect_align);
 
  158    baker->ranges = (
stbtt_pack_range*)NK_ALIGN_PTR((baker->rects + glyph_count), nk_range_align);
 
  159    baker->alloc = *alloc;
 
  163nk_font_bake_pack(
struct nk_font_baker *baker,
 
  164    nk_size *image_memory, 
int *width, 
int *height, 
struct nk_recti *custom,
 
  165    const struct nk_font_config *config_list, 
int count,
 
  168    NK_STORAGE 
const nk_size max_height = 1024 * 32;
 
  169    const struct nk_font_config *config_iter, *it;
 
  170    int total_glyph_count = 0;
 
  171    int total_range_count = 0;
 
  175    NK_ASSERT(image_memory);
 
  178    NK_ASSERT(config_list);
 
  182    if (!image_memory || !width || !height || !config_list || !count) 
return nk_false;
 
  183    for (config_iter = config_list; config_iter; config_iter = config_iter->next) {
 
  185        do {range_count = nk_range_count(it->range);
 
  186            total_range_count += range_count;
 
  187            total_glyph_count += nk_range_glyph_count(it->range, range_count);
 
  188        } 
while ((it = it->n) != config_iter);
 
  191    for (config_iter = config_list; config_iter; config_iter = config_iter->next) {
 
  195            font_info->userdata = (
void*)alloc;
 
  197            if (!stbtt_InitFont(font_info, (
const unsigned char*)it->ttf_blob, stbtt_GetFontOffsetForIndex((
const unsigned char*)it->ttf_blob, 0)))
 
  199        } 
while ((it = it->n) != config_iter);
 
  202    *width = (total_glyph_count > 1000) ? 1024 : 512;
 
  203    stbtt_PackBegin(&baker->spc, 0, (
int)*width, (
int)max_height, 0, 1, (
void*)alloc);
 
  213            nk_zero(&custom_space, 
sizeof(custom_space));
 
  214            custom_space.w = (stbrp_coord)(custom->w);
 
  215            custom_space.h = (stbrp_coord)(custom->h);
 
  217            stbtt_PackSetOversampling(&baker->spc, 1, 1);
 
  218            stbrp_pack_rects((
struct stbrp_context*)baker->spc.pack_info, &custom_space, 1);
 
  219            *height = NK_MAX(*height, (
int)(custom_space.y + custom_space.h));
 
  221            custom->x = (short)custom_space.x;
 
  222            custom->y = (short)custom_space.y;
 
  223            custom->w = (short)custom_space.w;
 
  224            custom->h = (short)custom_space.h;
 
  228        for (input_i = 0, config_iter = config_list; input_i < count && config_iter;
 
  229            config_iter = config_iter->next) {
 
  233                const nk_rune *in_range;
 
  234                const struct nk_font_config *cfg = it;
 
  235                struct nk_font_bake_data *tmp = &baker->build[input_i++];
 
  238                glyph_count = 0; range_count = 0;
 
  239                for (in_range = cfg->range; in_range[0] && in_range[1]; in_range += 2) {
 
  240                    glyph_count += (int)(in_range[1] - in_range[0]) + 1;
 
  245                tmp->ranges = baker->ranges + range_n;
 
  246                tmp->range_count = (nk_rune)range_count;
 
  247                range_n += range_count;
 
  248                for (i = 0; i < range_count; ++i) {
 
  249                    in_range = &cfg->range[i * 2];
 
  250                    tmp->ranges[i].font_size = cfg->size;
 
  251                    tmp->ranges[i].first_unicode_codepoint_in_range = (int)in_range[0];
 
  252                    tmp->ranges[i].num_chars = (int)(in_range[1]- in_range[0]) + 1;
 
  253                    tmp->ranges[i].chardata_for_range = baker->packed_chars + char_n;
 
  254                    char_n += tmp->ranges[i].num_chars;
 
  258                tmp->rects = baker->rects + rect_n;
 
  259                rect_n += glyph_count;
 
  260                stbtt_PackSetOversampling(&baker->spc, cfg->oversample_h, cfg->oversample_v);
 
  261                n = stbtt_PackFontRangesGatherRects(&baker->spc, &tmp->info,
 
  262                    tmp->ranges, (
int)tmp->range_count, tmp->rects);
 
  263                stbrp_pack_rects((
struct stbrp_context*)baker->spc.pack_info, tmp->rects, (
int)n);
 
  266                for (i = 0; i < n; ++i) {
 
  267                    if (tmp->rects[i].was_packed)
 
  268                        *height = NK_MAX(*height, tmp->rects[i].y + tmp->rects[i].h);
 
  270            } 
while ((it = it->n) != config_iter);
 
  272        NK_ASSERT(rect_n == total_glyph_count);
 
  273        NK_ASSERT(char_n == total_glyph_count);
 
  274        NK_ASSERT(range_n == total_range_count);
 
  276    *height = (int)nk_round_up_pow2((nk_uint)*height);
 
  277    *image_memory = (nk_size)(*width) * (nk_size)(*height);
 
  281nk_font_bake(
struct nk_font_baker *baker, 
void *image_memory, 
int width, 
int height,
 
  282    struct nk_font_glyph *glyphs, 
int glyphs_count,
 
  283    const struct nk_font_config *config_list, 
int font_count)
 
  287    const struct nk_font_config *config_iter;
 
  288    const struct nk_font_config *it;
 
  290    NK_ASSERT(image_memory);
 
  293    NK_ASSERT(config_list);
 
  295    NK_ASSERT(font_count);
 
  296    NK_ASSERT(glyphs_count);
 
  297    if (!image_memory || !width || !height || !config_list ||
 
  298        !font_count || !glyphs || !glyphs_count)
 
  302    nk_zero(image_memory, (nk_size)((nk_size)width * (nk_size)height));
 
  303    baker->spc.pixels = (
unsigned char*)image_memory;
 
  304    baker->spc.height = (int)height;
 
  305    for (input_i = 0, config_iter = config_list; input_i < font_count && config_iter;
 
  306        config_iter = config_iter->next) {
 
  308        do {
const struct nk_font_config *cfg = it;
 
  309            struct nk_font_bake_data *tmp = &baker->build[input_i++];
 
  310            stbtt_PackSetOversampling(&baker->spc, cfg->oversample_h, cfg->oversample_v);
 
  311            stbtt_PackFontRangesRenderIntoRects(&baker->spc, &tmp->info, tmp->ranges, (
int)tmp->range_count, tmp->rects);
 
  312        } 
while ((it = it->n) != config_iter);
 
  313    } stbtt_PackEnd(&baker->spc);
 
  316    for (input_i = 0, config_iter = config_list; input_i < font_count && config_iter;
 
  317        config_iter = config_iter->next) {
 
  321            nk_rune glyph_count = 0;
 
  322            const struct nk_font_config *cfg = it;
 
  323            struct nk_font_bake_data *tmp = &baker->build[input_i++];
 
  324            struct nk_baked_font *dst_font = cfg->font;
 
  326            float font_scale = stbtt_ScaleForPixelHeight(&tmp->info, cfg->size);
 
  327            int unscaled_ascent, unscaled_descent, unscaled_line_gap;
 
  328            stbtt_GetFontVMetrics(&tmp->info, &unscaled_ascent, &unscaled_descent,
 
  332            if (!cfg->merge_mode) {
 
  333                dst_font->ranges = cfg->range;
 
  334                dst_font->height = cfg->size;
 
  335                dst_font->ascent = ((float)unscaled_ascent * font_scale);
 
  336                dst_font->descent = ((float)unscaled_descent * font_scale);
 
  337                dst_font->glyph_offset = glyph_n;
 
  342                dst_font->glyph_count = 0;
 
  346            for (i = 0; i < tmp->range_count; ++i) {
 
  348                for (char_idx = 0; char_idx < range->num_chars; char_idx++)
 
  350                    nk_rune codepoint = 0;
 
  351                    float dummy_x = 0, dummy_y = 0;
 
  353                    struct nk_font_glyph *glyph;
 
  357                    codepoint = (nk_rune)(range->first_unicode_codepoint_in_range + char_idx);
 
  358                    stbtt_GetPackedQuad(range->chardata_for_range, (
int)width,
 
  359                        (
int)height, char_idx, &dummy_x, &dummy_y, &q, 0);
 
  362                    glyph = &glyphs[dst_font->glyph_offset + dst_font->glyph_count + (
unsigned int)glyph_count];
 
  363                    glyph->codepoint = codepoint;
 
  364                    glyph->x0 = q.x0; glyph->y0 = q.y0;
 
  365                    glyph->x1 = q.x1; glyph->y1 = q.y1;
 
  366                    glyph->y0 += (dst_font->ascent + 0.5f);
 
  367                    glyph->y1 += (dst_font->ascent + 0.5f);
 
  368                    glyph->w = glyph->x1 - glyph->x0 + 0.5f;
 
  369                    glyph->h = glyph->y1 - glyph->y0;
 
  371                    if (cfg->coord_type == NK_COORD_PIXEL) {
 
  372                        glyph->u0 = q.s0 * (float)width;
 
  373                        glyph->v0 = q.t0 * (float)height;
 
  374                        glyph->u1 = q.s1 * (float)width;
 
  375                        glyph->v1 = q.t1 * (float)height;
 
  382                    glyph->xadvance = (pc->xadvance + cfg->spacing.x);
 
  384                        glyph->xadvance = (float)(
int)(glyph->xadvance + 0.5f);
 
  388            dst_font->glyph_count += glyph_count;
 
  389            glyph_n += glyph_count;
 
  390        } 
while ((it = it->n) != config_iter);
 
  394nk_font_bake_custom_data(
void *img_memory, 
int img_width, 
int img_height,
 
  395    struct nk_recti img_dst, 
const char *texture_data_mask, 
int tex_width,
 
  396    int tex_height, 
char white, 
char black)
 
  403    NK_ASSERT(img_memory);
 
  404    NK_ASSERT(img_width);
 
  405    NK_ASSERT(img_height);
 
  406    NK_ASSERT(texture_data_mask);
 
  407    NK_UNUSED(tex_height);
 
  408    if (!img_memory || !img_width || !img_height || !texture_data_mask)
 
  411    pixels = (nk_byte*)img_memory;
 
  412    for (y = 0, n = 0; y < tex_height; ++y) {
 
  413        for (x = 0; x < tex_width; ++x, ++n) {
 
  414            const int off0 = ((img_dst.x + x) + (img_dst.y + y) * img_width);
 
  415            const int off1 = off0 + 1 + tex_width;
 
  416            pixels[off0] = (texture_data_mask[n] == white) ? 0xFF : 0x00;
 
  417            pixels[off1] = (texture_data_mask[n] == black) ? 0xFF : 0x00;
 
  422nk_font_bake_convert(
void *out_memory, 
int img_width, 
int img_height,
 
  423    const void *in_memory)
 
  429    NK_ASSERT(out_memory);
 
  430    NK_ASSERT(in_memory);
 
  431    NK_ASSERT(img_width);
 
  432    NK_ASSERT(img_height);
 
  433    if (!out_memory || !in_memory || !img_height || !img_width) 
return;
 
  435    dst = (nk_rune*)out_memory;
 
  436    src = (
const nk_byte*)in_memory;
 
  437    for (n = (
int)(img_width * img_height); n > 0; n--)
 
  438        *dst++ = ((nk_rune)(*src++) << 24) | 0x00FFFFFF;
 
  447nk_font_text_width(
nk_handle handle, 
float height, 
const char *text, 
int len)
 
  451    float text_width = 0;
 
  455    struct nk_font *font = (
struct nk_font*)handle.ptr;
 
  457    NK_ASSERT(font->glyphs);
 
  458    if (!font || !text || !len)
 
  461    scale = height/font->info.height;
 
  462    glyph_len = text_len = nk_utf_decode(text, &unicode, (
int)len);
 
  463    if (!glyph_len) 
return 0;
 
  464    while (text_len <= (
int)len && glyph_len) {
 
  465        const struct nk_font_glyph *g;
 
  469        g = nk_font_find_glyph(font, unicode);
 
  470        text_width += g->xadvance * scale;
 
  473        glyph_len = nk_utf_decode(text + text_len, &unicode, (
int)len - text_len);
 
  474        text_len += glyph_len;
 
  478#ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT 
  480nk_font_query_font_glyph(
nk_handle handle, 
float height,
 
  481    struct nk_user_font_glyph *glyph, nk_rune codepoint, nk_rune next_codepoint)
 
  484    const struct nk_font_glyph *g;
 
  485    struct nk_font *font;
 
  488    NK_UNUSED(next_codepoint);
 
  490    font = (
struct nk_font*)handle.ptr;
 
  492    NK_ASSERT(font->glyphs);
 
  496    scale = height/font->info.height;
 
  497    g = nk_font_find_glyph(font, codepoint);
 
  498    glyph->width = (g->x1 - g->x0) * scale;
 
  499    glyph->height = (g->y1 - g->y0) * scale;
 
  500    glyph->offset = 
nk_vec2(g->x0 * scale, g->y0 * scale);
 
  501    glyph->xadvance = (g->xadvance * scale);
 
  502    glyph->uv[0] = 
nk_vec2(g->u0, g->v0);
 
  503    glyph->uv[1] = 
nk_vec2(g->u1, g->v1);
 
  506NK_API 
const struct nk_font_glyph*
 
  507nk_font_find_glyph(
const struct nk_font *font, nk_rune unicode)
 
  511    int total_glyphs = 0;
 
  512    const struct nk_font_glyph *glyph = 0;
 
  513    const struct nk_font_config *iter = 0;
 
  516    NK_ASSERT(font->glyphs);
 
  517    NK_ASSERT(font->info.ranges);
 
  518    if (!font || !font->glyphs) 
return 0;
 
  520    glyph = font->fallback;
 
  522    do {count = nk_range_count(iter->range);
 
  523        for (i = 0; i < count; ++i) {
 
  524            nk_rune f = iter->range[(i*2)+0];
 
  525            nk_rune t = iter->range[(i*2)+1];
 
  526            int diff = (int)((t - f) + 1);
 
  527            if (unicode >= f && unicode <= t)
 
  528                return &font->glyphs[((nk_rune)total_glyphs + (unicode - f))];
 
  529            total_glyphs += diff;
 
  531    } 
while ((iter = iter->n) != font->config);
 
  535nk_font_init(
struct nk_font *font, 
float pixel_height,
 
  536    nk_rune fallback_codepoint, 
struct nk_font_glyph *glyphs,
 
  537    const struct nk_baked_font *baked_font, 
nk_handle atlas)
 
  539    struct nk_baked_font baked;
 
  542    NK_ASSERT(baked_font);
 
  543    if (!font || !glyphs || !baked_font)
 
  549    font->scale = (float)pixel_height / (
float)font->info.height;
 
  550    font->glyphs = &glyphs[baked_font->glyph_offset];
 
  551    font->texture = atlas;
 
  552    font->fallback_codepoint = fallback_codepoint;
 
  553    font->fallback = nk_font_find_glyph(font, fallback_codepoint);
 
  555    font->handle.height = font->info.height * font->scale;
 
  556    font->handle.width = nk_font_text_width;
 
  557    font->handle.userdata.ptr = font;
 
  558#ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT 
  559    font->handle.query = nk_font_query_font_glyph;
 
  560    font->handle.texture = font->texture;
 
  574#pragma clang diagnostic push 
  575#pragma clang diagnostic ignored "-Woverlength-strings" 
  576#elif defined(__GNUC__) || defined(__GNUG__) 
  577#pragma GCC diagnostic push 
  578#pragma GCC diagnostic ignored "-Woverlength-strings" 
  581#ifdef NK_INCLUDE_DEFAULT_FONT 
  583NK_GLOBAL 
const char nk_proggy_clean_ttf_compressed_data_base85[11980+1] =
 
  584    "7])#######hV0qs'/###[),##/l:$#Q6>##5[n42>c-TH`->>#/e>11NNV=Bv(*:.F?uu#(gRU.o0XGH`$vhLG1hxt9?W`#,5LsCp#-i>.r$<$6pD>Lb';9Crc6tgXmKVeU2cD4Eo3R/" 
  585    "2*>]b(MC;$jPfY.;h^`IWM9<Lh2TlS+f-s$o6Q<BWH`YiU.xfLq$N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  675NK_GLOBAL 
const char nk_custom_cursor_data[NK_CURSOR_DATA_W * NK_CURSOR_DATA_H + 1] =
 
  677    "..-         -XXXXXXX-    X    -           X           -XXXXXXX          -          XXXXXXX" 
  678    "..-         -X.....X-   X.X   -          X.X          -X.....X          -          X.....X" 
  679    "---         -XXX.XXX-  X...X  -         X...X         -X....X           -           X....X" 
  680    "X           -  X.X  - X.....X -        X.....X        -X...X            -            X...X" 
  681    "XX          -  X.X  -X.......X-       X.......X       -X..X.X           -           X.X..X" 
  682    "X.X         -  X.X  -XXXX.XXXX-       XXXX.XXXX       -X.X X.X          -          X.X X.X" 
  683    "X..X        -  X.X  -   X.X   -          X.X          -XX   X.X         -         X.X   XX" 
  684    "X...X       -  X.X  -   X.X   -    XX    X.X    XX    -      X.X        -        X.X      " 
  685    "X....X      -  X.X  -   X.X   -   X.X    X.X    X.X   -       X.X       -       X.X       " 
  686    "X.....X     -  X.X  -   X.X   -  X..X    X.X    X..X  -        X.X      -      X.X        " 
  687    "X......X    -  X.X  -   X.X   - X...XXXXXX.XXXXXX...X -         X.X   XX-XX   X.X         " 
  688    "X.......X   -  X.X  -   X.X   -X.....................X-          X.X X.X-X.X X.X          " 
  689    "X........X  -  X.X  -   X.X   - X...XXXXXX.XXXXXX...X -           X.X..X-X..X.X           " 
  690    "X.........X -XXX.XXX-   X.X   -  X..X    X.X    X..X  -            X...X-X...X            " 
  691    "X..........X-X.....X-   X.X   -   X.X    X.X    X.X   -           X....X-X....X           " 
  692    "X......XXXXX-XXXXXXX-   X.X   -    XX    X.X    XX    -          X.....X-X.....X          " 
  693    "X...X..X    ---------   X.X   -          X.X          -          XXXXXXX-XXXXXXX          " 
  694    "X..X X..X   -       -XXXX.XXXX-       XXXX.XXXX       ------------------------------------" 
  695    "X.X  X..X   -       -X.......X-       X.......X       -    XX           XX    -           " 
  696    "XX    X..X  -       - X.....X -        X.....X        -   X.X           X.X   -           " 
  697    "      X..X          -  X...X  -         X...X         -  X..X           X..X  -           " 
  698    "       XX           -   X.X   -          X.X          - X...XXXXXXXXXXXXX...X -           " 
  699    "------------        -    X    -           X           -X.....................X-           " 
  700    "                    ----------------------------------- X...XXXXXXXXXXXXX...X -           " 
  707#pragma clang diagnostic pop 
  708#elif defined(__GNUC__) || defined(__GNUG__) 
  709#pragma GCC diagnostic pop 
  712NK_GLOBAL 
unsigned char *nk__barrier;
 
  713NK_GLOBAL 
unsigned char *nk__barrier2;
 
  714NK_GLOBAL 
unsigned char *nk__barrier3;
 
  715NK_GLOBAL 
unsigned char *nk__barrier4;
 
  716NK_GLOBAL 
unsigned char *nk__dout;
 
  718NK_INTERN 
unsigned int 
  719nk_decompress_length(
unsigned char *input)
 
  721    return (
unsigned int)((input[8] << 24) + (input[9] << 16) + (input[10] << 8) + input[11]);
 
  724nk__match(
unsigned char *data, 
unsigned int length)
 
  727    NK_ASSERT (nk__dout + length <= nk__barrier);
 
  728    if (nk__dout + length > nk__barrier) { nk__dout += length; 
return; }
 
  729    if (data < nk__barrier4) { nk__dout = nk__barrier+1; 
return; }
 
  730    while (length--) *nk__dout++ = *data++;
 
  733nk__lit(
unsigned char *data, 
unsigned int length)
 
  735    NK_ASSERT (nk__dout + length <= nk__barrier);
 
  736    if (nk__dout + length > nk__barrier) { nk__dout += length; 
return; }
 
  737    if (data < nk__barrier2) { nk__dout = nk__barrier+1; 
return; }
 
  738    NK_MEMCPY(nk__dout, data, length);
 
  741NK_INTERN 
unsigned char*
 
  742nk_decompress_token(
unsigned char *i)
 
  744    #define nk__in2(x)   ((i[x] << 8) + i[(x)+1]) 
  745    #define nk__in3(x)   ((i[x] << 16) + nk__in2((x)+1)) 
  746    #define nk__in4(x)   ((i[x] << 24) + nk__in3((x)+1)) 
  749        if (*i >= 0x80)       nk__match(nk__dout-i[1]-1, (
unsigned int)i[0] - 0x80 + 1), i += 2;
 
  750        else if (*i >= 0x40)  nk__match(nk__dout-(nk__in2(0) - 0x4000 + 1), (
unsigned int)i[2]+1), i += 3;
 
  751        else  nk__lit(i+1, (
unsigned int)i[0] - 0x20 + 1), i += 1 + (i[0] - 0x20 + 1);
 
  753        if (*i >= 0x18)       nk__match(nk__dout-(
unsigned int)(nk__in3(0) - 0x180000 + 1), (
unsigned int)i[3]+1), i += 4;
 
  754        else if (*i >= 0x10)  nk__match(nk__dout-(
unsigned int)(nk__in3(0) - 0x100000 + 1), (
unsigned int)nk__in2(3)+1), i += 5;
 
  755        else if (*i >= 0x08)  nk__lit(i+2, (
unsigned int)nk__in2(0) - 0x0800 + 1), i += 2 + (nk__in2(0) - 0x0800 + 1);
 
  756        else if (*i == 0x07)  nk__lit(i+3, (
unsigned int)nk__in2(1) + 1), i += 3 + (nk__in2(1) + 1);
 
  757        else if (*i == 0x06)  nk__match(nk__dout-(
unsigned int)(nk__in3(1)+1), i[4]+1u), i += 5;
 
  758        else if (*i == 0x04)  nk__match(nk__dout-(
unsigned int)(nk__in3(1)+1), (
unsigned int)nk__in2(4)+1u), i += 6;
 
  762NK_INTERN 
unsigned int 
  763nk_adler32(
unsigned int adler32, 
unsigned char *buffer, 
unsigned int buflen)
 
  765    const unsigned long ADLER_MOD = 65521;
 
  766    unsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16;
 
  767    unsigned long blocklen, i;
 
  769    blocklen = buflen % 5552;
 
  771        for (i=0; i + 7 < blocklen; i += 8) {
 
  772            s1 += buffer[0]; s2 += s1;
 
  773            s1 += buffer[1]; s2 += s1;
 
  774            s1 += buffer[2]; s2 += s1;
 
  775            s1 += buffer[3]; s2 += s1;
 
  776            s1 += buffer[4]; s2 += s1;
 
  777            s1 += buffer[5]; s2 += s1;
 
  778            s1 += buffer[6]; s2 += s1;
 
  779            s1 += buffer[7]; s2 += s1;
 
  782        for (; i < blocklen; ++i) {
 
  783            s1 += *buffer++; s2 += s1;
 
  786        s1 %= ADLER_MOD; s2 %= ADLER_MOD;
 
  787        buflen -= (
unsigned int)blocklen;
 
  790    return (
unsigned int)(s2 << 16) + (
unsigned int)s1;
 
  792NK_INTERN 
unsigned int 
  793nk_decompress(
unsigned char *output, 
unsigned char *i, 
unsigned int length)
 
  796    if (nk__in4(0) != 0x57bC0000) 
return 0;
 
  797    if (nk__in4(4) != 0)          
return 0; 
 
  798    olen = nk_decompress_length(i);
 
  800    nk__barrier3 = i+length;
 
  801    nk__barrier = output + olen;
 
  802    nk__barrier4 = output;
 
  807        unsigned char *old_i = i;
 
  808        i = nk_decompress_token(i);
 
  810            if (*i == 0x05 && i[1] == 0xfa) {
 
  811                NK_ASSERT(nk__dout == output + olen);
 
  812                if (nk__dout != output + olen) 
return 0;
 
  813                if (nk_adler32(1, output, olen) != (
unsigned int) nk__in4(2))
 
  821        NK_ASSERT(nk__dout <= output + olen);
 
  822        if (nk__dout > output + olen)
 
  826NK_INTERN 
unsigned int 
  827nk_decode_85_byte(
char c)
 
  829    return (
unsigned int)((c >= 
'\\') ? c-36 : c-35);
 
  832nk_decode_85(
unsigned char* dst, 
const unsigned char* src)
 
  837            nk_decode_85_byte((
char)src[0]) +
 
  838            85 * (nk_decode_85_byte((
char)src[1]) +
 
  839            85 * (nk_decode_85_byte((
char)src[2]) +
 
  840            85 * (nk_decode_85_byte((
char)src[3]) +
 
  841            85 * nk_decode_85_byte((
char)src[4]))));
 
  844        dst[0] = (
unsigned char)((tmp >> 0) & 0xFF);
 
  845        dst[1] = (
unsigned char)((tmp >> 8) & 0xFF);
 
  846        dst[2] = (
unsigned char)((tmp >> 16) & 0xFF);
 
  847        dst[3] = (
unsigned char)((tmp >> 24) & 0xFF);
 
  859NK_API 
struct nk_font_config
 
  860nk_font_config(float pixel_height)
 
  862    struct nk_font_config cfg;
 
  866    cfg.ttf_data_owned_by_atlas = 0;
 
  867    cfg.size = pixel_height;
 
  868    cfg.oversample_h = 3;
 
  869    cfg.oversample_v = 1;
 
  871    cfg.coord_type = NK_COORD_UV;
 
  873    cfg.range = nk_font_default_glyph_ranges();
 
  875    cfg.fallback_glyph = 
'?';
 
  880#ifdef NK_INCLUDE_DEFAULT_ALLOCATOR 
  882nk_font_atlas_init_default(
struct nk_font_atlas *atlas)
 
  886    nk_zero_struct(*atlas);
 
  887    atlas->temporary.userdata.ptr = 0;
 
  888    atlas->temporary.alloc = nk_malloc;
 
  889    atlas->temporary.free = nk_mfree;
 
  890    atlas->permanent.userdata.ptr = 0;
 
  891    atlas->permanent.alloc = nk_malloc;
 
  892    atlas->permanent.free = nk_mfree;
 
  896nk_font_atlas_init(
struct nk_font_atlas *atlas, 
const struct nk_allocator *alloc)
 
  900    if (!atlas || !alloc) 
return;
 
  901    nk_zero_struct(*atlas);
 
  902    atlas->permanent = *alloc;
 
  903    atlas->temporary = *alloc;
 
  906nk_font_atlas_init_custom(
struct nk_font_atlas *atlas,
 
  910    NK_ASSERT(permanent);
 
  911    NK_ASSERT(temporary);
 
  912    if (!atlas || !permanent || !temporary) 
return;
 
  913    nk_zero_struct(*atlas);
 
  914    atlas->permanent = *permanent;
 
  915    atlas->temporary = *temporary;
 
  918nk_font_atlas_begin(
struct nk_font_atlas *atlas)
 
  921    NK_ASSERT(atlas->temporary.alloc && atlas->temporary.free);
 
  922    NK_ASSERT(atlas->permanent.alloc && atlas->permanent.free);
 
  923    if (!atlas || !atlas->permanent.alloc || !atlas->permanent.free ||
 
  924        !atlas->temporary.alloc || !atlas->temporary.free) 
return;
 
  926        atlas->permanent.free(atlas->permanent.userdata, atlas->glyphs);
 
  930        atlas->permanent.free(atlas->permanent.userdata, atlas->pixel);
 
  934NK_API 
struct nk_font*
 
  935nk_font_atlas_add(
struct nk_font_atlas *atlas, 
const struct nk_font_config *config)
 
  937    struct nk_font *font = 0;
 
  938    struct nk_font_config *cfg;
 
  941    NK_ASSERT(atlas->permanent.alloc);
 
  942    NK_ASSERT(atlas->permanent.free);
 
  943    NK_ASSERT(atlas->temporary.alloc);
 
  944    NK_ASSERT(atlas->temporary.free);
 
  947    NK_ASSERT(config->ttf_blob);
 
  948    NK_ASSERT(config->ttf_size);
 
  949    NK_ASSERT(config->size > 0.0f);
 
  951    if (!atlas || !config || !config->ttf_blob || !config->ttf_size || config->size <= 0.0f||
 
  952        !atlas->permanent.alloc || !atlas->permanent.free ||
 
  953        !atlas->temporary.alloc || !atlas->temporary.free)
 
  957    cfg = (
struct nk_font_config*)
 
  958        atlas->permanent.alloc(atlas->permanent.userdata,0, 
sizeof(
struct nk_font_config));
 
  959    NK_MEMCPY(cfg, config, 
sizeof(*config));
 
  963    if (!config->merge_mode) {
 
  965        if (!atlas->config) {
 
  969            struct nk_font_config *i = atlas->config;
 
  970            while (i->next) i = i->next;
 
  975        font = (
struct nk_font*)
 
  976            atlas->permanent.alloc(atlas->permanent.userdata,0, 
sizeof(
struct nk_font));
 
  978        nk_zero(font, 
sizeof(*font));
 
  987            struct nk_font *i = atlas->fonts;
 
  988            while (i->next) i = i->next;
 
  992        cfg->font = &font->info;
 
  995        struct nk_font *f = 0;
 
  996        struct nk_font_config *c = 0;
 
  997        NK_ASSERT(atlas->font_num);
 
 1000        cfg->font = &f->info;
 
 1008    if (!config->ttf_data_owned_by_atlas) {
 
 1009        cfg->ttf_blob = atlas->permanent.alloc(atlas->permanent.userdata,0, cfg->ttf_size);
 
 1010        NK_ASSERT(cfg->ttf_blob);
 
 1011        if (!cfg->ttf_blob) {
 
 1015        NK_MEMCPY(cfg->ttf_blob, config->ttf_blob, cfg->ttf_size);
 
 1016        cfg->ttf_data_owned_by_atlas = 1;
 
 1021NK_API 
struct nk_font*
 
 1022nk_font_atlas_add_from_memory(
struct nk_font_atlas *atlas, 
void *memory,
 
 1023    nk_size size, 
float height, 
const struct nk_font_config *config)
 
 1025    struct nk_font_config cfg;
 
 1030    NK_ASSERT(atlas->temporary.alloc);
 
 1031    NK_ASSERT(atlas->temporary.free);
 
 1032    NK_ASSERT(atlas->permanent.alloc);
 
 1033    NK_ASSERT(atlas->permanent.free);
 
 1034    if (!atlas || !atlas->temporary.alloc || !atlas->temporary.free || !memory || !size ||
 
 1035        !atlas->permanent.alloc || !atlas->permanent.free)
 
 1038    cfg = (config) ? *config: nk_font_config(height);
 
 1039    cfg.ttf_blob = memory;
 
 1040    cfg.ttf_size = size;
 
 1042    cfg.ttf_data_owned_by_atlas = 0;
 
 1043    return nk_font_atlas_add(atlas, &cfg);
 
 1045#ifdef NK_INCLUDE_STANDARD_IO 
 1046NK_API 
struct nk_font*
 
 1047nk_font_atlas_add_from_file(
struct nk_font_atlas *atlas, 
const char *file_path,
 
 1048    float height, 
const struct nk_font_config *config)
 
 1052    struct nk_font_config cfg;
 
 1055    NK_ASSERT(atlas->temporary.alloc);
 
 1056    NK_ASSERT(atlas->temporary.free);
 
 1057    NK_ASSERT(atlas->permanent.alloc);
 
 1058    NK_ASSERT(atlas->permanent.free);
 
 1060    if (!atlas || !file_path) 
return 0;
 
 1061    memory = nk_file_load(file_path, &size, &atlas->permanent);
 
 1062    if (!memory) 
return 0;
 
 1064    cfg = (config) ? *config: nk_font_config(height);
 
 1065    cfg.ttf_blob = memory;
 
 1066    cfg.ttf_size = size;
 
 1068    cfg.ttf_data_owned_by_atlas = 1;
 
 1069    return nk_font_atlas_add(atlas, &cfg);
 
 1072NK_API 
struct nk_font*
 
 1073nk_font_atlas_add_compressed(
struct nk_font_atlas *atlas,
 
 1074    void *compressed_data, nk_size compressed_size, 
float height,
 
 1075    const struct nk_font_config *config)
 
 1077    unsigned int decompressed_size;
 
 1078    void *decompressed_data;
 
 1079    struct nk_font_config cfg;
 
 1082    NK_ASSERT(atlas->temporary.alloc);
 
 1083    NK_ASSERT(atlas->temporary.free);
 
 1084    NK_ASSERT(atlas->permanent.alloc);
 
 1085    NK_ASSERT(atlas->permanent.free);
 
 1087    NK_ASSERT(compressed_data);
 
 1088    NK_ASSERT(compressed_size);
 
 1089    if (!atlas || !compressed_data || !atlas->temporary.alloc || !atlas->temporary.free ||
 
 1090        !atlas->permanent.alloc || !atlas->permanent.free)
 
 1093    decompressed_size = nk_decompress_length((
unsigned char*)compressed_data);
 
 1094    decompressed_data = atlas->permanent.alloc(atlas->permanent.userdata,0,decompressed_size);
 
 1095    NK_ASSERT(decompressed_data);
 
 1096    if (!decompressed_data) 
return 0;
 
 1097    nk_decompress((
unsigned char*)decompressed_data, (
unsigned char*)compressed_data,
 
 1098        (
unsigned int)compressed_size);
 
 1100    cfg = (config) ? *config: nk_font_config(height);
 
 1101    cfg.ttf_blob = decompressed_data;
 
 1102    cfg.ttf_size = decompressed_size;
 
 1104    cfg.ttf_data_owned_by_atlas = 1;
 
 1105    return nk_font_atlas_add(atlas, &cfg);
 
 1107NK_API 
struct nk_font*
 
 1108nk_font_atlas_add_compressed_base85(
struct nk_font_atlas *atlas,
 
 1109    const char *data_base85, 
float height, 
const struct nk_font_config *config)
 
 1111    int compressed_size;
 
 1112    void *compressed_data;
 
 1113    struct nk_font *font;
 
 1116    NK_ASSERT(atlas->temporary.alloc);
 
 1117    NK_ASSERT(atlas->temporary.free);
 
 1118    NK_ASSERT(atlas->permanent.alloc);
 
 1119    NK_ASSERT(atlas->permanent.free);
 
 1121    NK_ASSERT(data_base85);
 
 1122    if (!atlas || !data_base85 || !atlas->temporary.alloc || !atlas->temporary.free ||
 
 1123        !atlas->permanent.alloc || !atlas->permanent.free)
 
 1126    compressed_size = (((int)nk_strlen(data_base85) + 4) / 5) * 4;
 
 1127    compressed_data = atlas->temporary.alloc(atlas->temporary.userdata,0, (nk_size)compressed_size);
 
 1128    NK_ASSERT(compressed_data);
 
 1129    if (!compressed_data) 
return 0;
 
 1130    nk_decode_85((
unsigned char*)compressed_data, (
const unsigned char*)data_base85);
 
 1131    font = nk_font_atlas_add_compressed(atlas, compressed_data,
 
 1132                    (nk_size)compressed_size, height, config);
 
 1133    atlas->temporary.free(atlas->temporary.userdata, compressed_data);
 
 1137#ifdef NK_INCLUDE_DEFAULT_FONT 
 1138NK_API 
struct nk_font*
 
 1139nk_font_atlas_add_default(
struct nk_font_atlas *atlas,
 
 1140    float pixel_height, 
const struct nk_font_config *config)
 
 1143    NK_ASSERT(atlas->temporary.alloc);
 
 1144    NK_ASSERT(atlas->temporary.free);
 
 1145    NK_ASSERT(atlas->permanent.alloc);
 
 1146    NK_ASSERT(atlas->permanent.free);
 
 1147    return nk_font_atlas_add_compressed_base85(atlas,
 
 1148        nk_proggy_clean_ttf_compressed_data_base85, pixel_height, config);
 
 1152nk_font_atlas_bake(
struct nk_font_atlas *atlas, 
int *width, 
int *height,
 
 1153    enum nk_font_atlas_format fmt)
 
 1157    nk_size tmp_size, img_size;
 
 1158    struct nk_font *font_iter;
 
 1159    struct nk_font_baker *baker;
 
 1162    NK_ASSERT(atlas->temporary.alloc);
 
 1163    NK_ASSERT(atlas->temporary.free);
 
 1164    NK_ASSERT(atlas->permanent.alloc);
 
 1165    NK_ASSERT(atlas->permanent.free);
 
 1169    if (!atlas || !width || !height ||
 
 1170        !atlas->temporary.alloc || !atlas->temporary.free ||
 
 1171        !atlas->permanent.alloc || !atlas->permanent.free)
 
 1174#ifdef NK_INCLUDE_DEFAULT_FONT 
 1176    if (!atlas->font_num)
 
 1177        atlas->default_font = nk_font_atlas_add_default(atlas, 13.0f, 0);
 
 1179    NK_ASSERT(atlas->font_num);
 
 1180    if (!atlas->font_num) 
return 0;
 
 1183    nk_font_baker_memory(&tmp_size, &atlas->glyph_count, atlas->config, atlas->font_num);
 
 1184    tmp = atlas->temporary.alloc(atlas->temporary.userdata,0, tmp_size);
 
 1186    if (!tmp) 
goto failed;
 
 1187    NK_MEMSET(tmp,0,tmp_size);
 
 1190    baker = nk_font_baker(tmp, atlas->glyph_count, atlas->font_num, &atlas->temporary);
 
 1191    atlas->glyphs = (
struct nk_font_glyph*)atlas->permanent.alloc(
 
 1192        atlas->permanent.userdata,0, 
sizeof(
struct nk_font_glyph)*(nk_size)atlas->glyph_count);
 
 1193    NK_ASSERT(atlas->glyphs);
 
 1198    atlas->custom.w = (NK_CURSOR_DATA_W*2)+1;
 
 1199    atlas->custom.h = NK_CURSOR_DATA_H + 1;
 
 1200    if (!nk_font_bake_pack(baker, &img_size, width, height, &atlas->custom,
 
 1201        atlas->config, atlas->font_num, &atlas->temporary))
 
 1205    atlas->pixel = atlas->temporary.alloc(atlas->temporary.userdata,0, img_size);
 
 1206    NK_ASSERT(atlas->pixel);
 
 1211    nk_font_bake(baker, atlas->pixel, *width, *height,
 
 1212        atlas->glyphs, atlas->glyph_count, atlas->config, atlas->font_num);
 
 1213    nk_font_bake_custom_data(atlas->pixel, *width, *height, atlas->custom,
 
 1214            nk_custom_cursor_data, NK_CURSOR_DATA_W, NK_CURSOR_DATA_H, 
'.', 
'X');
 
 1216    if (fmt == NK_FONT_ATLAS_RGBA32) {
 
 1218        void *img_rgba = atlas->temporary.alloc(atlas->temporary.userdata,0,
 
 1219                            (nk_size)(*width * *height * 4));
 
 1220        NK_ASSERT(img_rgba);
 
 1221        if (!img_rgba) 
goto failed;
 
 1222        nk_font_bake_convert(img_rgba, *width, *height, atlas->pixel);
 
 1223        atlas->temporary.free(atlas->temporary.userdata, atlas->pixel);
 
 1224        atlas->pixel = img_rgba;
 
 1226    atlas->tex_width = *width;
 
 1227    atlas->tex_height = *height;
 
 1230    for (font_iter = atlas->fonts; font_iter; font_iter = font_iter->next) {
 
 1231        struct nk_font *font = font_iter;
 
 1232        struct nk_font_config *config = font->config;
 
 1233        nk_font_init(font, config->size, config->fallback_glyph, atlas->glyphs,
 
 1234            config->font, nk_handle_ptr(0));
 
 1238    {NK_STORAGE 
const struct nk_vec2 nk_cursor_data[NK_CURSOR_COUNT][3] = {
 
 1240        {{ 0, 3},   {12,19},    { 0, 0}},
 
 1241        {{13, 0},   { 7,16},    { 4, 8}},
 
 1242        {{31, 0},   {23,23},    {11,11}},
 
 1243        {{21, 0},   { 9, 23},   { 5,11}},
 
 1244        {{55,18},   {23, 9},    {11, 5}},
 
 1245        {{73, 0},   {17,17},    { 9, 9}},
 
 1246        {{55, 0},   {17,17},    { 9, 9}}
 
 1248    for (i = 0; i < NK_CURSOR_COUNT; ++i) {
 
 1249        struct nk_cursor *cursor = &atlas->cursors[i];
 
 1250        cursor->img.w = (
unsigned short)*width;
 
 1251        cursor->img.h = (
unsigned short)*height;
 
 1252        cursor->img.region[0] = (
unsigned short)(atlas->custom.x + nk_cursor_data[i][0].x);
 
 1253        cursor->img.region[1] = (
unsigned short)(atlas->custom.y + nk_cursor_data[i][0].y);
 
 1254        cursor->img.region[2] = (
unsigned short)nk_cursor_data[i][1].x;
 
 1255        cursor->img.region[3] = (
unsigned short)nk_cursor_data[i][1].y;
 
 1256        cursor->size = nk_cursor_data[i][1];
 
 1257        cursor->offset = nk_cursor_data[i][2];
 
 1260    atlas->temporary.free(atlas->temporary.userdata, tmp);
 
 1261    return atlas->pixel;
 
 1265    if (tmp) atlas->temporary.free(atlas->temporary.userdata, tmp);
 
 1266    if (atlas->glyphs) {
 
 1267        atlas->permanent.free(atlas->permanent.userdata, atlas->glyphs);
 
 1271        atlas->temporary.free(atlas->temporary.userdata, atlas->pixel);
 
 1277nk_font_atlas_end(
struct nk_font_atlas *atlas, 
nk_handle texture,
 
 1281    struct nk_font *font_iter;
 
 1284        if (!tex_null) 
return;
 
 1285        tex_null->texture = texture;
 
 1289        tex_null->texture = texture;
 
 1290        tex_null->
uv.x = (atlas->custom.x + 0.5f)/(
float)atlas->tex_width;
 
 1291        tex_null->
uv.y = (atlas->custom.y + 0.5f)/(
float)atlas->tex_height;
 
 1293    for (font_iter = atlas->fonts; font_iter; font_iter = font_iter->next) {
 
 1294        font_iter->texture = texture;
 
 1295#ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT 
 1296        font_iter->handle.texture = texture;
 
 1299    for (i = 0; i < NK_CURSOR_COUNT; ++i)
 
 1300        atlas->cursors[i].img.handle = texture;
 
 1302    atlas->temporary.free(atlas->temporary.userdata, atlas->pixel);
 
 1304    atlas->tex_width = 0;
 
 1305    atlas->tex_height = 0;
 
 1306    atlas->custom.x = 0;
 
 1307    atlas->custom.y = 0;
 
 1308    atlas->custom.w = 0;
 
 1309    atlas->custom.h = 0;
 
 1312nk_font_atlas_cleanup(
struct nk_font_atlas *atlas)
 
 1315    NK_ASSERT(atlas->temporary.alloc);
 
 1316    NK_ASSERT(atlas->temporary.free);
 
 1317    NK_ASSERT(atlas->permanent.alloc);
 
 1318    NK_ASSERT(atlas->permanent.free);
 
 1319    if (!atlas || !atlas->permanent.alloc || !atlas->permanent.free) 
return;
 
 1320    if (atlas->config) {
 
 1321        struct nk_font_config *iter;
 
 1322        for (iter = atlas->config; iter; iter = iter->next) {
 
 1323            struct nk_font_config *i;
 
 1324            for (i = iter->n; i != iter; i = i->n) {
 
 1325                atlas->permanent.free(atlas->permanent.userdata, i->ttf_blob);
 
 1328            atlas->permanent.free(atlas->permanent.userdata, iter->ttf_blob);
 
 1334nk_font_atlas_clear(
struct nk_font_atlas *atlas)
 
 1337    NK_ASSERT(atlas->temporary.alloc);
 
 1338    NK_ASSERT(atlas->temporary.free);
 
 1339    NK_ASSERT(atlas->permanent.alloc);
 
 1340    NK_ASSERT(atlas->permanent.free);
 
 1341    if (!atlas || !atlas->permanent.alloc || !atlas->permanent.free) 
return;
 
 1343    if (atlas->config) {
 
 1344        struct nk_font_config *iter, *next;
 
 1345        for (iter = atlas->config; iter; iter = next) {
 
 1346            struct nk_font_config *i, *n;
 
 1347            for (i = iter->n; i != iter; i = n) {
 
 1350                    atlas->permanent.free(atlas->permanent.userdata, i->ttf_blob);
 
 1351                atlas->permanent.free(atlas->permanent.userdata, i);
 
 1355                atlas->permanent.free(atlas->permanent.userdata, iter->ttf_blob);
 
 1356            atlas->permanent.free(atlas->permanent.userdata, iter);
 
 1361        struct nk_font *iter, *next;
 
 1362        for (iter = atlas->fonts; iter; iter = next) {
 
 1364            atlas->permanent.free(atlas->permanent.userdata, iter);
 
 1369        atlas->permanent.free(atlas->permanent.userdata, atlas->glyphs);
 
 1370    nk_zero_struct(*atlas);
 
main API and documentation file
#define NK_UTF_INVALID
internal invalid utf8 rune
struct nk_vec2 uv
!< texture handle to a texture with a white pixel