Blender  V2.93
Classes | Macros | Typedefs | Functions | Variables
BLF_api.h File Reference
#include "BLI_compiler_attrs.h"
#include "BLI_sys_types.h"

Go to the source code of this file.

Classes

struct  ResultBLF
 

Macros

#define BLF_BLUR_ENABLE   0
 
#define BLF_ROTATION   (1 << 0)
 
#define BLF_CLIPPING   (1 << 1)
 
#define BLF_SHADOW   (1 << 2)
 
#define BLF_KERNING_DEFAULT   (1 << 3)
 
#define BLF_MATRIX   (1 << 4)
 
#define BLF_ASPECT   (1 << 5)
 
#define BLF_WORD_WRAP   (1 << 6)
 
#define BLF_MONOCHROME   (1 << 7) /* no-AA */
 
#define BLF_HINTING_NONE   (1 << 8)
 
#define BLF_HINTING_SLIGHT   (1 << 9)
 
#define BLF_HINTING_FULL   (1 << 10)
 
#define BLF_BOLD   (1 << 11)
 
#define BLF_ITALIC   (1 << 12)
 
#define BLF_DRAW_STR_DUMMY_MAX   1024
 

Typedefs

typedef bool(* BLF_GlyphBoundsFn) (const char *str, const size_t str_step_ofs, const struct rcti *glyph_step_bounds, const int glyph_advance_x, const struct rctf *glyph_bounds, const int glyph_bearing[2], void *user_data)
 

Functions

int BLF_init (void)
 
void BLF_exit (void)
 
void BLF_cache_clear (void)
 
int BLF_load (const char *name) ATTR_NONNULL()
 
int BLF_load_mem (const char *name, const unsigned char *mem, int mem_size) ATTR_NONNULL()
 
int BLF_load_unique (const char *name) ATTR_NONNULL()
 
int BLF_load_mem_unique (const char *name, const unsigned char *mem, int mem_size) ATTR_NONNULL()
 
void BLF_unload (const char *name) ATTR_NONNULL()
 
void BLF_unload_id (int fontid)
 
bool BLF_has_glyph (int fontid, unsigned int unicode)
 
void BLF_metrics_attach (int fontid, unsigned char *mem, int mem_size)
 
void BLF_aspect (int fontid, float x, float y, float z)
 
void BLF_position (int fontid, float x, float y, float z)
 
void BLF_size (int fontid, int size, int dpi)
 
void BLF_color4ubv (int fontid, const unsigned char rgba[4])
 
void BLF_color3ubv (int fontid, const unsigned char rgb[3])
 
void BLF_color3ubv_alpha (int fontid, const unsigned char rgb[3], unsigned char alpha)
 
void BLF_color4ub (int fontid, unsigned char r, unsigned char g, unsigned char b, unsigned char alpha)
 
void BLF_color3ub (int fontid, unsigned char r, unsigned char g, unsigned char b)
 
void BLF_color4f (int fontid, float r, float g, float b, float a)
 
void BLF_color4fv (int fontid, const float rgba[4])
 
void BLF_color3f (int fontid, float r, float g, float b)
 
void BLF_color3fv_alpha (int fontid, const float rgb[3], float alpha)
 
void BLF_matrix (int fontid, const float m[16])
 
void BLF_batch_draw_begin (void)
 
void BLF_batch_draw_flush (void)
 
void BLF_batch_draw_end (void)
 
void BLF_draw_ex (int fontid, const char *str, size_t len, struct ResultBLF *r_info) ATTR_NONNULL(2)
 
void BLF_draw (int fontid, const char *str, size_t len) ATTR_NONNULL(2)
 
void BLF_draw_ascii_ex (int fontid, const char *str, size_t len, struct ResultBLF *r_info) ATTR_NONNULL(2)
 
void BLF_draw_ascii (int fontid, const char *str, size_t len) ATTR_NONNULL(2)
 
int BLF_draw_mono (int fontid, const char *str, size_t len, int cwidth) ATTR_NONNULL(2)
 
void BLF_boundbox_foreach_glyph_ex (int fontid, const char *str, size_t len, BLF_GlyphBoundsFn user_fn, void *user_data, struct ResultBLF *r_info) ATTR_NONNULL(2)
 
void BLF_boundbox_foreach_glyph (int fontid, const char *str, size_t len, BLF_GlyphBoundsFn user_fn, void *user_data) ATTR_NONNULL(2)
 
size_t BLF_width_to_strlen (int fontid, const char *str, size_t len, float width, float *r_width) ATTR_NONNULL(2)
 
size_t BLF_width_to_rstrlen (int fontid, const char *str, size_t len, float width, float *r_width) ATTR_NONNULL(2)
 
void BLF_boundbox_ex (int fontid, const char *str, size_t len, struct rctf *box, struct ResultBLF *r_info) ATTR_NONNULL(2)
 
void BLF_boundbox (int fontid, const char *str, size_t len, struct rctf *box) ATTR_NONNULL()
 
float BLF_width_ex (int fontid, const char *str, size_t len, struct ResultBLF *r_info) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
 
float BLF_width (int fontid, const char *str, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
float BLF_height_ex (int fontid, const char *str, size_t len, struct ResultBLF *r_info) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
 
float BLF_height (int fontid, const char *str, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
int BLF_height_max (int fontid) ATTR_WARN_UNUSED_RESULT
 
float BLF_width_max (int fontid) ATTR_WARN_UNUSED_RESULT
 
float BLF_descender (int fontid) ATTR_WARN_UNUSED_RESULT
 
float BLF_ascender (int fontid) ATTR_WARN_UNUSED_RESULT
 
void BLF_width_and_height (int fontid, const char *str, size_t len, float *r_width, float *r_height) ATTR_NONNULL()
 
float BLF_fixed_width (int fontid) ATTR_WARN_UNUSED_RESULT
 
void BLF_rotation (int fontid, float angle)
 
void BLF_clipping (int fontid, float xmin, float ymin, float xmax, float ymax)
 
void BLF_wordwrap (int fontid, int wrap_width)
 
void BLF_enable (int fontid, int option)
 
void BLF_disable (int fontid, int option)
 
void BLF_shadow (int fontid, int level, const float rgba[4]) ATTR_NONNULL(3)
 
void BLF_shadow_offset (int fontid, int x, int y)
 
void BLF_buffer (int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, struct ColorManagedDisplay *display)
 
void BLF_buffer_col (int fontid, const float rgba[4]) ATTR_NONNULL(2)
 
void BLF_draw_buffer_ex (int fontid, const char *str, size_t len, struct ResultBLF *r_info) ATTR_NONNULL(2)
 
void BLF_draw_buffer (int fontid, const char *str, size_t len) ATTR_NONNULL(2)
 
void BLF_dir_add (const char *path) ATTR_NONNULL()
 
void BLF_dir_rem (const char *path) ATTR_NONNULL()
 
char ** BLF_dir_get (int *ndir) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 
void BLF_dir_free (char **dirs, int count) ATTR_NONNULL()
 
void BLF_thumb_preview (const char *filename, const char **draw_str, const char **i18n_draw_str, const unsigned char draw_str_lines, const float font_color[4], const int font_size, unsigned char *buf, int w, int h, int channels) ATTR_NONNULL()
 
void BLF_default_dpi (int dpi)
 
void BLF_default_set (int fontid)
 
int BLF_default (void)
 
void BLF_draw_default (float x, float y, float z, const char *str, size_t len) ATTR_NONNULL()
 
void BLF_draw_default_ascii (float x, float y, float z, const char *str, size_t len) ATTR_NONNULL()
 
int BLF_set_default (void)
 
int BLF_load_default (const bool unique)
 
int BLF_load_mono_default (const bool unique)
 

Variables

int blf_mono_font
 
int blf_mono_font_render
 

Macro Definition Documentation

◆ BLF_ASPECT

#define BLF_ASPECT   (1 << 5)

Definition at line 274 of file BLF_api.h.

◆ BLF_BLUR_ENABLE

#define BLF_BLUR_ENABLE   0

Definition at line 34 of file BLF_api.h.

◆ BLF_BOLD

#define BLF_BOLD   (1 << 11)

Definition at line 280 of file BLF_api.h.

◆ BLF_CLIPPING

#define BLF_CLIPPING   (1 << 1)

Definition at line 270 of file BLF_api.h.

◆ BLF_DRAW_STR_DUMMY_MAX

#define BLF_DRAW_STR_DUMMY_MAX   1024

Definition at line 283 of file BLF_api.h.

◆ BLF_HINTING_FULL

#define BLF_HINTING_FULL   (1 << 10)

Definition at line 279 of file BLF_api.h.

◆ BLF_HINTING_NONE

#define BLF_HINTING_NONE   (1 << 8)

Definition at line 277 of file BLF_api.h.

◆ BLF_HINTING_SLIGHT

#define BLF_HINTING_SLIGHT   (1 << 9)

Definition at line 278 of file BLF_api.h.

◆ BLF_ITALIC

#define BLF_ITALIC   (1 << 12)

Definition at line 281 of file BLF_api.h.

◆ BLF_KERNING_DEFAULT

#define BLF_KERNING_DEFAULT   (1 << 3)

Definition at line 272 of file BLF_api.h.

◆ BLF_MATRIX

#define BLF_MATRIX   (1 << 4)

Definition at line 273 of file BLF_api.h.

◆ BLF_MONOCHROME

#define BLF_MONOCHROME   (1 << 7) /* no-AA */

Definition at line 276 of file BLF_api.h.

◆ BLF_ROTATION

#define BLF_ROTATION   (1 << 0)

Definition at line 269 of file BLF_api.h.

◆ BLF_SHADOW

#define BLF_SHADOW   (1 << 2)

Definition at line 271 of file BLF_api.h.

◆ BLF_WORD_WRAP

#define BLF_WORD_WRAP   (1 << 6)

Definition at line 275 of file BLF_api.h.

Typedef Documentation

◆ BLF_GlyphBoundsFn

typedef bool(* BLF_GlyphBoundsFn) (const char *str, const size_t str_step_ofs, const struct rcti *glyph_step_bounds, const int glyph_advance_x, const struct rctf *glyph_bounds, const int glyph_bearing[2], void *user_data)

Definition at line 107 of file BLF_api.h.

Function Documentation

◆ BLF_ascender()

float BLF_ascender ( int  fontid)

Definition at line 790 of file blf.c.

References blf_font_ascender(), and blf_get().

Referenced by node_draw_frame_label(), UI_fontstyle_draw_ex(), and UI_fontstyle_draw_rotated().

◆ BLF_aspect()

void BLF_aspect ( int  fontid,
float  x,
float  y,
float  z 
)

Definition at line 292 of file blf.c.

References FontBLF::aspect, blf_get(), x, y, and z.

Referenced by node_draw_frame_label(), playanim_toscreen(), and py_blf_aspect().

◆ BLF_batch_draw_begin()

void BLF_batch_draw_begin ( void  )

◆ BLF_batch_draw_end()

void BLF_batch_draw_end ( void  )

◆ BLF_batch_draw_flush()

void BLF_batch_draw_flush ( void  )

Definition at line 476 of file blf.c.

References blf_batch_draw(), BatchBLF::enabled, and g_batch.

Referenced by icon_draw_rect_input_symbol(), and icon_draw_rect_input_text().

◆ BLF_boundbox()

void BLF_boundbox ( int  fontid,
const char *  str,
size_t  len,
struct rctf box 
)

Definition at line 693 of file blf.c.

References BLF_boundbox_ex(), len, NULL, and str.

Referenced by file_draw_string_multiline().

◆ BLF_boundbox_ex()

void BLF_boundbox_ex ( int  fontid,
const char *  str,
size_t  len,
struct rctf box,
struct ResultBLF r_info 
)

◆ BLF_boundbox_foreach_glyph()

void BLF_boundbox_foreach_glyph ( int  fontid,
const char *  str,
size_t  len,
BLF_GlyphBoundsFn  user_fn,
void *  user_data 
)

Definition at line 630 of file blf.c.

References BLF_boundbox_foreach_glyph_ex(), len, NULL, str, and user_data.

Referenced by ui_textedit_set_cursor_pos(), and widget_draw_text().

◆ BLF_boundbox_foreach_glyph_ex()

void BLF_boundbox_foreach_glyph_ex ( int  fontid,
const char *  str,
size_t  len,
BLF_GlyphBoundsFn  user_fn,
void *  user_data,
struct ResultBLF r_info 
)

Run user_fn for each character, with the bound-box that would be used for drawing.

Parameters
user_fnCallback that runs on each glyph, returning false early exits.
user_dataUser argument passed to user_fn.
Note
The font position, clipping, matrix and rotation are not applied.

Definition at line 608 of file blf.c.

References blf_font_boundbox_foreach_glyph(), blf_get(), BLF_RESULT_CHECK_INIT, BLF_WORD_WRAP, BLI_assert, FontBLF::flags, len, str, and user_data.

Referenced by BLF_boundbox_foreach_glyph().

◆ BLF_buffer()

void BLF_buffer ( int  fontid,
float fbuf,
unsigned char *  cbuf,
int  w,
int  h,
int  nch,
struct ColorManagedDisplay display 
)

◆ BLF_buffer_col()

void BLF_buffer_col ( int  fontid,
const float  rgba[4] 
)

◆ BLF_cache_clear()

void BLF_cache_clear ( void  )

◆ BLF_clipping()

void BLF_clipping ( int  fontid,
float  xmin,
float  ymin,
float  xmax,
float  ymax 
)

◆ BLF_color3f()

void BLF_color3f ( int  fontid,
float  r,
float  g,
float  b 
)

Definition at line 464 of file blf.c.

References BLF_color4fv(), and r.

Referenced by voxel_size_edit_draw().

◆ BLF_color3fv_alpha()

void BLF_color3fv_alpha ( int  fontid,
const float  rgb[3],
float  alpha 
)

Definition at line 456 of file blf.c.

References alpha, BLF_color4fv(), and copy_v3_v3().

◆ BLF_color3ub()

void BLF_color3ub ( int  fontid,
unsigned char  r,
unsigned char  g,
unsigned char  b 
)

Definition at line 429 of file blf.c.

References blf_get(), FontBLF::color, and r.

Referenced by ED_image_draw_info().

◆ BLF_color3ubv()

void BLF_color3ubv ( int  fontid,
const unsigned char  rgb[3] 
)

◆ BLF_color3ubv_alpha()

void BLF_color3ubv_alpha ( int  fontid,
const unsigned char  rgb[3],
unsigned char  alpha 
)

Definition at line 399 of file blf.c.

References alpha, blf_get(), and FontBLF::color.

Referenced by BLF_color3ubv().

◆ BLF_color4f()

void BLF_color4f ( int  fontid,
float  r,
float  g,
float  b,
float  a 
)

Definition at line 450 of file blf.c.

References Freestyle::a, BLF_color4fv(), and r.

Referenced by playanim_toscreen().

◆ BLF_color4fv()

void BLF_color4fv ( int  fontid,
const float  rgba[4] 
)

◆ BLF_color4ub()

void BLF_color4ub ( int  fontid,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  alpha 
)

Definition at line 416 of file blf.c.

References alpha, blf_get(), FontBLF::color, and r.

Referenced by draw_udim_label().

◆ BLF_color4ubv()

void BLF_color4ubv ( int  fontid,
const unsigned char  rgba[4] 
)

◆ BLF_default()

int BLF_default ( void  )

◆ BLF_default_dpi()

void BLF_default_dpi ( int  dpi)

Definition at line 43 of file blf_default.c.

References global_font_dpi.

Referenced by BLF_init(), and WM_window_set_dpi().

◆ BLF_default_set()

void BLF_default_set ( int  fontid)

Definition at line 48 of file blf_default.c.

References blf_font_id_is_valid(), and global_font_default.

Referenced by BKE_blender_userdef_data_free(), and uiStyleInit().

◆ BLF_descender()

float BLF_descender ( int  fontid)

◆ BLF_dir_add()

void BLF_dir_add ( const char *  path)

◆ BLF_dir_free()

void BLF_dir_free ( char **  dirs,
int  count 
)

Definition at line 119 of file blf_dir.c.

References count, and MEM_freeN.

◆ BLF_dir_get()

char** BLF_dir_get ( int *  ndir)

◆ BLF_dir_rem()

void BLF_dir_rem ( const char *  path)

Definition at line 83 of file blf_dir.c.

References blf_dir_find(), BLI_remlink(), global_font_dir, MEM_freeN, and DirBLF::path.

◆ BLF_disable()

void BLF_disable ( int  fontid,
int  option 
)

◆ BLF_draw()

void BLF_draw ( int  fontid,
const char *  str,
size_t  len 
)

◆ BLF_draw_ascii()

void BLF_draw_ascii ( int  fontid,
const char *  str,
size_t  len 
)

◆ BLF_draw_ascii_ex()

void BLF_draw_ascii_ex ( int  fontid,
const char *  str,
size_t  len,
struct ResultBLF r_info 
)

◆ BLF_draw_buffer()

void BLF_draw_buffer ( int  fontid,
const char *  str,
size_t  len 
)

Definition at line 913 of file blf.c.

References BLF_draw_buffer_ex(), len, NULL, and str.

Referenced by BKE_image_stamp_buf(), checker_board_text(), and do_text_effect().

◆ BLF_draw_buffer_ex()

void BLF_draw_buffer_ex ( int  fontid,
const char *  str,
size_t  len,
struct ResultBLF r_info 
)

◆ BLF_draw_default()

void BLF_draw_default ( float  x,
float  y,
float  z,
const char *  str,
size_t  len 
)

◆ BLF_draw_default_ascii()

void BLF_draw_default_ascii ( float  x,
float  y,
float  z,
const char *  str,
size_t  len 
)

◆ BLF_draw_ex()

void BLF_draw_ex ( int  fontid,
const char *  str,
size_t  len,
struct ResultBLF r_info 
)

◆ BLF_draw_mono()

int BLF_draw_mono ( int  fontid,
const char *  str,
size_t  len,
int  cwidth 
)

◆ BLF_enable()

void BLF_enable ( int  fontid,
int  option 
)

◆ BLF_exit()

void BLF_exit ( void  )

Definition at line 92 of file blf.c.

References blf_font_exit(), blf_font_free(), BLF_MAX_FONT, global_font, and NULL.

Referenced by multitestapp_free(), WM_exit_ex(), and wm_main_playanim_intern().

◆ BLF_fixed_width()

float BLF_fixed_width ( int  fontid)

Definition at line 728 of file blf.c.

References blf_font_fixed_width(), and blf_get().

Referenced by textview_draw().

◆ BLF_has_glyph()

bool BLF_has_glyph ( int  fontid,
unsigned int  unicode 
)

Definition at line 144 of file blf.c.

References blf_get(), and FontBLF::face.

Referenced by key_event_glyph_or_text().

◆ BLF_height()

float BLF_height ( int  fontid,
const char *  str,
size_t  len 
)

◆ BLF_height_ex()

float BLF_height_ex ( int  fontid,
const char *  str,
size_t  len,
struct ResultBLF r_info 
)

Definition at line 739 of file blf.c.

References blf_font_height(), blf_get(), BLF_RESULT_CHECK_INIT, len, and str.

Referenced by BLF_height().

◆ BLF_height_max()

int BLF_height_max ( int  fontid)

◆ BLF_init()

int BLF_init ( void  )

Definition at line 81 of file blf.c.

References BLF_default_dpi(), blf_font_init(), BLF_MAX_FONT, global_font, and NULL.

Referenced by main(), WM_init(), and wm_main_playanim_intern().

◆ BLF_load()

int BLF_load ( const char *  name)

◆ BLF_load_default()

int BLF_load_default ( const bool  unique)

Definition at line 51 of file blf_font_default.c.

References blf_load_font_default().

Referenced by loggerwindow_new(), and uiStyleInit().

◆ BLF_load_mem()

int BLF_load_mem ( const char *  name,
const unsigned char *  mem,
int  mem_size 
)

Definition at line 205 of file blf.c.

References BLF_load_mem_unique(), and blf_search().

◆ BLF_load_mem_unique()

int BLF_load_mem_unique ( const char *  name,
const unsigned char *  mem,
int  mem_size 
)

Definition at line 215 of file blf.c.

References blf_font_new_from_mem(), blf_search_available(), global_font, and FontBLF::reference_count.

Referenced by BLF_load_mem().

◆ BLF_load_mono_default()

int BLF_load_mono_default ( const bool  unique)

Definition at line 56 of file blf_font_default.c.

References blf_load_font_default().

Referenced by uiStyleInit(), and wm_main_playanim_intern().

◆ BLF_load_unique()

int BLF_load_unique ( const char *  name)

◆ BLF_matrix()

void BLF_matrix ( int  fontid,
const float  m[16] 
)

Definition at line 303 of file blf.c.

References blf_get(), and FontBLF::m.

◆ BLF_metrics_attach()

void BLF_metrics_attach ( int  fontid,
unsigned char *  mem,
int  mem_size 
)

Definition at line 196 of file blf.c.

References blf_font_attach_from_mem(), and blf_get().

◆ BLF_position()

void BLF_position ( int  fontid,
float  x,
float  y,
float  z 
)

◆ BLF_rotation()

void BLF_rotation ( int  fontid,
float  angle 
)

◆ BLF_set_default()

int BLF_set_default ( void  )

◆ BLF_shadow()

void BLF_shadow ( int  fontid,
int  level,
const float  rgba[4] 
)

◆ BLF_shadow_offset()

void BLF_shadow_offset ( int  fontid,
int  x,
int  y 
)

◆ BLF_size()

void BLF_size ( int  fontid,
int  size,
int  dpi 
)

◆ BLF_thumb_preview()

void BLF_thumb_preview ( const char *  filename,
const char **  draw_str,
const char **  i18n_draw_str,
const unsigned char  draw_str_lines,
const float  font_color[4],
const int  font_size,
unsigned char *  buf,
int  w,
int  h,
int  channels 
)

◆ BLF_unload()

void BLF_unload ( const char *  name)

Definition at line 243 of file blf.c.

References blf_font_free(), BLF_MAX_FONT, BLI_assert, global_font, FontBLF::name, NULL, FontBLF::reference_count, and STREQ.

Referenced by py_blf_unload().

◆ BLF_unload_id()

void BLF_unload_id ( int  fontid)

◆ BLF_width()

float BLF_width ( int  fontid,
const char *  str,
size_t  len 
)

◆ BLF_width_and_height()

void BLF_width_and_height ( int  fontid,
const char *  str,
size_t  len,
float r_width,
float r_height 
)

◆ BLF_width_ex()

float BLF_width_ex ( int  fontid,
const char *  str,
size_t  len,
struct ResultBLF r_info 
)

Definition at line 710 of file blf.c.

References blf_font_width(), blf_get(), BLF_RESULT_CHECK_INIT, len, and str.

Referenced by BLF_width(), and ui_tooltip_create_with_data().

◆ BLF_width_max()

float BLF_width_max ( int  fontid)

Definition at line 768 of file blf.c.

References blf_font_width_max(), and blf_get().

Referenced by BKE_image_stamp_buf(), and do_text_effect().

◆ BLF_width_to_rstrlen()

size_t BLF_width_to_rstrlen ( int  fontid,
const char *  str,
size_t  len,
float  width,
float r_width 
)

◆ BLF_width_to_strlen()

size_t BLF_width_to_strlen ( int  fontid,
const char *  str,
size_t  len,
float  width,
float r_width 
)

◆ BLF_wordwrap()

void BLF_wordwrap ( int  fontid,
int  wrap_width 
)

Variable Documentation

◆ blf_mono_font

int blf_mono_font
extern

◆ blf_mono_font_render

int blf_mono_font_render
extern

Definition at line 71 of file blf.c.

Referenced by BKE_image_stamp_buf(), checker_board_text(), do_text_effect(), and uiStyleInit().