Blender
V3.3
|
#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 "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.
Functions | |
Font Query: Attributes | |
static ft_pix | blf_font_height_max_ft_pix (struct FontBLF *font) |
static ft_pix | blf_font_width_max_ft_pix (struct FontBLF *font) |
int | blf_font_height_max (FontBLF *font) |
int | blf_font_width_max (FontBLF *font) |
int | blf_font_descender (FontBLF *font) |
int | blf_font_ascender (FontBLF *font) |
char * | blf_display_name (FontBLF *font) |
FreeType Utilities (Internal) | |
static ft_pix | blf_unscaled_F26Dot6_to_pixels (FontBLF *font, FT_Pos value) |
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) |
Glyph Stepping Utilities (Internal) | |
BLI_INLINE GlyphBLF * | blf_glyph_from_utf8_and_step (FontBLF *font, GlyphCacheBLF *gc, const char *str, size_t str_len, size_t *i_p) |
BLI_INLINE ft_pix | blf_kerning (FontBLF *font, const GlyphBLF *g_prev, const GlyphBLF *g) |
Text Drawing: GPU | |
static void | blf_font_draw_ex (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, struct ResultBLF *r_info, ft_pix pen_y) |
void | blf_font_draw (FontBLF *font, const char *str, const size_t str_len, struct ResultBLF *r_info) |
int | blf_font_draw_mono (FontBLF *font, const char *str, const size_t str_len, int cwidth) |
Text Drawing: Buffer | |
static void | blf_font_draw_buffer_ex (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, struct ResultBLF *r_info, ft_pix pen_y) |
void | blf_font_draw_buffer (FontBLF *font, const char *str, const size_t str_len, struct ResultBLF *r_info) |
Text Evaluation: Width to String Length | |
Use to implement exported functions: | |
static bool | blf_font_width_to_strlen_glyph_process (FontBLF *font, GlyphBLF *g_prev, GlyphBLF *g, ft_pix *pen_x, const int width_i) |
size_t | blf_font_width_to_strlen (FontBLF *font, const char *str, const size_t str_len, int width, int *r_width) |
size_t | blf_font_width_to_rstrlen (FontBLF *font, const char *str, const size_t str_len, int width, int *r_width) |
Text Evaluation: Glyph Bound Box with Callback | |
static void | blf_font_boundbox_ex (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, rcti *box, struct ResultBLF *r_info, ft_pix pen_y) |
void | blf_font_boundbox (FontBLF *font, const char *str, const size_t str_len, rcti *r_box, struct ResultBLF *r_info) |
void | blf_font_width_and_height (FontBLF *font, const char *str, const size_t str_len, float *r_width, float *r_height, struct ResultBLF *r_info) |
float | blf_font_width (FontBLF *font, const char *str, const size_t str_len, struct ResultBLF *r_info) |
float | blf_font_height (FontBLF *font, const char *str, const size_t str_len, struct ResultBLF *r_info) |
float | blf_font_fixed_width (FontBLF *font) |
static void | blf_font_boundbox_foreach_glyph_ex (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, BLF_GlyphBoundsFn user_fn, void *user_data, struct ResultBLF *r_info, ft_pix pen_y) |
void | blf_font_boundbox_foreach_glyph (FontBLF *font, const char *str, const size_t str_len, BLF_GlyphBoundsFn user_fn, void *user_data, struct ResultBLF *r_info) |
Text Evaluation: Word-Wrap with Callback | |
static void | blf_font_wrap_apply (FontBLF *font, const char *str, const size_t str_len, struct ResultBLF *r_info, void(*callback)(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *userdata), void *userdata) |
static void | blf_font_draw__wrap_cb (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *UNUSED(userdata)) |
void | blf_font_draw__wrap (FontBLF *font, const char *str, const size_t str_len, struct ResultBLF *r_info) |
static void | blf_font_boundbox_wrap_cb (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *userdata) |
void | blf_font_boundbox__wrap (FontBLF *font, const char *str, const size_t str_len, rcti *box, struct ResultBLF *r_info) |
static void | blf_font_draw_buffer__wrap_cb (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *UNUSED(userdata)) |
void | blf_font_draw_buffer__wrap (FontBLF *font, const char *str, const size_t str_len, struct ResultBLF *r_info) |
Text Evaluation: Count Missing Characters | |
int | blf_font_count_missing_chars (FontBLF *font, const char *str, const size_t str_len, int *r_tot_chars) |
Font Subsystem Init/Exit | |
int | blf_font_init (void) |
void | blf_font_exit (void) |
void | BLF_cache_flush_set_fn (void(*cache_flush_fn)(void)) |
Font New/Free | |
static void | blf_font_fill (FontBLF *font) |
FontBLF * | blf_font_new (const char *name, const char *filepath) |
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) |
void | blf_font_free (FontBLF *font) |
Font Configure | |
bool | blf_font_size (FontBLF *font, float size, unsigned int dpi) |
Variables | |
BatchBLF | g_batch |
static FT_Library | ft_lib |
static SpinLock | ft_lib_mutex |
static SpinLock | blf_glyph_cache_mutex |
static void(* | blf_draw_cache_flush )(void) = NULL |
Deals with drawing text to OpenGL or bitmap buffers.
Also low level functions for managing FontBLF.
Definition in file blf_font.c.
|
static |
Definition at line 189 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().
Definition at line 229 of file blf_font.c.
References BatchBLF::batch, blf_batch_cache_texture_load(), blf_draw_cache_flush, 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(), NULL, BatchBLF::offset_loc, BatchBLF::pos_loc, and BatchBLF::verts.
Referenced by blf_batch_draw_begin(), BLF_batch_draw_end(), blf_batch_draw_end(), BLF_batch_draw_flush(), blf_glyph_draw(), and blf_texture_draw().
Definition at line 129 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, 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_int().
Referenced by blf_font_draw_ex(), and blf_font_draw_mono().
Definition at line 262 of file blf_font.c.
References BatchBLF::active, blf_batch_draw(), and g_batch.
Referenced by blf_font_draw_ex(), and blf_font_draw_mono().
Definition at line 124 of file blf_font.c.
References BatchBLF::batch, g_batch, and GPU_BATCH_DISCARD_SAFE.
Referenced by blf_font_exit().
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 96 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().
Optional cache flushing function, called before blf_batch_draw.
Definition at line 1188 of file blf_font.c.
References blf_draw_cache_flush.
Referenced by uiStyleInit().
char* blf_display_name | ( | FontBLF * | font | ) |
Definition at line 1158 of file blf_font.c.
References BLI_sprintfN(), FontBLF::face, and NULL.
Referenced by BLF_display_name_from_file().
int blf_font_ascender | ( | FontBLF * | font | ) |
Definition at line 1153 of file blf_font.c.
References FontBLF::face, and ft_pix_to_int().
Referenced by BLF_ascender(), and BLF_thumb_preview().
Definition at line 1329 of file blf_font.c.
References FontBLF::face.
Referenced by BLF_metrics_attach().
void blf_font_boundbox | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
rcti * | r_box, | ||
struct ResultBLF * | r_info | ||
) |
Definition at line 732 of file blf_font.c.
References blf_font_boundbox_ex(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), 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, | ||
const size_t | str_len, | ||
rcti * | box, | ||
struct ResultBLF * | r_info | ||
) |
Definition at line 1039 of file blf_font.c.
References blf_font_boundbox_wrap_cb(), blf_font_wrap_apply(), str, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by BLF_boundbox_ex(), blf_font_height(), blf_font_width(), and blf_font_width_and_height().
|
static |
Definition at line 666 of file blf_font.c.
References blf_glyph_from_utf8_and_step(), blf_kerning(), ft_pix_from_int(), ft_pix_round_advance(), ft_pix_to_int(), ft_pix_to_int_ceil(), ft_pix_to_int_floor(), usdtokens::g(), ResultBLF::lines, NULL, str, UNLIKELY, ResultBLF::width, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by blf_font_boundbox(), and blf_font_boundbox_wrap_cb().
void blf_font_boundbox_foreach_glyph | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
BLF_GlyphBoundsFn | user_fn, | ||
void * | user_data, | ||
struct ResultBLF * | r_info | ||
) |
Definition at line 880 of file blf_font.c.
References blf_font_boundbox_foreach_glyph_ex(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), str, and user_data.
Referenced by BLF_boundbox_foreach_glyph_ex().
|
static |
Definition at line 825 of file blf_font.c.
References blf_glyph_from_utf8_and_step(), blf_kerning(), ft_pix_round_advance(), ft_pix_to_int(), ft_pix_to_int_ceil(), ft_pix_to_int_floor(), usdtokens::g(), ResultBLF::lines, NULL, 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 1026 of file blf_font.c.
References blf_font_boundbox_ex(), BLI_rcti_union(), NULL, and str.
Referenced by blf_font_boundbox__wrap().
int blf_font_count_missing_chars | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
int * | r_tot_chars | ||
) |
Definition at line 1074 of file blf_font.c.
References BLI_str_utf8_as_unicode_step(), Freestyle::c, GLYPH_ASCII_TABLE_SIZE, and str.
Referenced by BLF_thumb_preview().
int blf_font_descender | ( | FontBLF * | font | ) |
Definition at line 1148 of file blf_font.c.
References FontBLF::face, and ft_pix_to_int().
Referenced by BLF_descender().
void blf_font_draw | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
struct ResultBLF * | r_info | ||
) |
Definition at line 371 of file blf_font.c.
References blf_font_draw_ex(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), and str.
Referenced by BLF_draw_ex().
void blf_font_draw__wrap | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
struct ResultBLF * | r_info | ||
) |
Definition at line 1017 of file blf_font.c.
References blf_font_draw__wrap_cb(), blf_font_wrap_apply(), NULL, and str.
Referenced by BLF_draw_ex().
|
static |
Definition at line 1008 of file blf_font.c.
References blf_font_draw_ex(), NULL, and str.
Referenced by blf_font_draw__wrap().
void blf_font_draw_buffer | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
struct ResultBLF * | r_info | ||
) |
Definition at line 557 of file blf_font.c.
References blf_font_draw_buffer_ex(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), and str.
Referenced by BLF_draw_buffer_ex(), and BLF_thumb_preview().
void blf_font_draw_buffer__wrap | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
struct ResultBLF * | r_info | ||
) |
Definition at line 1060 of file blf_font.c.
References blf_font_draw_buffer__wrap_cb(), blf_font_wrap_apply(), NULL, and str.
Referenced by BLF_draw_buffer_ex().
|
static |
Definition at line 1051 of file blf_font.c.
References blf_font_draw_buffer_ex(), NULL, and str.
Referenced by blf_font_draw_buffer__wrap().
|
static |
Definition at line 422 of file blf_font.c.
References Freestyle::a, blend_color_mix_byte(), blend_color_mix_float(), blf_glyph_from_utf8_and_step(), blf_kerning(), FontBLF::buf_info, FontBufInfoBLF::cbuf, FontBufInfoBLF::ch, FontBufInfoBLF::col_char, FontBufInfoBLF::col_float, FontBufInfoBLF::dims, FontBufInfoBLF::fbuf, ft_pix_from_int(), ft_pix_round_advance(), ft_pix_to_int(), usdtokens::g(), ResultBLF::lines, NULL, 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 331 of file blf_font.c.
References blf_batch_draw_begin(), blf_batch_draw_end(), blf_glyph_draw(), blf_glyph_from_utf8_and_step(), blf_kerning(), ft_pix_round_advance(), ft_pix_to_int(), ft_pix_to_int_floor(), usdtokens::g(), ResultBLF::lines, NULL, str, UNLIKELY, and ResultBLF::width.
Referenced by blf_font_draw(), and blf_font_draw__wrap_cb().
int blf_font_draw_mono | ( | struct FontBLF * | font, |
const char * | str, | ||
size_t | str_len, | ||
int | cwidth | ||
) |
Use fixed column width, but an utf8 character may occupy multiple columns.
Definition at line 378 of file blf_font.c.
References blf_batch_draw_begin(), blf_batch_draw_end(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), blf_glyph_draw(), blf_glyph_from_utf8_and_step(), BLI_wcwidth(), col, ft_pix_from_int(), ft_pix_to_int_floor(), usdtokens::g(), NULL, str, and UNLIKELY.
Referenced by BLF_draw_mono().
Definition at line 1180 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().
Definition at line 1199 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::m, NULL, FontBLF::pos, FontBLF::size, FontBLF::tex_size_max, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by blf_font_new(), and blf_font_new_from_mem().
Definition at line 817 of file blf_font.c.
References blf_glyph_cache_acquire(), blf_glyph_cache_release(), GlyphCacheBLF::fixed_width, FontBLF::size, and width.
Referenced by BLF_fixed_width().
Definition at line 1380 of file blf_font.c.
References blf_glyph_cache_clear(), FontBLF::face, FontBLF::filepath, ft_lib, FontBLF::kerning_cache, MEM_freeN, FontBLF::name, and FontBLF::variations.
Referenced by BLF_display_name_from_file(), BLF_exit(), BLF_thumb_preview(), BLF_unload(), BLF_unload_all(), and BLF_unload_id().
float blf_font_height | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
struct ResultBLF * | r_info | ||
) |
Definition at line 793 of file blf_font.c.
References FontBLF::aspect, BLF_ASPECT, blf_font_boundbox(), blf_font_boundbox__wrap(), BLF_WORD_WRAP, BLI_rcti_size_y(), FontBLF::flags, and str.
Referenced by BLF_height_ex().
int blf_font_height_max | ( | FontBLF * | font | ) |
Definition at line 1122 of file blf_font.c.
References blf_font_height_max_ft_pix(), and ft_pix_to_int().
Referenced by BLF_height_max().
Definition at line 1106 of file blf_font.c.
References FontBLF::face, ft_pix_from_int(), and MAX2.
Referenced by blf_font_height_max(), and blf_font_wrap_apply().
int blf_font_init | ( | void | ) |
Definition at line 1172 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 * | filepath | ||
) |
Definition at line 1247 of file blf_font.c.
References KerningCacheBLF::ascii_table, blf_dir_metrics_search(), blf_font_fill(), BLF_LAST_RESORT, BLF_MONOSPACED, BLI_strdup(), ELEM, err, FontBLF::face, FontBLF::filepath, FontBLF::flags, ft_lib, FontBLF::kerning_cache, KERNING_CACHE_TABLE_SIZE, KERNING_ENTRY_UNSET, MEM_callocN, MEM_freeN, MEM_mallocN, FontBLF::name, NULL, FontBLF::UnicodeRanges, and FontBLF::variations.
Referenced by BLF_display_name_from_file(), 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 1339 of file blf_font.c.
References KerningCacheBLF::ascii_table, blf_font_fill(), BLI_strdup(), err, FontBLF::face, FontBLF::filepath, ft_lib, FontBLF::kerning_cache, KERNING_CACHE_TABLE_SIZE, KERNING_ENTRY_UNSET, MEM_callocN, MEM_freeN, MEM_mallocN, FontBLF::name, NULL, and FontBLF::variations.
Referenced by BLF_load_mem_unique().
Change font's output size. Returns true if successful in changing the size.
Definition at line 1408 of file blf_font.c.
References FontBLF::dpi, FontBLF::face, float(), size(), and FontBLF::size.
Referenced by BLF_size(), and BLF_thumb_preview().
float blf_font_width | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
struct ResultBLF * | r_info | ||
) |
Definition at line 769 of file blf_font.c.
References FontBLF::aspect, BLF_ASPECT, blf_font_boundbox(), blf_font_boundbox__wrap(), BLF_WORD_WRAP, BLI_rcti_size_x(), FontBLF::flags, and str.
Referenced by BLF_width_ex().
void blf_font_width_and_height | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
float * | r_width, | ||
float * | r_height, | ||
struct ResultBLF * | r_info | ||
) |
Definition at line 740 of file blf_font.c.
References FontBLF::aspect, BLF_ASPECT, blf_font_boundbox(), blf_font_boundbox__wrap(), BLF_WORD_WRAP, BLI_rcti_size_x(), BLI_rcti_size_y(), FontBLF::flags, float(), and str.
Referenced by BLF_width_and_height().
int blf_font_width_max | ( | FontBLF * | font | ) |
Definition at line 1143 of file blf_font.c.
References blf_font_width_max_ft_pix(), and ft_pix_to_int().
Referenced by BLF_width_max().
Definition at line 1127 of file blf_font.c.
References FontBLF::face, ft_pix_from_int(), and MAX2.
Referenced by blf_font_width_max().
size_t blf_font_width_to_rstrlen | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
int | width, | ||
int * | r_width | ||
) |
Definition at line 618 of file blf_font.c.
References blf_font_width_to_strlen_glyph_process(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), blf_glyph_from_utf8_and_step(), BLI_assert, BLI_str_find_prev_char_utf8(), BLI_strnlen(), ft_pix_to_int(), usdtokens::g(), NULL, str, and width.
Referenced by BLF_width_to_rstrlen().
size_t blf_font_width_to_strlen | ( | FontBLF * | font, |
const char * | str, | ||
const size_t | str_len, | ||
int | width, | ||
int * | r_width | ||
) |
Definition at line 590 of file blf_font.c.
References blf_font_width_to_strlen_glyph_process(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), blf_glyph_from_utf8_and_step(), ft_pix_to_int(), usdtokens::g(), NULL, str, and width.
Referenced by BLF_width_to_strlen().
|
static |
Definition at line 577 of file blf_font.c.
References blf_kerning(), ft_pix_round_advance(), ft_pix_to_int(), usdtokens::g(), 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 907 of file blf_font.c.
References blf_font_height_max_ft_pix(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), blf_glyph_from_utf8_and_step(), blf_kerning(), GlyphBLF::c, callback, FT_PIX_FLOOR, ft_pix_from_int(), ft_pix_round_advance(), ft_pix_to_int(), usdtokens::g(), ResultBLF::lines, NULL, str, UNLIKELY, ResultBLF::width, blender::bke::image::partial_update::wrap(), FontBLF::wrap_width, and wrap_width().
Referenced by blf_font_boundbox__wrap(), blf_font_draw__wrap(), and blf_font_draw_buffer__wrap().
BLI_INLINE GlyphBLF* blf_glyph_from_utf8_and_step | ( | FontBLF * | font, |
GlyphCacheBLF * | gc, | ||
const char * | str, | ||
size_t | str_len, | ||
size_t * | i_p | ||
) |
Definition at line 280 of file blf_font.c.
References blf_glyph_ensure(), BLI_assert, BLI_str_utf8_as_unicode_step(), BLI_UTF8_ERR, and str.
Referenced by blf_font_boundbox_ex(), blf_font_boundbox_foreach_glyph_ex(), blf_font_draw_buffer_ex(), blf_font_draw_ex(), blf_font_draw_mono(), blf_font_width_to_rstrlen(), blf_font_width_to_strlen(), and blf_font_wrap_apply().
BLI_INLINE ft_pix blf_kerning | ( | FontBLF * | font, |
const GlyphBLF * | g_prev, | ||
const GlyphBLF * | g | ||
) |
Definition at line 290 of file blf_font.c.
References KerningCacheBLF::ascii_table, blf_unscaled_F26Dot6_to_pixels(), GlyphBLF::c, FontBLF::face, usdtokens::g(), GLYPH_ASCII_TABLE_SIZE, GlyphBLF::idx, FontBLF::kerning_cache, KERNING_CACHE_TABLE_SIZE, KERNING_ENTRY_UNSET, GlyphBLF::rsb_delta, and UNLIKELY.
Referenced by blf_font_boundbox_ex(), blf_font_boundbox_foreach_glyph_ex(), blf_font_draw_buffer_ex(), blf_font_draw_ex(), blf_font_width_to_strlen_glyph_process(), and blf_font_wrap_apply().
Definition at line 70 of file blf_font.c.
References FontBLF::face, and scaled().
Referenced by blf_kerning().
Definition at line 60 of file blf_font.c.
Referenced by blf_batch_draw(), and BLF_cache_flush_set_fn().
|
static |
Definition at line 57 of file blf_font.c.
Referenced by blf_font_exit(), blf_font_fill(), and blf_font_init().
|
static |
Definition at line 55 of file blf_font.c.
Referenced by blf_font_exit(), blf_font_fill(), blf_font_free(), blf_font_init(), blf_font_new(), and blf_font_new_from_mem().
|
static |
Definition at line 56 of file blf_font.c.
Referenced by blf_font_exit(), blf_font_fill(), and blf_font_init().
BatchBLF g_batch |
Definition at line 52 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_draw(), and blf_texture_draw().