|
Blender
V2.93
|
#include <math.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ft2build.h>#include "MEM_guardedalloc.h"#include "DNA_vec_types.h"#include "BLI_listbase.h"#include "BLI_math.h"#include "BLI_math_color_blend.h"#include "BLI_rect.h"#include "BLI_string.h"#include "BLI_string_utf8.h"#include "BLI_threads.h"#include "BLF_api.h"#include "UI_interface.h"#include "GPU_batch.h"#include "GPU_matrix.h"#include "blf_internal.h"#include "blf_internal_types.h"#include "BLI_strict_flags.h"Go to the source code of this file.
Macros | |
| #define | BLF_UTF8_NEXT_FAST(_font, _gc, _g, _str, _i, _c, _glyph_ascii_table) |
| #define | BLF_KERNING_VARS(_font, _has_kerning, _kern_mode) |
| #define | BLF_KERNING_STEP_FAST(_font, _kern_mode, _g_prev, _g, _c_prev, _c, _pen_x) |
| #define | BLF_KERNING_STEP(_font, _kern_mode, _g_prev, _g, _delta, _pen_x) |
Functions | |
| int | blf_font_init (void) |
| void | blf_font_exit (void) |
| void | blf_font_size (FontBLF *font, unsigned int size, unsigned int dpi) |
| static GlyphBLF ** | blf_font_ensure_ascii_table (FontBLF *font, GlyphCacheBLF *gc) |
| static void | blf_font_ensure_ascii_kerning (FontBLF *font, GlyphCacheBLF *gc, const FT_UInt kern_mode) |
| static void | blf_font_draw_ex (FontBLF *font, GlyphCacheBLF *gc, const char *str, size_t len, struct ResultBLF *r_info, int pen_y) |
| void | blf_font_draw (FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info) |
| static void | blf_font_draw_ascii_ex (FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info, int pen_y) |
| void | blf_font_draw_ascii (FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info) |
| int | blf_font_draw_mono (FontBLF *font, const char *str, size_t len, int cwidth) |
| static void | blf_font_draw_buffer_ex (FontBLF *font, GlyphCacheBLF *gc, const char *str, size_t len, struct ResultBLF *r_info, int pen_y) |
| void | blf_font_draw_buffer (FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info) |
| static bool | blf_font_width_to_strlen_glyph_process (FontBLF *font, const bool has_kerning, const FT_UInt kern_mode, const uint c_prev, const uint c, GlyphBLF *g_prev, GlyphBLF *g, int *pen_x, const int width_i) |
| size_t | blf_font_width_to_strlen (FontBLF *font, const char *str, size_t len, float width, float *r_width) |
| size_t | blf_font_width_to_rstrlen (FontBLF *font, const char *str, size_t len, float width, float *r_width) |
| static void | blf_font_boundbox_ex (FontBLF *font, GlyphCacheBLF *gc, const char *str, size_t len, rctf *box, struct ResultBLF *r_info, int pen_y) |
| void | blf_font_boundbox (FontBLF *font, const char *str, size_t len, rctf *r_box, struct ResultBLF *r_info) |
| void | blf_font_width_and_height (FontBLF *font, const char *str, size_t len, float *r_width, float *r_height, struct ResultBLF *r_info) |
| float | blf_font_width (FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info) |
| float | blf_font_height (FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info) |
| float | blf_font_fixed_width (FontBLF *font) |
| int | blf_font_count_missing_chars (FontBLF *font, const char *str, const size_t len, int *r_tot_chars) |
| void | blf_font_free (FontBLF *font) |
| static void | blf_font_fill (FontBLF *font) |
| FontBLF * | blf_font_new (const char *name, const char *filename) |
| void | blf_font_attach_from_mem (FontBLF *font, const unsigned char *mem, int mem_size) |
| FontBLF * | blf_font_new_from_mem (const char *name, const unsigned char *mem, int mem_size) |
| int | blf_font_height_max (FontBLF *font) |
| int | blf_font_width_max (FontBLF *font) |
| float | blf_font_descender (FontBLF *font) |
| float | blf_font_ascender (FontBLF *font) |
Glyph Batching | |
| static void | blf_batch_draw_init (void) |
| static void | blf_batch_draw_exit (void) |
| void | blf_batch_draw_begin (FontBLF *font) |
| static GPUTexture * | blf_batch_cache_texture_load (void) |
| void | blf_batch_draw (void) |
| static void | blf_batch_draw_end (void) |
Word-Wrap Support | |
| static void | blf_font_wrap_apply (FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info, void(*callback)(FontBLF *font, GlyphCacheBLF *gc, const char *str, size_t len, int pen_y, void *userdata), void *userdata) |
| static void | blf_font_draw__wrap_cb (FontBLF *font, GlyphCacheBLF *gc, const char *str, size_t len, int pen_y, void *UNUSED(userdata)) |
| void | blf_font_draw__wrap (FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info) |
| static void | blf_font_boundbox_wrap_cb (FontBLF *font, GlyphCacheBLF *gc, const char *str, size_t len, int pen_y, void *userdata) |
| void | blf_font_boundbox__wrap (FontBLF *font, const char *str, size_t len, rctf *box, struct ResultBLF *r_info) |
| static void | blf_font_draw_buffer__wrap_cb (FontBLF *font, GlyphCacheBLF *gc, const char *str, size_t len, int pen_y, void *UNUSED(userdata)) |
| void | blf_font_draw_buffer__wrap (FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info) |
Glyph Bound Box with Callback | |
| static void | blf_font_boundbox_foreach_glyph_ex (FontBLF *font, GlyphCacheBLF *gc, const char *str, size_t len, BLF_GlyphBoundsFn user_fn, void *user_data, struct ResultBLF *r_info, int pen_y) |
| void | blf_font_boundbox_foreach_glyph (FontBLF *font, const char *str, size_t len, BLF_GlyphBoundsFn user_fn, void *user_data, struct ResultBLF *r_info) |
Variables | |
| BatchBLF | g_batch |
| static FT_Library | ft_lib |
| static SpinLock | ft_lib_mutex |
| static SpinLock | blf_glyph_cache_mutex |
Deals with drawing text to OpenGL or bitmap buffers.
Also low level functions for managing FontBLF.
Definition in file blf_font.c.
| #define BLF_KERNING_STEP | ( | _font, | |
| _kern_mode, | |||
| _g_prev, | |||
| _g, | |||
| _delta, | |||
| _pen_x | |||
| ) |
Definition at line 397 of file blf_font.c.
| #define BLF_KERNING_STEP_FAST | ( | _font, | |
| _kern_mode, | |||
| _g_prev, | |||
| _g, | |||
| _c_prev, | |||
| _c, | |||
| _pen_x | |||
| ) |
Definition at line 382 of file blf_font.c.
| #define BLF_KERNING_VARS | ( | _font, | |
| _has_kerning, | |||
| _kern_mode | |||
| ) |
Definition at line 372 of file blf_font.c.
| #define BLF_UTF8_NEXT_FAST | ( | _font, | |
| _gc, | |||
| _g, | |||
| _str, | |||
| _i, | |||
| _c, | |||
| _glyph_ascii_table | |||
| ) |
Definition at line 357 of file blf_font.c.
|
static |
Definition at line 177 of file blf_font.c.
References GlyphCacheBLF::bitmap_len, GlyphCacheBLF::bitmap_len_landed, GlyphCacheBLF::bitmap_result, BLI_assert, g_batch, BatchBLF::glyph_cache, GPU_DATA_UBYTE, GPU_texture_update_sub(), GPU_texture_width(), GlyphCacheBLF::texture, and width.
Referenced by blf_batch_draw().
| void blf_batch_draw | ( | void | ) |
Definition at line 217 of file blf_font.c.
References BatchBLF::batch, blf_batch_cache_texture_load(), BatchBLF::col_loc, g_batch, BatchBLF::glyph_len, BatchBLF::glyph_size_loc, BatchBLF::glyph_size_step, GPU_batch_draw(), GPU_batch_program_set_builtin(), GPU_batch_texture_bind, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_SHADER_TEXT, GPU_texture_unbind(), GPU_vertbuf_attr_get_raw_data(), GPU_vertbuf_data_len_set(), GPU_vertbuf_use(), BatchBLF::offset_loc, BatchBLF::pos_loc, UI_widgetbase_draw_cache_flush(), and BatchBLF::verts.
Referenced by blf_batch_draw_begin(), BLF_batch_draw_end(), blf_batch_draw_end(), BLF_batch_draw_flush(), blf_glyph_render(), and blf_texture_draw().
| void blf_batch_draw_begin | ( | FontBLF * | font | ) |
Definition at line 117 of file blf_font.c.
References BatchBLF::active, BatchBLF::batch, BLF_ASPECT, blf_batch_draw(), blf_batch_draw_init(), BLF_MATRIX, BLF_ROTATION, BatchBLF::enabled, FontBLF::flags, floorf, BatchBLF::font, g_batch, GPU_matrix_model_view_get, GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_set, BatchBLF::mat, NULL, BatchBLF::ofs, FontBLF::pos, BatchBLF::simple_shader, and zero_v2().
Referenced by blf_font_draw_ascii_ex(), blf_font_draw_ex(), and blf_font_draw_mono().
|
static |
Definition at line 250 of file blf_font.c.
References BatchBLF::active, blf_batch_draw(), and g_batch.
Referenced by blf_font_draw_ascii_ex(), blf_font_draw_ex(), and blf_font_draw_mono().
|
static |
Definition at line 112 of file blf_font.c.
References BatchBLF::batch, g_batch, and GPU_BATCH_DISCARD_SAFE.
Referenced by blf_font_exit().
|
static |
Draw-calls are precious! make them count! Since most of the Text elements are not covered by other UI elements, we can group some strings together and render them in one draw-call. This behavior is on demand only, between BLF_batch_draw_begin() and BLF_batch_draw_end().
Definition at line 84 of file blf_font.c.
References BatchBLF::batch, BLF_BATCH_DRAW_LEN_MAX, BatchBLF::col_loc, g_batch, BatchBLF::glyph_len, BatchBLF::glyph_size_loc, BatchBLF::glyph_size_step, GPU_batch_create_ex(), GPU_batch_instbuf_set(), GPU_BATCH_OWNS_VBO, GPU_COMP_F32, GPU_COMP_I32, GPU_COMP_U8, GPU_FETCH_FLOAT, GPU_FETCH_INT, GPU_FETCH_INT_TO_FLOAT_UNIT, GPU_PRIM_TRI_STRIP, GPU_USAGE_STREAM, GPU_vertbuf_attr_get_raw_data(), GPU_vertbuf_create_with_format, GPU_vertbuf_create_with_format_ex(), GPU_vertbuf_data_alloc(), GPU_vertformat_attr_add(), NULL, BatchBLF::offset_loc, BatchBLF::pos_loc, and BatchBLF::verts.
Referenced by blf_batch_draw_begin().
Definition at line 1459 of file blf_font.c.
References GlyphCacheBLF::ascender, blf_font_ensure_ascii_table(), blf_glyph_cache_acquire(), and blf_glyph_cache_release().
Referenced by BLF_ascender().
| void blf_font_attach_from_mem | ( | FontBLF * | font, |
| const unsigned char * | mem, | ||
| int | mem_size | ||
| ) |
Definition at line 1387 of file blf_font.c.
References FontBLF::face.
Referenced by BLF_metrics_attach().
| void blf_font_boundbox | ( | FontBLF * | font, |
| const char * | str, | ||
| size_t | len, | ||
| rctf * | r_box, | ||
| struct ResultBLF * | r_info | ||
| ) |
Definition at line 900 of file blf_font.c.
References blf_font_boundbox_ex(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), len, and str.
Referenced by BLF_boundbox_ex(), blf_font_height(), blf_font_width(), and blf_font_width_and_height().
| void blf_font_boundbox__wrap | ( | FontBLF * | font, |
| const char * | str, | ||
| size_t | len, | ||
| rctf * | box, | ||
| struct ResultBLF * | r_info | ||
| ) |
Definition at line 1052 of file blf_font.c.
References blf_font_boundbox_wrap_cb(), blf_font_wrap_apply(), len, str, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by BLF_boundbox_ex(), blf_font_height(), blf_font_width(), and blf_font_width_and_height().
|
static |
Definition at line 825 of file blf_font.c.
References GlyphBLF::advance, GlyphBLF::advance_i, blf_font_ensure_ascii_kerning(), blf_font_ensure_ascii_table(), BLF_KERNING_STEP_FAST, BLF_KERNING_VARS, BLF_UTF8_NEXT_FAST, BLI_UTF8_ERR, GlyphBLF::box, Freestyle::c, float(), len, ResultBLF::lines, NULL, str, UNLIKELY, ResultBLF::width, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by blf_font_boundbox(), and blf_font_boundbox_wrap_cb().
| void blf_font_boundbox_foreach_glyph | ( | FontBLF * | font, |
| const char * | str, | ||
| size_t | len, | ||
| BLF_GlyphBoundsFn | user_fn, | ||
| void * | user_data, | ||
| struct ResultBLF * | r_info | ||
| ) |
Definition at line 1240 of file blf_font.c.
References blf_font_boundbox_foreach_glyph_ex(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), len, str, and user_data.
Referenced by BLF_boundbox_foreach_glyph_ex().
|
static |
Definition at line 1180 of file blf_font.c.
References GlyphBLF::advance_i, blf_font_ensure_ascii_kerning(), blf_font_ensure_ascii_table(), BLF_KERNING_STEP_FAST, BLF_KERNING_VARS, BLF_UTF8_NEXT_FAST, BLI_UTF8_ERR, GlyphBLF::box, Freestyle::c, GlyphBLF::dims, len, ResultBLF::lines, MIN2, NULL, GlyphBLF::pos, str, UNLIKELY, user_data, ResultBLF::width, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by blf_font_boundbox_foreach_glyph().
|
static |
Definition at line 1043 of file blf_font.c.
References blf_font_boundbox_ex(), BLI_rctf_union(), len, NULL, and str.
Referenced by blf_font_boundbox__wrap().
| int blf_font_count_missing_chars | ( | FontBLF * | font, |
| const char * | str, | ||
| const size_t | len, | ||
| int * | r_tot_chars | ||
| ) |
Definition at line 1254 of file blf_font.c.
References BLI_str_utf8_as_unicode_step(), BLI_UTF8_ERR, Freestyle::c, len, and str.
Referenced by BLF_thumb_preview().
Definition at line 1447 of file blf_font.c.
References blf_font_ensure_ascii_table(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), and GlyphCacheBLF::descender.
Referenced by BLF_descender().
Definition at line 461 of file blf_font.c.
References blf_font_draw_ex(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), len, and str.
Referenced by BLF_draw_ex().
| void blf_font_draw__wrap | ( | FontBLF * | font, |
| const char * | str, | ||
| size_t | len, | ||
| struct ResultBLF * | r_info | ||
| ) |
Definition at line 1037 of file blf_font.c.
References blf_font_draw__wrap_cb(), blf_font_wrap_apply(), len, NULL, and str.
Referenced by BLF_draw_ascii_ex(), and BLF_draw_ex().
|
static |
Definition at line 1028 of file blf_font.c.
References blf_font_draw_ex(), len, NULL, and str.
Referenced by blf_font_draw__wrap().
| void blf_font_draw_ascii | ( | FontBLF * | font, |
| const char * | str, | ||
| size_t | len, | ||
| struct ResultBLF * | r_info | ||
| ) |
Definition at line 512 of file blf_font.c.
References blf_font_draw_ascii_ex(), len, and str.
Referenced by BLF_draw_ascii_ex().
|
static |
Definition at line 469 of file blf_font.c.
References GlyphBLF::advance_i, blf_batch_draw_begin(), blf_batch_draw_end(), blf_font_ensure_ascii_kerning(), blf_font_ensure_ascii_table(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), blf_glyph_render(), BLF_KERNING_STEP_FAST, BLF_KERNING_VARS, BLI_assert, BLI_UTF8_ERR, Freestyle::c, len, ResultBLF::lines, NULL, str, and ResultBLF::width.
Referenced by blf_font_draw_ascii().
| void blf_font_draw_buffer | ( | FontBLF * | font, |
| const char * | str, | ||
| size_t | len, | ||
| struct ResultBLF * | r_info | ||
| ) |
Definition at line 705 of file blf_font.c.
References blf_font_draw_buffer_ex(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), len, and str.
Referenced by BLF_draw_buffer_ex(), and BLF_thumb_preview().
| void blf_font_draw_buffer__wrap | ( | FontBLF * | font, |
| const char * | str, | ||
| size_t | len, | ||
| struct ResultBLF * | r_info | ||
| ) |
Definition at line 1073 of file blf_font.c.
References blf_font_draw_buffer__wrap_cb(), blf_font_wrap_apply(), len, NULL, and str.
Referenced by BLF_draw_buffer_ex().
|
static |
Definition at line 1064 of file blf_font.c.
References blf_font_draw_buffer_ex(), len, NULL, and str.
Referenced by blf_font_draw_buffer__wrap().
|
static |
Definition at line 560 of file blf_font.c.
References Freestyle::a, GlyphBLF::advance_i, GlyphBLF::bitmap, blend_color_mix_byte(), blend_color_mix_float(), blf_font_ensure_ascii_kerning(), blf_font_ensure_ascii_table(), BLF_KERNING_STEP_FAST, BLF_KERNING_VARS, BLF_UTF8_NEXT_FAST, BLI_UTF8_ERR, FontBLF::buf_info, Freestyle::c, FontBufInfoBLF::cbuf, FontBufInfoBLF::ch, FontBufInfoBLF::col_char, FontBufInfoBLF::col_float, GlyphBLF::dims, FontBufInfoBLF::dims, FontBufInfoBLF::fbuf, len, ResultBLF::lines, NULL, GlyphBLF::pitch, GlyphBLF::pos, FontBLF::pos, str, unit_float_to_uchar_clamp(), UNLIKELY, ResultBLF::width, x, and y.
Referenced by blf_font_draw_buffer(), and blf_font_draw_buffer__wrap_cb().
|
static |
Definition at line 408 of file blf_font.c.
References GlyphBLF::advance_i, blf_batch_draw_begin(), blf_batch_draw_end(), blf_font_ensure_ascii_kerning(), blf_font_ensure_ascii_table(), blf_glyph_render(), BLF_KERNING_STEP_FAST, BLF_KERNING_VARS, BLF_UTF8_NEXT_FAST, BLI_UTF8_ERR, Freestyle::c, len, ResultBLF::lines, NULL, str, UNLIKELY, and ResultBLF::width.
Referenced by blf_font_draw(), and blf_font_draw__wrap_cb().
| int blf_font_draw_mono | ( | FontBLF * | font, |
| const char * | str, | ||
| size_t | len, | ||
| int | cwidth | ||
| ) |
Definition at line 518 of file blf_font.c.
References blf_batch_draw_begin(), blf_batch_draw_end(), blf_font_ensure_ascii_table(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), blf_glyph_render(), BLF_UTF8_NEXT_FAST, BLI_UTF8_ERR, BLI_wcwidth(), Freestyle::c, col, len, NULL, str, and UNLIKELY.
Referenced by BLF_draw_mono().
|
static |
Definition at line 333 of file blf_font.c.
References blf_kerning_cache_find(), blf_kerning_cache_new(), FontBLF::kerning_cache, FontBLF::kerning_mode, and KerningCacheBLF::mode.
Referenced by blf_font_boundbox_ex(), blf_font_boundbox_foreach_glyph_ex(), blf_font_draw_ascii_ex(), blf_font_draw_buffer_ex(), blf_font_draw_ex(), blf_font_width_to_rstrlen(), and blf_font_width_to_strlen().
|
static |
Definition at line 311 of file blf_font.c.
References blf_glyph_add(), blf_glyph_search(), FontBLF::face, GlyphCacheBLF::glyph_ascii_table, and NULL.
Referenced by blf_font_ascender(), blf_font_boundbox_ex(), blf_font_boundbox_foreach_glyph_ex(), blf_font_descender(), blf_font_draw_ascii_ex(), blf_font_draw_buffer_ex(), blf_font_draw_ex(), blf_font_draw_mono(), blf_font_fixed_width(), blf_font_height_max(), blf_font_width_max(), blf_font_width_to_rstrlen(), blf_font_width_to_strlen(), and blf_font_wrap_apply().
| void blf_font_exit | ( | void | ) |
Definition at line 269 of file blf_font.c.
References blf_batch_draw_exit(), blf_glyph_cache_mutex, BLI_spin_end(), ft_lib, and ft_lib_mutex.
Referenced by BLF_exit().
|
static |
Definition at line 1302 of file blf_font.c.
References FontBLF::angle, FontBLF::aspect, blf_glyph_cache_mutex, BLI_listbase_clear(), FontBLF::buf_info, FontBLF::cache, FontBufInfoBLF::cbuf, FontBufInfoBLF::ch, FontBLF::clip_rec, FontBufInfoBLF::col_init, FontBLF::color, FontBufInfoBLF::dims, FontBLF::dpi, FontBufInfoBLF::fbuf, FontBLF::flags, ft_lib, FontBLF::ft_lib, ft_lib_mutex, FontBLF::ft_lib_mutex, FontBLF::glyph_cache_mutex, FontBLF::kerning_cache, FontBLF::kerning_caches, FontBLF::m, NULL, FontBLF::pos, FontBLF::size, FontBLF::tex_size_max, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.
Referenced by blf_font_new(), and blf_font_new_from_mem().
Definition at line 1154 of file blf_font.c.
References GlyphBLF::advance, blf_font_ensure_ascii_table(), blf_glyph_add(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), blf_glyph_search(), Freestyle::c, and FontBLF::face.
Referenced by BLF_fixed_width().
| void blf_font_free | ( | FontBLF * | font | ) |
Definition at line 1279 of file blf_font.c.
References blf_glyph_cache_free(), blf_glyph_cache_mutex, blf_kerning_cache_clear(), BLI_pophead(), BLI_spin_lock(), BLI_spin_unlock(), FontBLF::cache, FontBLF::face, FontBLF::filename, MEM_freeN, and FontBLF::name.
Referenced by BLF_exit(), BLF_thumb_preview(), BLF_unload(), and BLF_unload_id().
Definition at line 1133 of file blf_font.c.
References FontBLF::aspect, BLF_ASPECT, blf_font_boundbox(), blf_font_boundbox__wrap(), BLF_WORD_WRAP, BLI_rctf_size_y(), FontBLF::flags, len, and str.
Referenced by BLF_height_ex().
| int blf_font_height_max | ( | FontBLF * | font | ) |
Definition at line 1423 of file blf_font.c.
References blf_font_ensure_ascii_table(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), and GlyphCacheBLF::glyph_height_max.
Referenced by BLF_height_max().
| int blf_font_init | ( | void | ) |
Definition at line 261 of file blf_font.c.
References blf_glyph_cache_mutex, BLI_spin_init(), ft_lib, ft_lib_mutex, and g_batch.
Referenced by BLF_init().
| FontBLF* blf_font_new | ( | const char * | name, |
| const char * | filename | ||
| ) |
Definition at line 1351 of file blf_font.c.
References blf_dir_metrics_search(), blf_font_fill(), BLI_strdup(), err, FontBLF::face, FontBLF::filename, ft_lib, MEM_callocN, MEM_freeN, FontBLF::name, and NULL.
Referenced by BLF_load_unique(), and BLF_thumb_preview().
| FontBLF* blf_font_new_from_mem | ( | const char * | name, |
| const unsigned char * | mem, | ||
| int | mem_size | ||
| ) |
Definition at line 1397 of file blf_font.c.
References blf_font_fill(), BLI_strdup(), err, FontBLF::face, FontBLF::filename, ft_lib, MEM_callocN, MEM_freeN, FontBLF::name, and NULL.
Referenced by BLF_load_mem_unique().
| void blf_font_size | ( | FontBLF * | font, |
| unsigned int | size, | ||
| unsigned int | dpi | ||
| ) |
Definition at line 277 of file blf_font.c.
References blf_glyph_cache_acquire(), blf_glyph_cache_find(), blf_glyph_cache_new(), blf_glyph_cache_release(), FontBLF::dpi, err, FontBLF::face, size(), and FontBLF::size.
Referenced by BLF_size(), and BLF_thumb_preview().
Definition at line 1112 of file blf_font.c.
References FontBLF::aspect, BLF_ASPECT, blf_font_boundbox(), blf_font_boundbox__wrap(), BLF_WORD_WRAP, BLI_rctf_size_x(), FontBLF::flags, len, and str.
Referenced by BLF_width_ex().
| void blf_font_width_and_height | ( | FontBLF * | font, |
| const char * | str, | ||
| size_t | len, | ||
| float * | r_width, | ||
| float * | r_height, | ||
| struct ResultBLF * | r_info | ||
| ) |
Definition at line 1083 of file blf_font.c.
References FontBLF::aspect, BLF_ASPECT, blf_font_boundbox(), blf_font_boundbox__wrap(), BLF_WORD_WRAP, BLI_rctf_size_x(), BLI_rctf_size_y(), FontBLF::flags, len, and str.
Referenced by BLF_width_and_height().
| int blf_font_width_max | ( | FontBLF * | font | ) |
Definition at line 1435 of file blf_font.c.
References blf_font_ensure_ascii_table(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), and GlyphCacheBLF::glyph_width_max.
Referenced by BLF_width_max().
| size_t blf_font_width_to_rstrlen | ( | FontBLF * | font, |
| const char * | str, | ||
| size_t | len, | ||
| float | width, | ||
| float * | r_width | ||
| ) |
Definition at line 773 of file blf_font.c.
References blf_font_ensure_ascii_kerning(), blf_font_ensure_ascii_table(), blf_font_width_to_strlen_glyph_process(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), BLF_KERNING_VARS, BLF_UTF8_NEXT_FAST, BLI_assert, BLI_str_find_prev_char_utf8(), BLI_strnlen(), BLI_UTF8_ERR, Freestyle::c, float(), len, NULL, str, and width.
Referenced by BLF_width_to_rstrlen().
| size_t blf_font_width_to_strlen | ( | FontBLF * | font, |
| const char * | str, | ||
| size_t | len, | ||
| float | width, | ||
| float * | r_width | ||
| ) |
Definition at line 737 of file blf_font.c.
References blf_font_ensure_ascii_kerning(), blf_font_ensure_ascii_table(), blf_font_width_to_strlen_glyph_process(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), BLF_KERNING_VARS, BLF_UTF8_NEXT_FAST, BLI_UTF8_ERR, Freestyle::c, float(), len, NULL, str, and width.
Referenced by BLF_width_to_strlen().
|
static |
Definition at line 712 of file blf_font.c.
References GlyphBLF::advance_i, BLF_KERNING_STEP_FAST, BLI_UTF8_ERR, Freestyle::c, NULL, and UNLIKELY.
Referenced by blf_font_width_to_rstrlen(), and blf_font_width_to_strlen().
|
static |
Generic function to add word-wrap support for other existing functions.
Wraps on spaces and respects newlines. Intentionally ignores non-unix newlines, tabs and more advanced text formatting.
Implementation Detail (utf8).
Take care with single byte offsets here, since this is utf8 we can't be sure a single byte is a single character.
This is only done when we know for sure the character is ascii (newline or a space).
Definition at line 921 of file blf_font.c.
References GlyphBLF::advance_i, blf_font_ensure_ascii_table(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), BLF_KERNING_STEP, BLF_KERNING_VARS, BLF_UTF8_NEXT_FAST, BLI_UTF8_ERR, GlyphBLF::c, Freestyle::c, callback, GlyphCacheBLF::glyph_height_max, len, ResultBLF::lines, NULL, str, UNLIKELY, ResultBLF::width, blender::gpu::wrap(), FontBLF::wrap_width, and wrap_width().
Referenced by blf_font_boundbox__wrap(), blf_font_draw__wrap(), and blf_font_draw_buffer__wrap().
|
static |
Definition at line 72 of file blf_font.c.
Referenced by blf_font_exit(), blf_font_fill(), blf_font_free(), and blf_font_init().
|
static |
Definition at line 70 of file blf_font.c.
Referenced by blf_font_exit(), blf_font_fill(), blf_font_init(), blf_font_new(), and blf_font_new_from_mem().
|
static |
Definition at line 71 of file blf_font.c.
Referenced by blf_font_exit(), blf_font_fill(), and blf_font_init().
| BatchBLF g_batch |
Definition at line 67 of file blf_font.c.
Referenced by blf_batch_cache_texture_load(), blf_batch_draw(), blf_batch_draw_begin(), BLF_batch_draw_begin(), BLF_batch_draw_end(), blf_batch_draw_end(), blf_batch_draw_exit(), BLF_batch_draw_flush(), blf_batch_draw_init(), blf_font_init(), blf_glyph_render(), and blf_texture_draw().