Lines Matching defs:font

50 /// - Optional font baker and vertex buffer output
58 /// - Use your own font implementation for everything
59 /// - Use this libraries internal font baking and handling API
103 /// NK_INCLUDE_FONT_BAKING | Defining this adds `stb_truetype` and `stb_rect_pack` implementation to this library and provides font baking and rendering. If you already have font handling or do not want to use this font handler you don't have to define it.
104 /// NK_INCLUDE_DEFAULT_FONT | Defining this adds the default font: ProggyClean.ttf into this library which can be loaded into a font atlas and allows using this library without having a truetype font
184 /// nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font);
523 /// Each takes in a font handle and a specific way of handling memory. Memory control
554 /// int nk_init_default(struct nk_context *ctx, const struct nk_user_font *font);
560 /// __font__ | Must point to a previously initialized font handle for more info look at font documentation
575 /// int nk_init_fixed(struct nk_context *ctx, void *memory, nk_size size, const struct nk_user_font *font);
586 /// __font__ | Must point to a previously initialized font handle for more info look at font documentation
597 /// int nk_init(struct nk_context *ctx, struct nk_allocator *alloc, const struct nk_user_font *font);
604 /// __font__ | Must point to a previously initialized font handle for more info look at font documentation
615 /// int nk_init_custom(struct nk_context *ctx, struct nk_buffer *cmds, struct nk_buffer *pool, const struct nk_user_font *font);
623 /// __font__ | Must point to a previously initialized font handle for more info look at font documentation
2012 /// often depends on the height of the font. <br /><br />
2015 /// height plus padding of currently active font and overwrites the row height
2020 /// reset it back to be derived from font height. <br /><br />
2022 /// Also if you change the font in nuklear it will automatically change the minimum
2023 /// row height for you and. This means if you change the font but still want
2024 /// a minimum row height smaller than the font you have to repush your value. <br /><br />
2234 /// nk_layout_reset_min_row_height | Resets the currently used minimum row height to font height
2801 /// calculates a auto height based on the currently used font size
3754 different ways to use the font atlas. The first two will use your font
3756 slightly more advanced features is font handling with vertex buffer output.
3757 Finally the most complex API wise is using nuklear's font baking API.
3761 So first up the easiest way to do font handling is by just providing a
3763 font and a callback to calculate the width of a string. This way of handling
3766 of deeper knowledge about which font handling mechanism you use.
3778 struct nk_user_font font;
3779 font.userdata.ptr = &your_font_class_or_struct;
3780 font.height = your_font_height;
3781 font.width = your_text_width_calculation;
3784 nk_init_default(&ctx, &font);
3789 vertex buffer output it is not enough if you do. To get font handling working
3792 of a bigger font atlas texture and a callback to query a character's glyph
3794 font and use the vertex buffer output.
3816 struct nk_user_font font;
3817 font.userdata.ptr = &your_font_class_or_struct;
3818 font.height = your_font_height;
3819 font.width = your_text_width_calculation;
3820 font.query = query_your_font_glyph;
3821 font.texture.id = your_font_texture;
3824 nk_init_default(&ctx, &font);
3826 3.) Nuklear font baker
3828 The final approach if you do not have a font handling functionality or don't
3829 want to use it in this library is by using the optional font baker.
3830 The font baker APIs can be used to create a font plus font atlas texture
3834 previously stated still work. The font baker is not located inside
3845 After successfully initializing the font baker you can add Truetype(.ttf) fonts from
3847 functions. Adding font will permanently store each font, font config and ttf memory block(!)
3848 inside the font atlas and allows to reuse the font atlas. If you don't want to reuse
3849 the font baker by for example adding additional fonts you can call
3857 will free all temporary memory including the font atlas image so make sure
3859 to your font texture or object and optionally fills a `struct nk_draw_null_texture`
3863 At this point you are done and if you don't want to reuse the font atlas you
3865 memory. Finally if you don't use the font atlas and any of it's fonts anymore
3871 nk_font *font = nk_font_atlas_add_from_file(&atlas, "Path/To/Your/TTF_Font.ttf", 13, 0);
3877 nk_init_default(&ctx, &font->handle);
3883 The font baker API is probably the most complex API inside this library and
3885 to use the font atlas. There are a number of details I left out. For example
3886 how to merge fonts, configure a font with `nk_font_config` to use other languages,
3893 nk_font *font = nk_font_atlas_add_from_file(&atlas, "Path/To/Your/TTF_Font.ttf", 13, &cfg);
3917 /* user provided font handle */
3919 /* max height of the font */
3921 /* font string width in pixel callback */
3924 /* font glyph callback to query drawing info */
3926 /* texture handle to the used font atlas or texture */
3932 NK_COORD_UV, /* texture coordinates inside font glyphs are clamped between 0-1 */
3933 NK_COORD_PIXEL /* texture coordinates inside font glyphs are in absolute pixel */
3939 /* height of the font */
3941 /* font glyphs ascent and descent */
3943 /* glyph array offset inside the font glyph baking output array */
3945 /* number of glyphs of this font inside the glyph baking array output */
3947 /* font codepoint ranges as pairs of (from/to) and 0 as last element */
3961 /* used inside font atlas: default to: 0*/
3963 /* merges this font into the last font */
3971 /* baked pixel height of the font */
3978 struct nk_baked_font *font;
3979 /* font to setup in the baking process: NOTE: not needed for font atlas */
4548 const struct nk_user_font *font;
5214 const struct nk_user_font *font;
5823 NK_LIB int nk_text_clamp(const struct nk_user_font *font, const char *text, int text_len, float space, int *glyphs, float *text_width, nk_rune *sep_list, int sep_count);
5824 NK_LIB struct nk_vec2 nk_text_calculate_text_bounds(const struct nk_user_font *font, const char *begin, int byte_len, float row_height, const char **remaining, struct nk_vec2 *out_offset, int *glyphs, int op);
5845 NK_LIB void nk_draw_symbol(struct nk_command_buffer *out, enum nk_symbol_type type, struct nk_rect content, struct nk_color background, struct nk_color foreground, float border_width, const struct nk_user_font *font);
5858 NK_LIB void nk_textedit_click(struct nk_text_edit *state, float x, float y, const struct nk_user_font *font, float row_height);
5859 NK_LIB void nk_textedit_drag(struct nk_text_edit *state, float x, float y, const struct nk_user_font *font, float row_height);
5860 NK_LIB void nk_textedit_key(struct nk_text_edit *state, enum nk_keys key, int shift_mod, const struct nk_user_font *font, float row_height);
5929 NK_LIB void nk_draw_button_text(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *content, nk_flags state, const struct nk_style_button *style, const char *txt, int len, nk_flags text_alignment, const struct nk_user_font *font);
5930 NK_LIB int nk_do_button_text(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, const char *string, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_input *in, const struct nk_user_font *font);
5931 NK_LIB void nk_draw_button_symbol(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *content, nk_flags state, const struct nk_style_button *style, enum nk_symbol_type type, const struct nk_user_font *font);
5932 NK_LIB int nk_do_button_symbol(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, enum nk_symbol_type symbol, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_input *in, const struct nk_user_font *font);
5935 NK_LIB void nk_draw_button_text_symbol(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *symbol, nk_flags state, const struct nk_style_button *style, const char *str, int len, enum nk_symbol_type type, const struct nk_user_font *font);
5936 NK_LIB int nk_do_button_text_symbol(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, enum nk_symbol_type symbol, const char *str, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_user_font *font, const struct nk_input *in);
5937 NK_LIB void nk_draw_button_text_image(struct nk_command_buffer *out, const struct nk_rect *bounds, const struct nk_rect *label, const struct nk_rect *image, nk_flags state, const struct nk_style_button *style, const char *str, int len, const struct nk_user_font *font, const struct nk_image *img);
5938 NK_LIB int nk_do_button_text_image(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, struct nk_image img, const char* str, int len, nk_flags align, enum nk_button_behavior behavior, const struct nk_style_button *style, const struct nk_user_font *font, const struct nk_input *in);
5946 NK_LIB void nk_draw_checkbox(struct nk_command_buffer *out, nk_flags state, const struct nk_style_toggle *style, int active, const struct nk_rect *label, const struct nk_rect *selector, const struct nk_rect *cursors, const char *string, int len, const struct nk_user_font *font);
5947 NK_LIB void nk_draw_option(struct nk_command_buffer *out, nk_flags state, const struct nk_style_toggle *style, int active, const struct nk_rect *label, const struct nk_rect *selector, const struct nk_rect *cursors, const char *string, int len, const struct nk_user_font *font);
5948 NK_LIB int nk_do_toggle(nk_flags *state, struct nk_command_buffer *out, struct nk_rect r, int *active, const char *str, int len, enum nk_toggle_type type, const struct nk_style_toggle *style, const struct nk_input *in, const struct nk_user_font *font);
5958 NK_LIB float nk_do_slider(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, float min, float val, float max, float step, const struct nk_style_slider *style, struct nk_input *in, const struct nk_user_font *font);
5963 NK_LIB float nk_do_scrollbarv(nk_flags *state, struct nk_command_buffer *out, struct nk_rect scroll, int has_scrolling, float offset, float target, float step, float button_pixel_inc, const struct nk_style_scrollbar *style, struct nk_input *in, const struct nk_user_font *font);
5964 NK_LIB float nk_do_scrollbarh(nk_flags *state, struct nk_command_buffer *out, struct nk_rect scroll, int has_scrolling, float offset, float target, float step, float button_pixel_inc, const struct nk_style_scrollbar *style, struct nk_input *in, const struct nk_user_font *font);
5967 NK_LIB void nk_draw_selectable(struct nk_command_buffer *out, nk_flags state, const struct nk_style_selectable *style, int active, const struct nk_rect *bounds, const struct nk_rect *icon, const struct nk_image *img, enum nk_symbol_type sym, const char *string, int len, nk_flags align, const struct nk_user_font *font);
5968 NK_LIB int nk_do_selectable(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, const char *str, int len, nk_flags align, int *value, const struct nk_style_selectable *style, const struct nk_input *in, const struct nk_user_font *font);
5969 NK_LIB int nk_do_selectable_image(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, const char *str, int len, nk_flags align, int *value, const struct nk_image *img, const struct nk_style_selectable *style, const struct nk_input *in, const struct nk_user_font *font);
5972 NK_LIB void nk_edit_draw_text(struct nk_command_buffer *out, const struct nk_style_edit *style, float pos_x, float pos_y, float x_offset, const char *text, int byte_len, float row_height, const struct nk_user_font *font, struct nk_color background, struct nk_color foreground, int is_selected);
5973 NK_LIB nk_flags nk_do_edit(nk_flags *state, struct nk_command_buffer *out, struct nk_rect bounds, nk_flags flags, nk_plugin_filter filter, struct nk_text_edit *edit, const struct nk_style_edit *style, struct nk_input *in, const struct nk_user_font *font);
5978 NK_LIB int nk_do_color_picker(nk_flags *state, struct nk_command_buffer *out, struct nk_colorf *col, enum nk_color_format fmt, struct nk_rect bounds, struct nk_vec2 padding, const struct nk_input *in, const struct nk_user_font *font);
6013 NK_LIB void nk_draw_property(struct nk_command_buffer *out, const struct nk_style_property *style, const struct nk_rect *bounds, const struct nk_rect *label, nk_flags state, const char *name, int len, const struct nk_user_font *font);
6014 NK_LIB void nk_do_property(nk_flags *ws, struct nk_command_buffer *out, struct nk_rect property, const char *name, struct nk_property_variant *variant, float inc_per_pixel, char *buffer, int *len, int *state, int *cursor, int *select_begin, int *select_end, const struct nk_style_property *style, enum nk_property_filter filter, struct nk_input *in, const struct nk_user_font *font, struct nk_text_edit *text_edit, enum nk_button_behavior behavior);
7330 nk_text_clamp(const struct nk_user_font *font, const char *text,
7351 s = font->width(font->userdata, font->height, text, len);
7378 nk_text_calculate_text_bounds(const struct nk_user_font *font,
7390 if (!begin || byte_len <= 0 || !font)
7395 glyph_width = font->width(font->userdata, font->height, begin, glyph_len);
7423 glyph_width = font->width(font->userdata, font->height, begin+text_len, glyph_len);
9170 const char *string, int length, const struct nk_user_font *font,
9177 NK_ASSERT(font);
9186 text_width = font->width(font->userdata, font->height, string, length);
9190 length = nk_text_clamp(font, string, length, r.w, &glyphs, &txt_width, 0,0);
9203 cmd->font = font;
9205 cmd->height = font->height;
10339 nk_draw_list_add_text(struct nk_draw_list *list, const struct nk_user_font *font,
10356 nk_draw_list_push_image(list, font->texture);
10370 font->query(font->userdata, font_height, &g, unicode,
10511 nk_draw_list_add_text(&ctx->draw_list, t->font, nk_rect(t->x, t->y, t->w, t->h),
10975 int fontstart;/* offset of start of font */
11581 nk_tt_GetGlyphBitmapBoxSubpixel(const struct nk_tt_fontinfo *font,
11586 if (!nk_tt_GetGlyphBox(font, glyph, &x0,&y0,&x1,&y1)) {
11601 nk_tt_GetGlyphBitmapBox(const struct nk_tt_fontinfo *font, int glyph,
11604 nk_tt_GetGlyphBitmapBoxSubpixel(font, glyph, scale_x, scale_y,0.0f,0.0f, ix0, iy0, ix1, iy1);
12754 /* setup font baker from temporary memory */
12787 /* first font pass: pack all glyphs */
12797 /* count glyphs + ranges in current font */
12861 /* second font pass: render glyphs */
12876 /* third pass: setup font and glyphs */
12885 struct nk_baked_font *dst_font = cfg->font;
12892 /* fill baked font */
12904 /* fill own baked font glyph array */
13015 struct nk_font *font = (struct nk_font*)handle.ptr;
13016 NK_ASSERT(font);
13017 NK_ASSERT(font->glyphs);
13018 if (!font || !text || !len)
13021 scale = height/font->info.height;
13029 g = nk_font_find_glyph(font, unicode);
13045 struct nk_font *font;
13050 font = (struct nk_font*)handle.ptr;
13051 NK_ASSERT(font);
13052 NK_ASSERT(font->glyphs);
13053 if (!font || !glyph)
13056 scale = height/font->info.height;
13057 g = nk_font_find_glyph(font, codepoint);
13067 nk_font_find_glyph(struct nk_font *font, nk_rune unicode)
13075 NK_ASSERT(font);
13076 NK_ASSERT(font->glyphs);
13077 NK_ASSERT(font->info.ranges);
13078 if (!font || !font->glyphs) return 0;
13080 glyph = font->fallback;
13081 iter = font->config;
13088 return &font->glyphs[((nk_rune)total_glyphs + (unicode - f))];
13091 } while ((iter = iter->n) != font->config);
13095 nk_font_init(struct nk_font *font, float pixel_height,
13100 NK_ASSERT(font);
13103 if (!font || !glyphs || !baked_font)
13107 font->fallback = 0;
13108 font->info = baked;
13109 font->scale = (float)pixel_height / (float)font->info.height;
13110 font->glyphs = &glyphs[baked_font->glyph_offset];
13111 font->texture = atlas;
13112 font->fallback_codepoint = fallback_codepoint;
13113 font->fallback = nk_font_find_glyph(font, fallback_codepoint);
13115 font->handle.height = font->info.height * font->scale;
13116 font->handle.width = nk_font_text_width;
13117 font->handle.userdata.ptr = font;
13119 font->handle.query = nk_font_query_font_glyph;
13120 font->handle.texture = font->texture;
13436 cfg.font = 0;
13497 struct nk_font *font = 0;
13516 /* allocate font config */
13524 /* insert font config into list */
13534 /* allocate new font */
13535 font = (struct nk_font*)
13537 NK_ASSERT(font);
13538 nk_zero(font, sizeof(*font));
13539 if (!font) return 0;
13540 font->config = cfg;
13542 /* insert font into list */
13544 atlas->fonts = font;
13545 font->next = 0;
13549 i->next = font;
13550 font->next = 0;
13552 cfg->font = &font->info;
13554 /* extend previously added font */
13560 cfg->font = &f->info;
13567 /* create own copy of .TTF font blob */
13579 return font;
13673 struct nk_font *font;
13691 font = nk_font_atlas_add_compressed(atlas, compressed_data,
13694 return font;
13735 /* no font added so just use default font */
13763 /* allocate memory for the baked image font atlas */
13788 /* initialize each font */
13790 struct nk_font *font = font_iter;
13791 struct nk_font_config *config = font->config;
13792 nk_font_init(font, config->size, config->fallback_glyph, atlas->glyphs,
13793 config->font, nk_handle_ptr(0));
14817 nk_style_set_font(struct nk_context *ctx, const struct nk_user_font *font)
14824 style->font = font;
14830 nk_style_push_font(struct nk_context *ctx, const struct nk_user_font *font)
14844 element->address = &ctx->style.font;
14845 element->old_value = ctx->style.font;
14846 ctx->style.font = font;
14967 nk_setup(struct nk_context *ctx, const struct nk_user_font *font)
14974 if (font) ctx->style.font = font;
14981 nk_init_default(struct nk_context *ctx, const struct nk_user_font *font)
14987 return nk_init(ctx, &alloc, font);
14992 const struct nk_user_font *font)
14996 nk_setup(ctx, font);
15003 struct nk_buffer *pool, const struct nk_user_font *font)
15009 nk_setup(ctx, font);
15024 const struct nk_user_font *font)
15028 nk_setup(ctx, font);
15614 const struct nk_user_font *font;
15631 font = style->font;
15655 header.h = font->height + 2.0f * style->window.header.padding.y;
15716 header.h = font->height + 2.0f * style->window.header.padding.y;
15764 &style->window.header.close_button, in, style->font) && !(win->flags & NK_WINDOW_ROM))
15787 NK_BUTTON_DEFAULT, &style->window.header.minimize_button, in, style->font) && !(win->flags & NK_WINDOW_ROM))
15796 float t = font->width(font->userdata, font->height, title, text_len);
15802 label.h = font->height + 2 * style->window.header.label_padding.y;
15805 nk_widget_text(out, label,(const char*)title, text_len, &text, NK_TEXT_LEFT, font);}
15966 &ctx->style.scrollv, in, style->font);
15985 &ctx->style.scrollh, in, style->font);
16279 NK_ASSERT(ctx->style.font && ctx->style.font->width && "if this triggers you forgot to add a font");
16341 float h = ctx->style.font->height + 2.0f * style->window.header.padding.y +
16580 header.h = ctx->style.font->height + 2 * ctx->style.window.header.padding.y;
17148 text, len, alignment, NK_BUTTON_DEFAULT, &style->contextual_button, in, style->font)) {
17183 img, text, len, align, NK_BUTTON_DEFAULT, &style->contextual_button, style->font, in)){
17219 symbol, text, len, align, NK_BUTTON_DEFAULT, &style->contextual_button, style->font, in)) {
17409 title, len, align, NK_BUTTON_DEFAULT, &ctx->style.menu_button, in, ctx->style.font))
17464 sym, NK_BUTTON_DEFAULT, &ctx->style.menu_button, in, ctx->style.font))
17490 ctx->style.font, in))
17523 ctx->style.font, in)) is_clicked = nk_true;
17613 layout->row.min_height = ctx->style.font->height;
18384 row_height = style->font->height + 2 * style->tab.padding.y;
18423 sym.w = sym.h = style->font->height;
18427 button, 0, style->font);
18433 sym.w = style->font->height + style->tab.spacing.x;}
18442 label.h = style->font->height;
18446 NK_TEXT_LEFT, style->font);}
18570 row_height = style->font->height + 2 * style->tab.padding.y;
18605 sym.w = sym.h = style->font->height;
18608 if (nk_do_button_symbol(&ws, &win->buffer, sym, symbol, NK_BUTTON_DEFAULT, button, in, style->font))
18616 text_width = style->font->width(style->font->userdata, style->font->height, title, text_len);
18623 label.h = style->font->height;
18627 selected, img, &style->selectable, in, style->font);
18629 selected, &style->selectable, in, style->font);
19367 nk_widget_text(&win->buffer, bounds, str, len, &text, alignment, style->font);
19394 nk_widget_text_wrap(&win->buffer, bounds, str, len, &text, style->font);
19695 float border_width, const struct nk_user_font *font)
19710 nk_widget_text(out, content, X, 1, &text, NK_TEXT_CENTERED, font);
19821 nk_flags text_alignment, const struct nk_user_font *font)
19838 nk_widget_text(out, *content, txt, len, &text, text_alignment, font);
19845 const struct nk_user_font *font)
19854 NK_ASSERT(font);
19855 if (!out || !style || !font || !string)
19860 nk_draw_button_text(out, &bounds, &content, *state, style, string, len, align, font);
19868 enum nk_symbol_type type, const struct nk_user_font *font)
19884 nk_draw_symbol(out, type, *content, bg, sym, 1, font);
19891 const struct nk_user_font *font)
19898 NK_ASSERT(font);
19900 if (!out || !style || !font || !state)
19905 nk_draw_button_symbol(out, &bounds, &content, *state, style, symbol, font);
19948 const struct nk_user_font *font)
19973 nk_draw_symbol(out, type, *symbol, style->text_background, sym, 0, font);
19974 nk_widget_text(out, *label, str, len, &text, NK_TEXT_CENTERED, font);
19981 const struct nk_user_font *font, const struct nk_input *in)
19989 NK_ASSERT(font);
19990 if (!out || !style || !font)
19994 tri.y = content.y + (content.h/2) - font->height/2;
19995 tri.w = font->height; tri.h = font->height;
20004 *state, style, str, len, symbol, font);
20012 const char *str, int len, const struct nk_user_font *font,
20030 nk_widget_text(out, *label, str, len, &text, NK_TEXT_CENTERED, font);
20038 const struct nk_user_font *font, const struct nk_input *in)
20046 NK_ASSERT(font);
20048 if (!out || !font || !style || !str)
20065 nk_draw_button_text_image(out, &bounds, &content, &icon, *state, style, str, len, font, &img);
20139 style, in, ctx->style.font);
20215 symbol, ctx->button_behavior, style, in, ctx->style.font);
20283 style, ctx->style.font, in);
20330 style, ctx->style.font, in);
20379 const struct nk_user_font *font)
20414 nk_widget_text(out, *label, string, len, &text, NK_TEXT_LEFT, font);
20421 const struct nk_user_font *font)
20456 nk_widget_text(out, *label, string, len, &text, NK_TEXT_LEFT, font);
20463 const struct nk_user_font *font)
20473 NK_ASSERT(font);
20474 if (!out || !style || !font || !active)
20477 r.w = NK_MAX(r.w, font->height + 2 * style->padding.x);
20478 r.h = NK_MAX(r.h, font->height + 2 * style->padding.y);
20487 select.w = font->height;
20512 nk_draw_checkbox(out, *state, style, *active, &label, &select, &cursor, str, len, font);
20514 nk_draw_option(out, *state, style, *active, &label, &select, &cursor, str, len, font);
20550 text, len, NK_TOGGLE_CHECK, &style->checkbox, in, style->font);
20645 text, len, NK_TOGGLE_OPTION, &style->option, in, style->font);
20685 const char *string, int len, nk_flags align, const struct nk_user_font *font)
20725 else nk_draw_symbol(out, sym, *icon, text.background, text.text, 1, font);
20727 nk_widget_text(out, *bounds, string, len, &text, align, font);
20733 const struct nk_user_font *font)
20744 NK_ASSERT(font);
20746 if (!state || !out || !str || !len || !value || !style || !font) return 0;
20761 nk_draw_selectable(out, *state, style, *value, &bounds, 0,0,NK_SYMBOL_NONE, str, len, align, font);
20769 const struct nk_input *in, const struct nk_user_font *font)
20781 NK_ASSERT(font);
20783 if (!state || !out || !str || !len || !value || !style || !font) return 0;
20808 nk_draw_selectable(out, *state, style, *value, &bounds, &icon, img, NK_SYMBOL_NONE, str, len, align, font);
20816 const struct nk_input *in, const struct nk_user_font *font)
20828 NK_ASSERT(font);
20830 if (!state || !out || !str || !len || !value || !style || !font) return 0;
20855 nk_draw_selectable(out, *state, style, *value, &bounds, &icon, 0, sym, str, len, align, font);
20887 str, len, align, value, &style->selectable, in, style->font);
20916 str, len, align, value, &img, &style->selectable, in, style->font);
20945 str, len, align, value, sym, &style->selectable, in, style->font);
21109 const struct nk_user_font *font)
21145 &style->dec_button, in, font))
21151 &style->inc_button, in, font))
21224 old_value, max_value, value_step, &style->slider, in, style->font);
21516 const struct nk_user_font *font)
21552 NK_BUTTON_REPEATER, &style->dec_button, in, font))
21558 NK_BUTTON_REPEATER, &style->inc_button, in, font))
21605 const struct nk_user_font *font)
21640 NK_BUTTON_REPEATER, &style->dec_button, in, font))
21646 NK_BUTTON_REPEATER, &style->inc_button, in, font))
21724 const struct nk_user_font *font)
21729 return font->width(font->userdata, font->height, str, len);
21733 int line_start_id, float row_height, const struct nk_user_font *font)
21742 const struct nk_vec2 size = nk_text_calculate_text_bounds(font,
21754 const struct nk_user_font *font, float row_height)
21767 nk_textedit_layout_row(&r, edit, i, row_height, font);
21795 float w = nk_textedit_get_width(edit, k, i, font);
21814 const struct nk_user_font *font, float row_height)
21818 state->cursor = nk_textedit_locate_coord(state, x, y, font, row_height);
21825 const struct nk_user_font *font, float row_height)
21829 int p = nk_textedit_locate_coord(state, x, y, font, row_height);
21836 int n, int single_line, const struct nk_user_font *font, float row_height)
21849 nk_textedit_layout_row(&r, state, 0, row_height, font);
21857 nk_textedit_layout_row(&r, state, i, row_height, font);
21874 nk_textedit_layout_row(&r, state, i, row_height, font);
21889 find->x += nk_textedit_get_width(state, first, i, font);
22097 const struct nk_user_font *font, float row_height)
22229 font, row_height);
22239 nk_textedit_layout_row(&row, state, state->cursor, row_height, font);
22243 float dx = nk_textedit_get_width(state, start, i, font);
22277 font, row_height);
22286 nk_textedit_layout_row(&row, state, state->cursor, row_height, font);
22290 float dx = nk_textedit_get_width(state, find.prev_first, i, font);
22363 font, row_height);
22373 font, row_height);
22385 font, row_height);
22396 font, row_height);
22794 const struct nk_user_font *font, struct nk_color background,
22798 NK_ASSERT(font);
22833 &txt, NK_TEXT_CENTERED, font);
22848 glyph_width = font->width(font->userdata, font->height, text+text_len, glyph_len);
22867 &txt, NK_TEXT_LEFT, font);
22874 struct nk_input *in, const struct nk_user_font *font)
22899 row_height = (flags & NK_EDIT_MULTILINE)? font->height + style->row_padding: area.h;
22947 nk_textedit_click(edit, mouse_x, mouse_y, font, row_height);
22950 nk_textedit_drag(edit, mouse_x, mouse_y, font, row_height);
22954 nk_textedit_key(edit, NK_KEY_TEXT_WORD_LEFT, nk_false, font, row_height);
22955 nk_textedit_key(edit, NK_KEY_TEXT_WORD_RIGHT, nk_true, font, row_height);
22964 nk_textedit_key(edit, (enum nk_keys)i, shift_mod, font, row_height);
23085 glyph_width = font->width(font->userdata, font->height, text, glyph_len);
23101 row_size = nk_text_calculate_text_bounds(font, text+row_begin,
23119 row_size = nk_text_calculate_text_bounds(font, text+row_begin,
23137 row_size = nk_text_calculate_text_bounds(font, text+row_begin,
23151 glyph_width = font->width(font->userdata, font->height, text+text_len, glyph_len);
23160 glyph_width = font->width(font->userdata, font->height,
23215 &style->scrollbar, in, font);
23262 area.y - edit->scrollbar.y, 0, begin, l, row_height, font,
23272 row_height, font, background_color, text_color, nk_false);
23286 row_height, font, sel_background_color, sel_text_color, nk_true);
23300 begin, (int)(end - begin), row_height, font,
23313 cursor.h = font->height;
23330 label.w = font->width(font->userdata, font->height, cursor_ptr, glyph_len);
23337 nk_widget_text(out, label, cursor_ptr, glyph_len, &txt, NK_TEXT_LEFT, font);
23363 area.y - edit->scrollbar.y, 0, begin, l, row_height, font,
23502 filter, edit, &style->edit, in, style->font);
23596 const char *name, int len, const struct nk_user_font *font)
23625 nk_widget_text(out, *label, name, len, &text, NK_TEXT_CENTERED, font);
23635 const struct nk_user_font *font, struct nk_text_edit *text_edit,
23657 left.h = font->height/2;
23664 size = font->width(font->userdata, font->height, name, name_len);
23678 size = font->width(font->userdata, font->height, buffer, *len);
23698 size = font->width(font->userdata, font->height, string, num_len);
23721 nk_draw_property(out, style, &property, &label, *ws, name, name_len, font);
23725 if (nk_do_button_symbol(ws, out, left, style->sym_left, behavior, &style->dec_button, in, font)) {
23737 if (nk_do_button_symbol(ws, out, right, style->sym_right, behavior, &style->inc_button, in, font)) {
23771 filters[filter], text_edit, &style->edit, (*state == NK_PROPERTY_EDIT) ? in: 0, font);
23907 select_end, &style->property, filter, in, style->font, &ctx->text_edit,
24466 const struct nk_user_font *font)
24477 NK_ASSERT(font);
24478 if (!out || !col || !state || !font)
24481 bar_w = font->height;
24533 nk_vec2(0,0), in, config->font);
24667 NK_TEXT_LEFT, ctx->style.font);
24671 &ctx->style.combo.button, sym, style->font);
24753 &ctx->style.combo.button, sym, style->font);
24836 1.0f, style->font);
24840 &ctx->style.combo.button, sym, style->font);
24920 &ctx->style.combo.button, sym, style->font);
24928 1.0f, style->font);
24936 nk_widget_text(&win->buffer, label, selected, len, &text, NK_TEXT_LEFT, style->font);
25013 &ctx->style.combo.button, sym, style->font);
25089 &ctx->style.combo.button, sym, style->font);
25104 nk_widget_text(&win->buffer, label, selected, len, &text, NK_TEXT_LEFT, style->font);
25388 text_width = style->font->width(style->font->userdata,
25389 style->font->height, text, text_len);
25391 text_height = (style->font->height + 2 * padding.y);
25491 /// - 2018/01/31 (3.00.5) - Fixed overcalculation of cursor data in font baking process.
25507 /// - 2017/11/15 (2.00.4) - Fixed font merging.
25531 /// row height derived from font height. If you need a row smaller than
25685 /// - 2016/08/14 (1.09.2) - Fixed a bug in font atlas which caused wrong loading
25686 /// of glyphes for font with multiple ranges.
25747 /// - 2016/07/15 (1.01.0) - Removed internal font baking API and simplified
25748 /// font atlas memory management by converting pointer
25749 /// arrays for fonts and font configurations to lists.
25769 /// Embeds ProggyClean.ttf font by Tristan Grimmer (MIT license). <br />