Blender V4.3
BLF_api.hh File Reference
#include "BLI_array.hh"
#include "BLI_bounds_types.hh"
#include "BLI_compiler_attrs.h"
#include "BLI_function_ref.hh"
#include "BLI_string_ref.hh"
#include "BLI_sys_types.h"
#include "BLI_vector.hh"

Go to the source code of this file.

Classes

struct  ResultBLF
 

Macros

#define BLF_DATAFILES_FONTS_DIR   "fonts"
 
#define BLF_DEFAULT_PROPORTIONAL_FONT   "Inter.woff2"
 
#define BLF_DEFAULT_MONOSPACED_FONT   "DejaVuSansMono.woff2"
 
#define BLF_DRAW_STR_DUMMY_MAX   1024
 

Typedefs

typedef bool(* BLF_GlyphBoundsFn) (const char *str, size_t str_step_ofs, const rcti *bounds, void *user_data)
 

Enumerations

enum class  FontShadowType { None = 0 , Blur3x3 = 3 , Blur5x5 = 5 , Outline = 6 }
 
enum  {
  BLF_ROTATION = 1 << 0 , BLF_CLIPPING = 1 << 1 , BLF_SHADOW = 1 << 2 , BLF_ASPECT = 1 << 5 ,
  BLF_WORD_WRAP = 1 << 6 , BLF_MONOCHROME = 1 << 7 , BLF_HINTING_NONE = 1 << 8 , BLF_HINTING_SLIGHT = 1 << 9 ,
  BLF_HINTING_FULL = 1 << 10 , BLF_BOLD = 1 << 11 , BLF_ITALIC = 1 << 12 , BLF_MONOSPACED = 1 << 13 ,
  BLF_DEFAULT = 1 << 14 , BLF_LAST_RESORT = 1 << 15 , BLF_BAD_FONT = 1 << 16 , BLF_CACHED = 1 << 17 ,
  BLF_RENDER_SUBPIXELAA = 1 << 18
}
 

Functions

int BLF_init ()
 
void BLF_exit ()
 
void BLF_reset_fonts ()
 
void BLF_cache_clear ()
 
void BLF_cache_flush_set_fn (void(*cache_flush_fn)())
 
int BLF_load (const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
int BLF_load_mem (const char *name, const unsigned char *mem, int mem_size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
 
int bool BLF_is_loaded (const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
bool BLF_is_loaded_mem (const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
int BLF_load_unique (const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
int BLF_load_mem_unique (const char *name, const unsigned char *mem, int mem_size) ATTR_NONNULL(1
 
int void BLF_unload (const char *filepath) ATTR_NONNULL(1)
 
void BLF_unload_id (int fontid)
 
void BLF_unload_all ()
 
char * BLF_display_name_from_file (const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
char * BLF_display_name_from_id (int fontid)
 
bool BLF_get_vfont_metrics (int fontid, float *ascend_ratio, float *em_ratio, float *scale)
 
float BLF_character_to_curves (int fontid, unsigned int unicode, ListBase *nurbsbase, const float scale)
 
bool BLF_has_glyph (int fontid, unsigned int unicode) ATTR_WARN_UNUSED_RESULT
 
void BLF_metrics_attach (int fontid, const unsigned char *mem, int mem_size) ATTR_NONNULL(2)
 
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, float size)
 
void BLF_character_weight (int fontid, int weight)
 
int BLF_default_weight (int fontid) ATTR_WARN_UNUSED_RESULT
 
bool BLF_has_variable_weight (int fontid) ATTR_WARN_UNUSED_RESULT
 
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_batch_draw_begin ()
 
void BLF_batch_draw_flush ()
 
void BLF_batch_draw_end ()
 
void BLF_draw (int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
 
int BLF_draw_mono (int fontid, const char *str, size_t str_len, int cwidth, int tab_columns) ATTR_NONNULL(2)
 
void 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, blender::FunctionRef< void(std::string &)> edit_source_cb=nullptr)
 
blender::Array< ucharBLF_svg_icon_bitmap (uint icon_id, float size, int *r_width, int *r_height, bool multicolor=false, blender::FunctionRef< void(std::string &)> edit_source_cb=nullptr)
 
void BLF_boundbox_foreach_glyph (int fontid, const char *str, size_t str_len, BLF_GlyphBoundsFn user_fn, void *user_data) ATTR_NONNULL(2)
 
size_t 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 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 BLF_str_offset_to_cursor (int fontid, const char *str, size_t str_len, size_t str_offset, int cursor_width)
 
blender::Vector< blender::Bounds< int > > BLF_str_selection_boxes (int fontid, const char *str, size_t str_len, size_t sel_start, size_t sel_length)
 
size_t 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 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 BLF_boundbox (int fontid, const char *str, size_t str_len, rcti *r_box, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
 
float BLF_width (int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
 
float BLF_height (int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
 
int BLF_height_max (int fontid) ATTR_WARN_UNUSED_RESULT
 
int BLF_width_max (int fontid) ATTR_WARN_UNUSED_RESULT
 
int BLF_descender (int fontid) ATTR_WARN_UNUSED_RESULT
 
int BLF_ascender (int fontid) ATTR_WARN_UNUSED_RESULT
 
void BLF_width_and_height (int fontid, const char *str, size_t str_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, int xmin, int ymin, int xmax, int ymax)
 
void BLF_wordwrap (int fontid, int wrap_width)
 
blender::Vector< blender::StringRefBLF_string_wrap (int fontid, blender::StringRef str, const int max_pixel_width)
 
void BLF_enable (int fontid, int option)
 
void BLF_disable (int fontid, int option)
 
void BLF_shadow (int fontid, FontShadowType type, const float rgba[4]=nullptr)
 
void BLF_shadow_offset (int fontid, int x, int y)
 
void BLF_buffer (int fontid, float *fbuf, unsigned char *cbuf, int w, int h, ColorManagedDisplay *display)
 
void BLF_buffer_col (int fontid, const float rgba[4]) ATTR_NONNULL(2)
 
void BLF_draw_buffer (int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
 
bool BLF_thumb_preview (const char *filepath, unsigned char *buf, int w, int h, int channels) ATTR_NONNULL()
 
void BLF_default_size (float size)
 
void BLF_default_set (int fontid)
 
int BLF_default ()
 
void BLF_draw_default (float x, float y, float z, const char *str, size_t str_len) ATTR_NONNULL()
 
int BLF_set_default ()
 
int BLF_load_default (bool unique)
 
int BLF_load_mono_default (bool unique)
 
void BLF_load_font_stack ()
 
void BLF_state_print (int fontid)
 

Variables

int blf_mono_font
 
int blf_mono_font_render
 

Macro Definition Documentation

◆ BLF_DATAFILES_FONTS_DIR

#define BLF_DATAFILES_FONTS_DIR   "fonts"

Definition at line 20 of file BLF_api.hh.

Referenced by blf_load_datafiles_dir(), and blf_load_font_default().

◆ BLF_DEFAULT_MONOSPACED_FONT

#define BLF_DEFAULT_MONOSPACED_FONT   "DejaVuSansMono.woff2"

Definition at line 26 of file BLF_api.hh.

Referenced by BLF_load_mono_default().

◆ BLF_DEFAULT_PROPORTIONAL_FONT

#define BLF_DEFAULT_PROPORTIONAL_FONT   "Inter.woff2"

Definition at line 23 of file BLF_api.hh.

Referenced by BLF_load_default().

◆ BLF_DRAW_STR_DUMMY_MAX

Typedef Documentation

◆ BLF_GlyphBoundsFn

typedef bool(* BLF_GlyphBoundsFn) (const char *str, size_t str_step_ofs, const rcti *bounds, void *user_data)

Definition at line 167 of file BLF_api.hh.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

FontBLF.flags.

Enumerator
BLF_ROTATION 
BLF_CLIPPING 
BLF_SHADOW 
BLF_ASPECT 
BLF_WORD_WRAP 
BLF_MONOCHROME 

No anti-aliasing.

BLF_HINTING_NONE 
BLF_HINTING_SLIGHT 
BLF_HINTING_FULL 
BLF_BOLD 
BLF_ITALIC 
BLF_MONOSPACED 

Intended USE is monospaced, regardless of font type.

BLF_DEFAULT 

A font within the default stack of fonts.

BLF_LAST_RESORT 

Must only be used as last font in the stack.

BLF_BAD_FONT 

Failure to load this font. Don't try again.

BLF_CACHED 

This font is managed by the FreeType cache subsystem.

BLF_RENDER_SUBPIXELAA 

At small sizes glyphs are rendered at multiple sub-pixel positions.

Note
Can be checked without checking BLF_MONOSPACED which can be assumed to be disabled.

Definition at line 360 of file BLF_api.hh.

◆ FontShadowType

enum class FontShadowType
strong
Enumerator
None 
Blur3x3 
Blur5x5 
Outline 

Definition at line 33 of file BLF_api.hh.

Function Documentation

◆ BLF_ascender()

int BLF_ascender ( int fontid)

Definition at line 861 of file blf.cc.

References blf_font_ascender(), and blf_get().

Referenced by 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 360 of file blf.cc.

References blf_get(), x, y, and z().

Referenced by blender::ed::space_node::frame_node_draw_label(), playanim_toscreen_ex(), and py_blf_aspect().

◆ BLF_batch_draw_begin()

void BLF_batch_draw_begin ( )

Batch draw-calls together as long as the model-view matrix and the font remain unchanged.

Definition at line 517 of file blf.cc.

References BLI_assert, BatchBLF::enabled, and g_batch.

Referenced by draw_horizontal_scale_indicators(), draw_vertical_scale_indicators(), DRW_stats_draw(), file_draw_list(), UI_block_draw(), and view3d_draw_region_info().

◆ BLF_batch_draw_end()

◆ BLF_batch_draw_flush()

void BLF_batch_draw_flush ( )

Definition at line 523 of file blf.cc.

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

Referenced by ui_draw_but_WAVEFORM().

◆ BLF_boundbox()

void BLF_boundbox ( int fontid,
const char * str,
size_t str_len,
rcti * r_box,
ResultBLF * r_info = nullptr )

This function return the bounding box of the string and are not multiplied by the aspect.

Definition at line 761 of file blf.cc.

References blf_font_boundbox(), blf_font_boundbox__wrap(), blf_get(), BLF_RESULT_CHECK_INIT, BLF_WORD_WRAP, and str.

Referenced by do_text_effect(), file_draw_string_multiline(), icon_draw_rect_input_text(), and metadata_box_height_get().

◆ BLF_boundbox_foreach_glyph()

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

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 653 of file blf.cc.

References blf_font_boundbox_foreach_glyph(), blf_get(), BLF_WORD_WRAP, BLI_assert, and str.

◆ BLF_buffer()

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

Make font be rasterized into a given memory image/buffer. The image is assumed to have 4 color channels (RGBA) per pixel. When done, call this function with null buffer pointers.

Definition at line 924 of file blf.cc.

References blf_get(), and w().

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

◆ BLF_buffer_col()

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

Set the color to be used for text.

Definition at line 937 of file blf.cc.

References blf_get(), and copy_v4_v4().

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

◆ BLF_cache_clear()

void BLF_cache_clear ( )

◆ BLF_cache_flush_set_fn()

void BLF_cache_flush_set_fn ( void(* cache_flush_fn )())

Optional cache flushing function, called before blf_batch_draw.

Definition at line 1523 of file blf_font.cc.

References blf_draw_cache_flush.

Referenced by uiStyleInit().

◆ BLF_character_to_curves()

float BLF_character_to_curves ( int fontid,
unsigned int unicode,
ListBase * nurbsbase,
const float scale )

Convert a character's outlines into curves.

Definition at line 1062 of file blf.cc.

References blf_character_to_curves(), and blf_get().

Referenced by BKE_vfontdata_char_from_freetypefont().

◆ BLF_character_weight()

void BLF_character_weight ( int fontid,
int weight )

Weight class: 100 (Thin) - 400 (Normal) - 900 (Heavy).

Definition at line 330 of file blf.cc.

References blf_get().

Referenced by fontstyle_set_ex().

◆ BLF_clipping()

◆ BLF_color3f()

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

Definition at line 511 of file blf.cc.

References b, and BLF_color4fv().

Referenced by blender::ed::object::voxel_size_edit_draw().

◆ BLF_color3fv_alpha()

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

Definition at line 503 of file blf.cc.

References 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 476 of file blf.cc.

References b, and blf_get().

Referenced by ED_image_draw_info().

◆ BLF_color3ubv()

◆ BLF_color3ubv_alpha()

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

Definition at line 447 of file blf.cc.

References blf_get().

Referenced by BLF_color3ubv().

◆ BLF_color4f()

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

Definition at line 497 of file blf.cc.

References b, and BLF_color4fv().

Referenced by playanim_toscreen_ex(), ui_draw_but_WAVEFORM(), and vectorscope_draw_target().

◆ BLF_color4fv()

◆ BLF_color4ub()

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

Definition at line 464 of file blf.cc.

References b, and blf_get().

Referenced by ED_scene_draw_fps().

◆ BLF_color4ubv()

◆ BLF_default()

◆ BLF_default_set()

void BLF_default_set ( int fontid)

◆ BLF_default_size()

void BLF_default_size ( float size)

Definition at line 28 of file blf_default.cc.

References global_font_size, and size().

Referenced by drw_text_cache_draw_ex(), uiStyleInit(), and view3d_draw_region_info().

◆ BLF_default_weight()

int BLF_default_weight ( int fontid)

Definition at line 338 of file blf.cc.

References blf_get().

Referenced by UI_update_text_styles().

◆ BLF_descender()

◆ BLF_disable()

◆ BLF_display_name_from_file()

char * BLF_display_name_from_file ( const char * filepath)

Definition at line 989 of file blf.cc.

References BLI_sprintfN().

Referenced by fileentry_uiname().

◆ BLF_display_name_from_id()

char * BLF_display_name_from_id ( int fontid)

Definition at line 1009 of file blf.cc.

References blf_display_name(), and blf_get().

Referenced by BKE_vfontdata_from_freetypefont().

◆ BLF_draw()

◆ BLF_draw_buffer()

void BLF_draw_buffer ( int fontid,
const char * str,
size_t str_len,
ResultBLF * r_info = nullptr )

Draw the string into the buffer, this function draw in both buffer, float and unsigned char BUT it's not necessary set both buffer, NULL is valid here.

Definition at line 962 of file blf.cc.

References blf_draw_buffer__end(), blf_draw_buffer__start(), blf_font_draw_buffer(), blf_font_draw_buffer__wrap(), blf_get(), BLF_WORD_WRAP, and str.

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

◆ BLF_draw_default()

◆ BLF_draw_mono()

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

◆ BLF_draw_svg_icon()

void 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,
blender::FunctionRef< void(std::string &)> edit_source_cb = nullptr )

◆ BLF_enable()

◆ BLF_exit()

◆ BLF_fixed_width()

float BLF_fixed_width ( int fontid)

For fixed width fonts only, returns the width of a character.

Definition at line 804 of file blf.cc.

References blf_font_fixed_width(), and blf_get().

Referenced by textview_draw().

◆ BLF_get_vfont_metrics()

bool BLF_get_vfont_metrics ( int fontid,
float * ascend_ratio,
float * em_ratio,
float * scale )

Get the metrics needed for the initial sizing of text objects.

Definition at line 1019 of file blf.cc.

References blf_ensure_face(), blf_get(), and float.

Referenced by BKE_vfontdata_from_freetypefont().

◆ BLF_has_glyph()

bool BLF_has_glyph ( int fontid,
unsigned int unicode )

Check if font supports a particular glyph.

Definition at line 155 of file blf.cc.

References blf_get(), and blf_get_char_index().

Referenced by key_event_glyph_or_text().

◆ BLF_has_variable_weight()

bool BLF_has_variable_weight ( int fontid)

Definition at line 347 of file blf.cc.

References blf_get(), BLF_VARIATION_AXIS_WEIGHT, and int.

Referenced by UI_update_text_styles().

◆ BLF_height()

float BLF_height ( int fontid,
const char * str,
size_t str_len,
ResultBLF * r_info = nullptr )

◆ BLF_height_max()

◆ BLF_init()

int BLF_init ( )

◆ BLF_is_loaded()

int bool BLF_is_loaded ( const char * filepath)

Definition at line 164 of file blf.cc.

References blf_search_by_filepath().

Referenced by blf_load_datafiles_dir().

◆ BLF_is_loaded_mem()

bool BLF_is_loaded_mem ( const char * name)

Definition at line 169 of file blf.cc.

References blf_search_by_mem_name().

◆ BLF_load()

int BLF_load ( const char * filepath)

Loads a font, or returns an already loaded font and increments its reference count.

Definition at line 174 of file blf.cc.

References BLF_load_unique(), blf_search_by_filepath(), global_font, and FontBLF::reference_count.

Referenced by blf_load_datafiles_dir(), blf_load_font_default(), IMB_font_preview(), py_blf_load(), SEQ_effect_text_font_load(), and uiStyleInit().

◆ BLF_load_default()

int BLF_load_default ( bool unique)

◆ BLF_load_font_stack()

void BLF_load_font_stack ( )

Definition at line 93 of file blf_font_default.cc.

References blf_load_datafiles_dir(), BLF_load_default(), and BLF_load_mono_default().

Referenced by uiStyleInit().

◆ BLF_load_mem()

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

◆ BLF_load_mem_unique()

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

◆ BLF_load_mono_default()

int BLF_load_mono_default ( bool unique)

◆ BLF_load_unique()

int BLF_load_unique ( const char * filepath)

◆ BLF_metrics_attach()

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

Attach a file with metrics information from memory.

Definition at line 217 of file blf.cc.

References blf_font_attach_from_mem(), and blf_get().

◆ BLF_position()

◆ BLF_reset_fonts()

void BLF_reset_fonts ( )

Close any user-loaded fonts that are not used by the Interface. Call when loading new blend files so that the old fonts are not still taking resources.

Definition at line 84 of file blf.cc.

References BLF_DEFAULT, BLF_default(), blf_font_free(), BLF_MAX_FONT, blf_mono_font, blf_mono_font_render, ELEM, and global_font.

Referenced by WM_file_read(), and wm_homefile_read_exec().

◆ BLF_rotation()

void BLF_rotation ( int fontid,
float angle )

By default, rotation and clipping are disable and have to be enable/disable using BLF_enable/disable.

Definition at line 872 of file blf.cc.

References angle(), and blf_get().

Referenced by gizmo_ruler_draw(), knifetool_draw_angle(), knifetool_draw_visible_distances(), py_blf_rotation(), slider_draw(), UI_fontstyle_draw_rotated(), and UI_panel_category_draw_all().

◆ BLF_set_default()

◆ BLF_shadow()

void BLF_shadow ( int fontid,
FontShadowType type,
const float rgba[4] = nullptr )

◆ BLF_shadow_offset()

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

Set the offset for shadow text, this is the current cursor position plus this offset, don't need call BLF_position before this function, the current position is calculate only on BLF_draw, so it's safe call this whenever you like.

Definition at line 914 of file blf.cc.

References blf_get(), x, and y.

Referenced by draw_vertical_scale_indicators(), drw_text_cache_draw_ex(), py_blf_shadow_offset(), sequencer_preview_region_draw(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_rotated(), and view3d_draw_region_info().

◆ BLF_size()

◆ BLF_state_print()

void BLF_state_print ( int fontid)

Definition at line 1072 of file blf.cc.

References BLF_ASPECT, blf_get(), BLF_ROTATION, printf, and UNPACK3.

◆ BLF_str_offset_from_cursor_position()

size_t BLF_str_offset_from_cursor_position ( int fontid,
const char * str,
size_t str_len,
int location_x )

Get the byte offset within a string, selected by mouse at a horizontal location.

Definition at line 669 of file blf.cc.

References blf_get(), blf_str_offset_from_cursor_position(), and str.

Referenced by ui_textedit_set_cursor_pos().

◆ BLF_str_offset_to_cursor()

bool int BLF_str_offset_to_cursor ( int fontid,
const char * str,
size_t str_len,
size_t str_offset,
int cursor_width )

Return left edge of text cursor (caret), given a character offset and cursor width.

Definition at line 694 of file blf.cc.

References blf_get(), blf_str_offset_to_cursor(), and str.

Referenced by widget_draw_text().

◆ BLF_str_offset_to_glyph_bounds()

bool BLF_str_offset_to_glyph_bounds ( int fontid,
const char * str,
size_t str_offset,
rcti * r_glyph_bounds )

Return bounds of the glyph rect at the string offset.

Referenced by widget_draw_text().

◆ BLF_str_selection_boxes()

blender::Vector< blender::Bounds< int > > BLF_str_selection_boxes ( int fontid,
const char * str,
size_t str_len,
size_t sel_start,
size_t sel_length )

Return bounds of selection boxes. There is just one normally but there could be more for multi-line and when containing text of differing directions.

Definition at line 707 of file blf.cc.

References blf_get(), blf_str_selection_boxes(), and str.

Referenced by widget_draw_text().

◆ BLF_string_wrap()

blender::Vector< blender::StringRef > BLF_string_wrap ( int fontid,
blender::StringRef str,
const int max_pixel_width )

Definition at line 978 of file blf.cc.

References blf_font_string_wrap(), blf_get(), and str.

◆ BLF_svg_icon_bitmap()

blender::Array< uchar > BLF_svg_icon_bitmap ( uint icon_id,
float size,
int * r_width,
int * r_height,
bool multicolor = false,
blender::FunctionRef< void(std::string &)> edit_source_cb = nullptr )

Definition at line 635 of file blf.cc.

References blf_svg_icon_bitmap(), global_font, and UNUSED_VARS.

Referenced by UI_svg_icon_bitmap().

◆ BLF_thumb_preview()

bool BLF_thumb_preview ( const char * filepath,
unsigned char * buf,
int w,
int h,
int channels )

This function is used for generating thumbnail previews.

Note
called from a thread, so it bypasses the normal BLF_* api (which isn't thread-safe).

Definition at line 308 of file blf_thumbs.cc.

References blf_get_sample_text(), BLF_SAMPLE_LEN, float, ft_lib, ft_pix_to_int(), int, left, top, w(), and x.

Referenced by IMB_thumb_load_font().

◆ BLF_unload()

int void BLF_unload ( const char * filepath)

Definition at line 264 of file blf.cc.

References blf_font_free(), BLF_MAX_FONT, BLI_assert, BLI_path_cmp, and global_font.

Referenced by py_blf_unload().

◆ BLF_unload_all()

void BLF_unload_all ( )

Definition at line 298 of file blf.cc.

References BLF_default_set(), blf_font_free(), BLF_MAX_FONT, blf_mono_font, blf_mono_font_render, and global_font.

Referenced by uiStyleInit().

◆ BLF_unload_id()

◆ BLF_width()

◆ BLF_width_and_height()

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

◆ BLF_width_max()

int BLF_width_max ( int fontid)

Definition at line 839 of file blf.cc.

References blf_font_width_max(), and blf_get().

Referenced by BKE_image_stamp_buf().

◆ BLF_width_to_rstrlen()

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

Same as BLF_width_to_strlen but search from the string end.

Definition at line 739 of file blf.cc.

References BLF_ASPECT, blf_font_width_to_rstrlen(), blf_get(), float, ret, and str.

Referenced by UI_text_clip_middle_ex().

◆ BLF_width_to_strlen()

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

Get the string byte offset that fits within a given width.

Definition at line 717 of file blf.cc.

References BLF_ASPECT, blf_font_width_to_strlen(), blf_get(), float, ret, and str.

Referenced by UI_text_clip_middle_ex(), ui_text_clip_right_ex(), and ui_text_clip_right_label().

◆ BLF_wordwrap()

Variable Documentation

◆ blf_mono_font

◆ blf_mono_font_render

int blf_mono_font_render
extern