Blender  V2.93
Functions
blf_internal.h File Reference

Go to the source code of this file.

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 *filename)
 
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 *filename)
 
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)
 
void blf_font_size (struct FontBLF *font, unsigned int size, unsigned int dpi)
 
void blf_font_draw (struct FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info)
 
void blf_font_draw__wrap (struct FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info)
 
void blf_font_draw_ascii (struct FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info)
 
int blf_font_draw_mono (struct FontBLF *font, const char *str, size_t len, int cwidth)
 
void blf_font_draw_buffer (struct FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info)
 
void blf_font_draw_buffer__wrap (struct FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info)
 
size_t blf_font_width_to_strlen (struct FontBLF *font, const char *str, size_t len, float width, float *r_width)
 
size_t blf_font_width_to_rstrlen (struct FontBLF *font, const char *str, size_t len, float width, float *r_width)
 
void blf_font_boundbox (struct FontBLF *font, const char *str, size_t len, struct rctf *r_box, struct ResultBLF *r_info)
 
void blf_font_boundbox__wrap (struct FontBLF *font, const char *str, size_t len, struct rctf *r_box, struct ResultBLF *r_info)
 
void blf_font_width_and_height (struct FontBLF *font, const char *str, size_t len, float *r_width, float *r_height, struct ResultBLF *r_info)
 
float blf_font_width (struct FontBLF *font, const char *str, size_t len, struct ResultBLF *r_info)
 
float blf_font_height (struct FontBLF *font, const char *str, size_t 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)
 
float blf_font_descender (struct FontBLF *font)
 
float blf_font_ascender (struct FontBLF *font)
 
void blf_font_boundbox_foreach_glyph (struct FontBLF *font, const char *str, size_t len, bool(*user_fn)(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), void *user_data, struct ResultBLF *r_info)
 
int blf_font_count_missing_chars (struct FontBLF *font, const char *str, const size_t len, int *r_tot_chars)
 
void blf_font_free (struct FontBLF *font)
 
struct KerningCacheBLFblf_kerning_cache_find (struct FontBLF *font)
 
struct KerningCacheBLFblf_kerning_cache_new (struct FontBLF *font, struct GlyphCacheBLF *gc)
 
void blf_kerning_cache_clear (struct FontBLF *font)
 
struct GlyphCacheBLFblf_glyph_cache_find (struct FontBLF *font, unsigned int size, unsigned int dpi)
 
struct GlyphCacheBLFblf_glyph_cache_new (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)
 
void blf_glyph_cache_free (struct GlyphCacheBLF *gc)
 
struct GlyphBLFblf_glyph_search (struct GlyphCacheBLF *gc, unsigned int c)
 
struct GlyphBLFblf_glyph_add (struct FontBLF *font, struct GlyphCacheBLF *gc, unsigned int index, unsigned int c)
 
void blf_glyph_free (struct GlyphBLF *g)
 
void blf_glyph_render (struct FontBLF *font, struct GlyphCacheBLF *gc, struct GlyphBLF *g, float x, float y)
 

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 *  filename)

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

Definition at line 158 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_draw_buffer__end()

void blf_draw_buffer__end ( void  )

Definition at line 894 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()

float blf_font_ascender ( struct FontBLF font)

◆ blf_font_attach_from_mem()

void blf_font_attach_from_mem ( struct 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().

◆ blf_font_boundbox()

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

◆ blf_font_boundbox__wrap()

void blf_font_boundbox__wrap ( struct FontBLF font,
const char *  str,
size_t  len,
struct rctf 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  len,
bool(*)(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 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,
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().

◆ blf_font_descender()

float blf_font_descender ( struct FontBLF font)

◆ blf_font_draw()

void blf_font_draw ( struct FontBLF font,
const char *  str,
size_t  len,
struct ResultBLF r_info 
)

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

◆ blf_font_draw__wrap()

void blf_font_draw__wrap ( struct 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().

◆ blf_font_draw_ascii()

void blf_font_draw_ascii ( struct 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().

◆ blf_font_draw_buffer()

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

◆ blf_font_draw_buffer__wrap()

void blf_font_draw_buffer__wrap ( struct 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().

◆ blf_font_draw_mono()

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

◆ blf_font_exit()

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

◆ 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  len,
struct ResultBLF r_info 
)

◆ blf_font_height_max()

int blf_font_height_max ( struct FontBLF font)

◆ blf_font_id_is_valid()

bool blf_font_id_is_valid ( int  fontid)

Definition at line 116 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 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().

◆ blf_font_new()

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

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

void blf_font_size ( struct FontBLF font,
unsigned int  size,
unsigned int  dpi 
)

◆ blf_font_width()

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

◆ blf_font_width_and_height()

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

◆ blf_font_width_max()

int blf_font_width_max ( struct FontBLF font)

◆ blf_font_width_to_rstrlen()

size_t blf_font_width_to_rstrlen ( struct FontBLF font,
const char *  str,
size_t  len,
float  width,
float r_width 
)

◆ blf_font_width_to_strlen()

size_t blf_font_width_to_strlen ( struct FontBLF font,
const char *  str,
size_t  len,
float  width,
float r_width 
)

◆ blf_glyph_add()

struct GlyphBLF* blf_glyph_add ( struct FontBLF font,
struct GlyphCacheBLF gc,
unsigned int  index,
unsigned int  c 
)

◆ 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_find()

struct GlyphCacheBLF* blf_glyph_cache_find ( struct FontBLF font,
unsigned int  size,
unsigned int  dpi 
)

◆ blf_glyph_cache_free()

void blf_glyph_cache_free ( struct GlyphCacheBLF gc)

◆ blf_glyph_cache_new()

struct GlyphCacheBLF* blf_glyph_cache_new ( struct FontBLF font)

◆ blf_glyph_cache_release()

void blf_glyph_cache_release ( struct FontBLF font)

◆ blf_glyph_free()

void blf_glyph_free ( struct GlyphBLF g)

Definition at line 392 of file blf_glyph.c.

References GlyphBLF::bitmap, and MEM_freeN.

Referenced by blf_glyph_cache_free().

◆ blf_glyph_render()

void blf_glyph_render ( struct FontBLF font,
struct GlyphCacheBLF gc,
struct GlyphBLF g,
float  x,
float  y 
)

◆ blf_glyph_search()

struct GlyphBLF* blf_glyph_search ( struct GlyphCacheBLF gc,
unsigned int  c 
)

◆ blf_hash()

unsigned int blf_hash ( unsigned int  val)

Definition at line 46 of file blf_util.c.

Referenced by blf_glyph_add(), and blf_glyph_search().

◆ blf_kerning_cache_clear()

void blf_kerning_cache_clear ( struct FontBLF font)

Definition at line 110 of file blf_glyph.c.

References BLI_freelistN(), FontBLF::kerning_cache, FontBLF::kerning_caches, and NULL.

Referenced by BLF_cache_clear(), and blf_font_free().

◆ blf_kerning_cache_find()

struct KerningCacheBLF* blf_kerning_cache_find ( struct FontBLF font)

◆ blf_kerning_cache_new()

struct KerningCacheBLF* blf_kerning_cache_new ( struct FontBLF font,
struct GlyphCacheBLF gc 
)

◆ blf_next_p2()

unsigned int blf_next_p2 ( unsigned int  x)

Definition at line 34 of file blf_util.c.

References x.