Blender V5.3
blf.cc File Reference
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ft2build.h>
#include "BLI_fileops.hh"
#include "BLI_math_rotation_c.hh"
#include "BLI_path_utils.hh"
#include "BLI_string.hh"
#include "BLF_api.hh"
#include "IMB_colormanagement.hh"
#include "GPU_matrix.hh"
#include "GPU_state.hh"
#include "blf_internal.hh"
#include "blf_internal_types.hh"

Go to the source code of this file.

Classes

struct  blender::BLFBufferState

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define BLF_RESULT_CHECK_INIT(r_info)

Functions

static FontBLF * blender::blf_get (int fontid)
int blender::BLF_init ()
void blender::BLF_exit ()
void blender::BLF_reset_fonts ()
void blender::BLF_cache_clear ()
static int blender::blf_search_by_mem_name (const char *mem_name)
static int blender::blf_search_by_filepath (const char *filepath)
static int blender::blf_search_available ()
bool blender::BLF_has_glyph (int fontid, unsigned int unicode) ATTR_WARN_UNUSED_RESULT
int bool blender::BLF_is_loaded (const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool blender::BLF_is_loaded_mem (const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool blender::BLF_is_loaded_id (int fontid) ATTR_WARN_UNUSED_RESULT
int blender::BLF_load (const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int blender::BLF_load_unique (const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void blender::BLF_metrics_attach (int fontid, const unsigned char *mem, int mem_size) ATTR_NONNULL(2)
int blender::BLF_load_mem (const char *name, const unsigned char *mem, int mem_size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int blender::BLF_load_mem_unique (const char *name, const unsigned char *mem, int mem_size) ATTR_NONNULL(1
int void blender::BLF_unload (const char *filepath) ATTR_NONNULL(1)
bool blender::BLF_unload_id (int fontid)
void blender::BLF_unload_all ()
void blender::BLF_addref_id (int fontid)
void blender::BLF_enable (int fontid, FontFlags flag)
void blender::BLF_disable (int fontid, FontFlags flag)
bool blender::BLF_is_builtin (int fontid)
void blender::BLF_character_weight (int fontid, int weight)
int blender::BLF_default_weight (int fontid) ATTR_WARN_UNUSED_RESULT
bool blender::BLF_has_variable_weight (int fontid) ATTR_WARN_UNUSED_RESULT
void blender::BLF_aspect (int fontid, float x, float y, float z)
void blender::BLF_position (int fontid, float x, float y, float z)
void blender::BLF_size (int fontid, float size)
void blender::BLF_color4ubv (int fontid, const unsigned char rgba[4])
void blender::BLF_color3ubv_alpha (int fontid, const unsigned char rgb[3], unsigned char alpha)
void blender::BLF_color3ubv (int fontid, const unsigned char rgb[3])
void blender::BLF_color4ub (int fontid, unsigned char r, unsigned char g, unsigned char b, unsigned char alpha)
void blender::BLF_color3ub (int fontid, unsigned char r, unsigned char g, unsigned char b)
void blender::BLF_color4fv (int fontid, const float rgba[4])
void blender::BLF_color4f (int fontid, float r, float g, float b, float a)
void blender::BLF_color3fv_alpha (int fontid, const float rgb[3], float alpha)
void blender::BLF_color3f (int fontid, float r, float g, float b)
void blender::BLF_batch_draw_begin ()
void blender::BLF_batch_draw_flush ()
void blender::BLF_batch_draw_end ()
static void blender::blf_draw_gpu__start (const FontBLF *font)
static void blender::blf_draw_gpu__end (const FontBLF *font)
void blender::BLF_draw (int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
int blender::BLF_draw_mono (int fontid, const char *str, size_t str_len, int char_width, int tab_columns) ATTR_NONNULL(2)
void blender::BLF_draw_svg_icon (uint icon_id, float x, float y, float size, const float color[4]=nullptr, float outline_alpha=1.0f, bool multicolor=false, FunctionRef< void(std::string &)> edit_source_cb=nullptr)
Array< uchar > blender::BLF_svg_icon_bitmap (uint icon_id, float size, int *r_width, int *r_height, bool multicolor=false, FunctionRef< void(std::string &)> edit_source_cb=nullptr)
void blender::BLF_boundbox_foreach_glyph (int fontid, const char *str, size_t str_len, BLF_GlyphBoundsFn user_fn, void *user_data) ATTR_NONNULL(2)
void blender::BLF_info_foreach_glyph (int fontid, const char *str, size_t str_len, FunctionRef< void(int index, size_t byte_offset, int byte_len, int advance_x)> callback)
size_t blender::BLF_str_offset_from_cursor_position (int fontid, const char *str, size_t str_len, int location_x) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
bool blender::BLF_str_offset_to_glyph_bounds (int fontid, const char *str, size_t str_offset, rcti *r_glyph_bounds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2
bool int blender::BLF_str_offset_to_cursor (int fontid, const char *str, size_t str_len, size_t str_offset, int cursor_width)
Vector< Bounds< int > > blender::BLF_str_selection_boxes (int fontid, const char *str, size_t str_len, size_t sel_start, size_t sel_length)
size_t blender::BLF_width_to_strlen (int fontid, const char *str, size_t str_len, float width, float *r_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
size_t blender::BLF_width_to_rstrlen (int fontid, const char *str, size_t str_len, float width, float *r_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
void blender::BLF_boundbox (int fontid, const char *str, size_t str_len, rcti *r_box, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
void blender::BLF_width_and_height (int fontid, const char *str, size_t str_len, float *r_width, float *r_height) ATTR_NONNULL()
float blender::BLF_width (int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
float blender::BLF_fixed_width (int fontid) ATTR_WARN_UNUSED_RESULT
int blender::BLF_glyph_advance (int fontid, const char *str)
float blender::BLF_height (int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
int blender::BLF_height_max (int fontid) ATTR_WARN_UNUSED_RESULT
int blender::BLF_width_max (int fontid) ATTR_WARN_UNUSED_RESULT
int blender::BLF_descender (int fontid) ATTR_WARN_UNUSED_RESULT
int blender::BLF_ascender (int fontid) ATTR_WARN_UNUSED_RESULT
bool blender::BLF_bounds_max (int fontid, rctf *r_bounds) ATTR_NONNULL(2)
void blender::BLF_rotation (int fontid, float angle)
void blender::BLF_clipping (int fontid, int xmin, int ymin, int xmax, int ymax)
void blender::BLF_wordwrap (int fontid, int wrap_width, BLFWrapMode mode=BLFWrapMode::Minimal)
void blender::BLF_shadow (int fontid, FontShadowType type, const float rgba[4]=nullptr)
void blender::BLF_shadow_offset (int fontid, int x, int y)
void blender::BLF_buffer (int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int channel_count, const ColorSpace *colorspace)
BLFBufferState * blender::BLF_buffer_state_push (int fontid)
void blender::BLF_buffer_state_pop (BLFBufferState *buffer_state)
void blender::BLF_buffer_state_free (BLFBufferState *buffer_state)
void blender::BLF_buffer_col (int fontid, const float srgb_color[4]) ATTR_NONNULL(2)
void blender::blf_draw_buffer__start (FontBLF *font)
void blender::blf_draw_buffer__end ()
void blender::BLF_draw_buffer (int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
Vector< StringRef > blender::BLF_string_wrap (int fontid, StringRef str, const int max_pixel_width, BLFWrapMode mode=BLFWrapMode::Minimal)
char * blender::BLF_display_name_from_file (const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * blender::BLF_display_name_from_id (int fontid)
bool blender::BLF_get_vfont_metrics (int fontid, float *ascend_ratio, float *em_ratio, float *scale)
bool blender::BLF_character_to_curves (int fontid, unsigned int unicode, ListBaseT< Nurb > *nurbsbase, const float scale, bool use_fallback, float *r_advance, rctf *r_bounds)
void blender::BLF_state_print (int fontid)

Variables

FontBLF * blender::global_font [BLF_MAX_FONT] = {nullptr}
static Mutex blender::g_blf_load_mutex

Detailed Description

Main BlenFont (BLF) API, public functions for font handling.

Wraps GPU display and FreeType.

Definition in file blf.cc.

Macro Definition Documentation

◆ BLF_RESULT_CHECK_INIT

#define BLF_RESULT_CHECK_INIT ( r_info)
Value:
if (r_info) { \
memset(r_info, 0, sizeof(*(r_info))); \
} \
((void)0)

Definition at line 40 of file blf.cc.

Referenced by blender::BLF_boundbox(), blender::BLF_draw(), blender::BLF_height(), and blender::BLF_width().