Blender  V3.3
Macros | Functions | Variables
blf_internal.h File Reference

Go to the source code of this file.

Macros

#define BLF_MAX_FONT   32
 

Functions

void blf_batch_draw_begin (struct FontBLF *font)
 
void blf_batch_draw (void)
 
unsigned int blf_next_p2 (unsigned int x)
 
unsigned int blf_hash (unsigned int val)
 
char * blf_dir_search (const char *file)
 
char * blf_dir_metrics_search (const char *filepath)
 
int blf_font_init (void)
 
void blf_font_exit (void)
 
bool blf_font_id_is_valid (int fontid)
 
void blf_draw_buffer__start (struct FontBLF *font)
 
void blf_draw_buffer__end (void)
 
struct FontBLFblf_font_new (const char *name, const char *filepath)
 
struct FontBLFblf_font_new_from_mem (const char *name, const unsigned char *mem, int mem_size)
 
void blf_font_attach_from_mem (struct FontBLF *font, const unsigned char *mem, int mem_size)
 
bool blf_font_size (struct FontBLF *font, float size, unsigned int dpi)
 
void blf_font_draw (struct FontBLF *font, const char *str, size_t str_len, struct ResultBLF *r_info)
 
void blf_font_draw__wrap (struct FontBLF *font, const char *str, size_t str_len, struct ResultBLF *r_info)
 
int blf_font_draw_mono (struct FontBLF *font, const char *str, size_t str_len, int cwidth)
 
void blf_font_draw_buffer (struct FontBLF *font, const char *str, size_t str_len, struct ResultBLF *r_info)
 
void blf_font_draw_buffer__wrap (struct FontBLF *font, const char *str, size_t str_len, struct ResultBLF *r_info)
 
size_t blf_font_width_to_strlen (struct FontBLF *font, const char *str, size_t str_len, int width, int *r_width)
 
size_t blf_font_width_to_rstrlen (struct FontBLF *font, const char *str, size_t str_len, int width, int *r_width)
 
void blf_font_boundbox (struct FontBLF *font, const char *str, size_t str_len, struct rcti *r_box, struct ResultBLF *r_info)
 
void blf_font_boundbox__wrap (struct FontBLF *font, const char *str, size_t str_len, struct rcti *r_box, struct ResultBLF *r_info)
 
void blf_font_width_and_height (struct FontBLF *font, const char *str, size_t str_len, float *r_width, float *r_height, struct ResultBLF *r_info)
 
float blf_font_width (struct FontBLF *font, const char *str, size_t str_len, struct ResultBLF *r_info)
 
float blf_font_height (struct FontBLF *font, const char *str, size_t str_len, struct ResultBLF *r_info)
 
float blf_font_fixed_width (struct FontBLF *font)
 
int blf_font_height_max (struct FontBLF *font)
 
int blf_font_width_max (struct FontBLF *font)
 
int blf_font_descender (struct FontBLF *font)
 
int blf_font_ascender (struct FontBLF *font)
 
char * blf_display_name (struct FontBLF *font)
 
void blf_font_boundbox_foreach_glyph (struct FontBLF *font, const char *str, size_t str_len, bool(*user_fn)(const char *str, size_t str_step_ofs, const struct rcti *glyph_step_bounds, int glyph_advance_x, const struct rcti *glyph_bounds, const int glyph_bearing[2], void *user_data), void *user_data, struct ResultBLF *r_info)
 
int blf_font_count_missing_chars (struct FontBLF *font, const char *str, size_t str_len, int *r_tot_chars)
 
void blf_font_free (struct FontBLF *font)
 
struct GlyphCacheBLFblf_glyph_cache_acquire (struct FontBLF *font)
 
void blf_glyph_cache_release (struct FontBLF *font)
 
void blf_glyph_cache_clear (struct FontBLF *font)
 
struct GlyphBLFblf_glyph_ensure (struct FontBLF *font, struct GlyphCacheBLF *gc, uint charcode)
 
void blf_glyph_free (struct GlyphBLF *g)
 
void blf_glyph_draw (struct FontBLF *font, struct GlyphCacheBLF *gc, struct GlyphBLF *g, int x, int y)
 

Variables

struct FontBLFglobal_font [BLF_MAX_FONT]
 

Macro Definition Documentation

◆ BLF_MAX_FONT

#define BLF_MAX_FONT   32

Definition at line 19 of file blf_internal.h.

Function Documentation

◆ blf_batch_draw()

void blf_batch_draw ( void  )

◆ blf_batch_draw_begin()

void blf_batch_draw_begin ( struct FontBLF font)

◆ blf_dir_metrics_search()

char* blf_dir_metrics_search ( const char *  filepath)

Some font have additional file with metrics information, in general, the extension of the file is: .afm or .pfm

Definition at line 135 of file blf_dir.c.

References BLI_exists(), BLI_strdup(), BLI_strnlen(), MEM_freeN, and NULL.

Referenced by blf_font_new().

◆ blf_dir_search()

char* blf_dir_search ( const char *  file)

◆ blf_display_name()

char* blf_display_name ( struct 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().

◆ blf_draw_buffer__end()

void blf_draw_buffer__end ( void  )

Definition at line 859 of file blf.c.

Referenced by BLF_draw_buffer_ex(), and BLF_thumb_preview().

◆ blf_draw_buffer__start()

void blf_draw_buffer__start ( struct FontBLF font)

◆ blf_font_ascender()

int blf_font_ascender ( struct 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().

◆ blf_font_attach_from_mem()

void blf_font_attach_from_mem ( struct FontBLF font,
const unsigned char *  mem,
int  mem_size 
)

Definition at line 1329 of file blf_font.c.

References FontBLF::face.

Referenced by BLF_metrics_attach().

◆ blf_font_boundbox()

void blf_font_boundbox ( struct FontBLF font,
const char *  str,
size_t  str_len,
struct rcti r_box,
struct ResultBLF r_info 
)

◆ blf_font_boundbox__wrap()

void blf_font_boundbox__wrap ( struct FontBLF font,
const char *  str,
size_t  str_len,
struct rcti r_box,
struct ResultBLF r_info 
)

◆ blf_font_boundbox_foreach_glyph()

void blf_font_boundbox_foreach_glyph ( struct FontBLF font,
const char *  str,
size_t  str_len,
bool(*)(const char *str, size_t str_step_ofs, const struct rcti *glyph_step_bounds, int glyph_advance_x, const struct rcti *glyph_bounds, const int glyph_bearing[2], void *user_data user_fn,
void user_data,
struct ResultBLF r_info 
)

◆ blf_font_count_missing_chars()

int blf_font_count_missing_chars ( struct FontBLF font,
const char *  str,
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().

◆ blf_font_descender()

int blf_font_descender ( struct FontBLF font)

Definition at line 1148 of file blf_font.c.

References FontBLF::face, and ft_pix_to_int().

Referenced by BLF_descender().

◆ blf_font_draw()

void blf_font_draw ( struct FontBLF font,
const char *  str,
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().

◆ blf_font_draw__wrap()

void blf_font_draw__wrap ( struct FontBLF font,
const char *  str,
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().

◆ blf_font_draw_buffer()

void blf_font_draw_buffer ( struct FontBLF font,
const char *  str,
size_t  str_len,
struct ResultBLF r_info 
)

◆ blf_font_draw_buffer__wrap()

void blf_font_draw_buffer__wrap ( struct FontBLF font,
const char *  str,
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().

◆ blf_font_draw_mono()

int blf_font_draw_mono ( struct FontBLF font,
const char *  str,
size_t  str_len,
int  cwidth 
)

◆ blf_font_exit()

void blf_font_exit ( void  )

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().

◆ blf_font_fixed_width()

float blf_font_fixed_width ( struct FontBLF font)

◆ blf_font_free()

void blf_font_free ( struct FontBLF font)

◆ blf_font_height()

float blf_font_height ( struct FontBLF font,
const char *  str,
size_t  str_len,
struct ResultBLF r_info 
)

◆ blf_font_height_max()

int blf_font_height_max ( struct 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().

◆ blf_font_id_is_valid()

bool blf_font_id_is_valid ( int  fontid)

Definition at line 93 of file blf.c.

References blf_get(), and NULL.

Referenced by BLF_default_set().

◆ blf_font_init()

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().

◆ blf_font_new()

struct FontBLF* blf_font_new ( const char *  name,
const char *  filepath 
)

◆ blf_font_new_from_mem()

struct FontBLF* blf_font_new_from_mem ( const char *  name,
const unsigned char *  mem,
int  mem_size 
)

◆ blf_font_size()

bool blf_font_size ( struct FontBLF font,
float  size,
unsigned int  dpi 
)

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().

◆ blf_font_width()

float blf_font_width ( struct FontBLF font,
const char *  str,
size_t  str_len,
struct ResultBLF r_info 
)

◆ blf_font_width_and_height()

void blf_font_width_and_height ( struct FontBLF font,
const char *  str,
size_t  str_len,
float r_width,
float r_height,
struct ResultBLF r_info 
)

◆ blf_font_width_max()

int blf_font_width_max ( struct 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().

◆ blf_font_width_to_rstrlen()

size_t blf_font_width_to_rstrlen ( struct FontBLF font,
const char *  str,
size_t  str_len,
int  width,
int *  r_width 
)

◆ blf_font_width_to_strlen()

size_t blf_font_width_to_strlen ( struct FontBLF font,
const char *  str,
size_t  str_len,
int  width,
int *  r_width 
)

◆ blf_glyph_cache_acquire()

struct GlyphCacheBLF* blf_glyph_cache_acquire ( struct FontBLF font)

◆ blf_glyph_cache_clear()

void blf_glyph_cache_clear ( struct FontBLF font)

◆ blf_glyph_cache_release()

void blf_glyph_cache_release ( struct FontBLF font)

◆ blf_glyph_draw()

void blf_glyph_draw ( struct FontBLF font,
struct GlyphCacheBLF gc,
struct GlyphBLF g,
int  x,
int  y 
)

◆ blf_glyph_ensure()

struct GlyphBLF* blf_glyph_ensure ( struct FontBLF font,
struct GlyphCacheBLF gc,
uint  charcode 
)

◆ blf_glyph_free()

void blf_glyph_free ( struct GlyphBLF g)

Definition at line 1005 of file blf_glyph.c.

References usdtokens::g(), and MEM_freeN.

Referenced by blf_glyph_cache_free().

◆ blf_hash()

unsigned int blf_hash ( unsigned int  val)

Definition at line 30 of file blf_util.c.

Referenced by blf_glyph_cache_add_glyph(), and blf_glyph_cache_find_glyph().

◆ blf_next_p2()

unsigned int blf_next_p2 ( unsigned int  x)

Definition at line 18 of file blf_util.c.

References x.

Variable Documentation

◆ global_font

struct FontBLF* global_font[BLF_MAX_FONT]
extern