Blender  V3.3
Macros | Functions | Variables
blf.c File Reference
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ft2build.h>
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_threads.h"
#include "BLF_api.h"
#include "IMB_colormanagement.h"
#include "GPU_matrix.h"
#include "GPU_shader.h"
#include "blf_internal.h"
#include "blf_internal_types.h"

Go to the source code of this file.

Macros

#define BLF_RESULT_CHECK_INIT(r_info)
 

Functions

static FontBLFblf_get (int fontid)
 
int BLF_init (void)
 
void BLF_exit (void)
 
void BLF_cache_clear (void)
 
bool blf_font_id_is_valid (int fontid)
 
static int blf_search (const char *name)
 
static int blf_search_available (void)
 
bool BLF_has_glyph (int fontid, unsigned int unicode)
 
bool BLF_is_loaded (const char *name)
 
int BLF_load (const char *name)
 
int BLF_load_unique (const char *name)
 
void BLF_metrics_attach (int fontid, unsigned char *mem, int mem_size)
 
int BLF_load_mem (const char *name, const unsigned char *mem, int mem_size)
 
int BLF_load_mem_unique (const char *name, const unsigned char *mem, int mem_size)
 
void BLF_unload (const char *name)
 
void BLF_unload_id (int fontid)
 
void BLF_unload_all (void)
 
void BLF_enable (int fontid, int option)
 
void BLF_disable (int fontid, int option)
 
void BLF_aspect (int fontid, float x, float y, float z)
 
void BLF_matrix (int fontid, const float m[16])
 
void BLF_position (int fontid, float x, float y, float z)
 
void BLF_size (int fontid, float size, int dpi)
 
void BLF_color4ubv (int fontid, const unsigned char rgba[4])
 
void BLF_color3ubv_alpha (int fontid, const unsigned char rgb[3], unsigned char alpha)
 
void BLF_color3ubv (int fontid, const unsigned char rgb[3])
 
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_color4fv (int fontid, const float rgba[4])
 
void BLF_color4f (int fontid, float r, float g, float b, float a)
 
void BLF_color3fv_alpha (int fontid, const float rgb[3], float alpha)
 
void BLF_color3f (int fontid, float r, float g, float b)
 
void BLF_batch_draw_begin (void)
 
void BLF_batch_draw_flush (void)
 
void BLF_batch_draw_end (void)
 
static void blf_draw_gl__start (FontBLF *font)
 
static void blf_draw_gl__end (FontBLF *font)
 
void BLF_draw_ex (int fontid, const char *str, const size_t str_len, struct ResultBLF *r_info)
 
void BLF_draw (int fontid, const char *str, const size_t str_len)
 
int BLF_draw_mono (int fontid, const char *str, const size_t str_len, int cwidth)
 
void BLF_boundbox_foreach_glyph_ex (int fontid, const char *str, size_t str_len, BLF_GlyphBoundsFn user_fn, void *user_data, struct ResultBLF *r_info)
 
void BLF_boundbox_foreach_glyph (int fontid, const char *str, const size_t str_len, BLF_GlyphBoundsFn user_fn, void *user_data)
 
size_t BLF_width_to_strlen (int fontid, const char *str, const size_t str_len, float width, float *r_width)
 
size_t BLF_width_to_rstrlen (int fontid, const char *str, const size_t str_len, float width, float *r_width)
 
void BLF_boundbox_ex (int fontid, const char *str, const size_t str_len, rcti *r_box, struct ResultBLF *r_info)
 
void BLF_boundbox (int fontid, const char *str, const size_t str_len, rcti *r_box)
 
void BLF_width_and_height (int fontid, const char *str, const size_t str_len, float *r_width, float *r_height)
 
float BLF_width_ex (int fontid, const char *str, const size_t str_len, struct ResultBLF *r_info)
 
float BLF_width (int fontid, const char *str, const size_t str_len)
 
float BLF_fixed_width (int fontid)
 
float BLF_height_ex (int fontid, const char *str, const size_t str_len, struct ResultBLF *r_info)
 
float BLF_height (int fontid, const char *str, const size_t str_len)
 
int BLF_height_max (int fontid)
 
int BLF_width_max (int fontid)
 
int BLF_descender (int fontid)
 
int BLF_ascender (int fontid)
 
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)
 
void BLF_shadow (int fontid, int level, const float rgba[4])
 
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])
 
void blf_draw_buffer__start (FontBLF *font)
 
void blf_draw_buffer__end (void)
 
void BLF_draw_buffer_ex (int fontid, const char *str, const size_t str_len, struct ResultBLF *r_info)
 
void BLF_draw_buffer (int fontid, const char *str, const size_t str_len)
 
char * BLF_display_name_from_file (const char *filepath)
 

Variables

FontBLFglobal_font [BLF_MAX_FONT] = {NULL}
 
int blf_mono_font = -1
 
int blf_mono_font_render = -1
 

Detailed Description

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

Wraps OpenGL and FreeType.

Definition in file blf.c.

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)
SyclQueue void void size_t num_bytes void

Definition at line 37 of file blf.c.

Function Documentation

◆ BLF_ascender()

int BLF_ascender ( int  fontid)

◆ BLF_aspect()

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

Definition at line 288 of file blf.c.

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

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

◆ BLF_batch_draw_begin()

void BLF_batch_draw_begin ( void  )

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

Definition at line 466 of file blf.c.

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

void BLF_batch_draw_end ( void  )

◆ BLF_batch_draw_flush()

void BLF_batch_draw_flush ( void  )

Definition at line 472 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,
const size_t  str_len,
rcti r_box 
)

Definition at line 657 of file blf.c.

References BLF_boundbox_ex(), NULL, and str.

Referenced by file_draw_string_multiline().

◆ BLF_boundbox_ex()

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

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

Definition at line 640 of file blf.c.

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

Referenced by BLF_boundbox(), do_text_effect(), and metadata_box_height_get().

◆ BLF_boundbox_foreach_glyph()

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

Definition at line 590 of file blf.c.

References BLF_boundbox_foreach_glyph_ex(), 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  str_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 568 of file blf.c.

References blf_font_boundbox_foreach_glyph(), blf_get(), BLF_RESULT_CHECK_INIT, BLF_WORD_WRAP, BLI_assert, FontBLF::flags, 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 
)

Set the buffer, size and number of channels to draw, one thing to take care is call this function with NULL pointer when we finish, for example:

BLF_buffer(my_fbuf, my_cbuf, 100, 100, 4, true, NULL);
... set color, position and draw ...
BLF_buffer(NULL, NULL, NULL, 0, 0, false, NULL);
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, struct ColorManagedDisplay *display)
Definition: blf.c:816
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color

Definition at line 816 of file blf.c.

References blf_get(), FontBLF::buf_info, FontBufInfoBLF::cbuf, FontBufInfoBLF::ch, FontBufInfoBLF::dims, FontBufInfoBLF::display, FontBufInfoBLF::fbuf, and w().

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

◆ BLF_buffer_col()

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

Set the color to be used for text.

Definition at line 836 of file blf.c.

References blf_get(), FontBLF::buf_info, FontBufInfoBLF::col_init, copy_v4_v4(), and usdtokens::rgba().

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

◆ BLF_cache_clear()

void BLF_cache_clear ( void  )

◆ BLF_clipping()

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

◆ BLF_color3f()

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

Definition at line 460 of file blf.c.

References usdtokens::b(), BLF_color4fv(), usdtokens::g(), r, and usdtokens::rgba().

Referenced by voxel_size_edit_draw().

◆ BLF_color3fv_alpha()

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

Definition at line 452 of file blf.c.

References BLF_color4fv(), copy_v3_v3(), usdtokens::rgb(), and usdtokens::rgba().

◆ BLF_color3ub()

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

Definition at line 425 of file blf.c.

References usdtokens::b(), blf_get(), FontBLF::color, usdtokens::g(), 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 395 of file blf.c.

References blf_get(), FontBLF::color, and usdtokens::rgb().

Referenced by BLF_color3ubv().

◆ BLF_color4f()

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

Definition at line 446 of file blf.c.

References Freestyle::a, usdtokens::b(), BLF_color4fv(), usdtokens::g(), r, and usdtokens::rgba().

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 412 of file blf.c.

References usdtokens::b(), blf_get(), FontBLF::color, usdtokens::g(), and r.

◆ BLF_color4ubv()

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

◆ BLF_descender()

int BLF_descender ( int  fontid)

◆ BLF_disable()

void BLF_disable ( int  fontid,
int  option 
)

◆ BLF_display_name_from_file()

char* BLF_display_name_from_file ( const char *  filepath)

Definition at line 886 of file blf.c.

References blf_display_name(), blf_font_free(), blf_font_new(), and NULL.

Referenced by fileentry_uiname().

◆ BLF_draw()

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

◆ BLF_draw_buffer()

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

Definition at line 881 of file blf.c.

References BLF_draw_buffer_ex(), NULL, and str.

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

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

◆ BLF_draw_buffer_ex()

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

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 863 of file blf.c.

References blf_draw_buffer__end(), blf_draw_buffer__start(), blf_font_draw_buffer(), blf_font_draw_buffer__wrap(), blf_get(), BLF_WORD_WRAP, FontBLF::buf_info, FontBufInfoBLF::cbuf, FontBufInfoBLF::fbuf, FontBLF::flags, and str.

Referenced by BLF_draw_buffer().

◆ BLF_draw_ex()

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

◆ blf_draw_gl__end()

static void blf_draw_gl__end ( FontBLF font)
static

Definition at line 514 of file blf.c.

References BLF_ASPECT, BLF_MATRIX, BLF_ROTATION, FontBLF::flags, and GPU_matrix_pop().

Referenced by BLF_draw_ex(), and BLF_draw_mono().

◆ blf_draw_gl__start()

static void blf_draw_gl__start ( FontBLF font)
static

◆ BLF_draw_mono()

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

◆ BLF_enable()

void BLF_enable ( int  fontid,
int  option 
)

◆ BLF_exit()

void BLF_exit ( void  )

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

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

Definition at line 693 of file blf.c.

References blf_font_fixed_width(), and blf_get().

Referenced by textview_draw().

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

static FontBLF* blf_get ( int  fontid)
static

◆ BLF_has_glyph()

bool BLF_has_glyph ( int  fontid,
unsigned int  unicode 
)

Check if font supports a particular glyph.

Definition at line 121 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,
const size_t  str_len 
)

◆ BLF_height_ex()

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

Definition at line 704 of file blf.c.

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

Referenced by BLF_height().

◆ BLF_height_max()

int BLF_height_max ( int  fontid)

◆ BLF_init()

int BLF_init ( void  )

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

bool BLF_is_loaded ( const char *  name)

Definition at line 130 of file blf.c.

References blf_search().

Referenced by BLF_load_font_stack().

◆ BLF_load()

int BLF_load ( const char *  name)

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

Definition at line 135 of file blf.c.

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

Referenced by blf_load_font_default(), BLF_load_font_stack(), py_blf_load(), SEQ_effect_text_font_load(), and uiStyleInit().

◆ BLF_load_mem()

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

Definition at line 187 of file blf.c.

References BLF_load_mem_unique(), and blf_search().

Referenced by SEQ_effect_text_font_load().

◆ BLF_load_mem_unique()

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

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

int BLF_load_unique ( const char *  name)

◆ BLF_matrix()

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

Set a 4x4 matrix to be multiplied before draw the text. Remember that you need call BLF_enable(BLF_MATRIX) to enable this.

The order of the matrix is like GL:

| m[0] m[4] m[8] m[12] |
| m[1] m[5] m[9] m[13] |
| m[2] m[6] m[10] m[14] |
| m[3] m[7] m[11] m[15] |

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

Attach a file with metrics information from memory.

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

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

Definition at line 766 of file blf.c.

References angle(), FontBLF::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_search()

static int blf_search ( const char *  name)
static

Definition at line 98 of file blf.c.

References BLF_MAX_FONT, global_font, FontBLF::name, and STREQ.

Referenced by BLF_is_loaded(), BLF_load(), and BLF_load_mem().

◆ blf_search_available()

static int blf_search_available ( void  )
static

Definition at line 110 of file blf.c.

References BLF_MAX_FONT, and global_font.

Referenced by BLF_load_mem_unique(), and BLF_load_unique().

◆ BLF_shadow()

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

Shadow options, level is the blur level, can be 3, 5 or 0 and the other argument are the RGBA color. Take care that shadow need to be enable using BLF_enable!

Definition at line 796 of file blf.c.

References blf_get(), usdtokens::rgba(), rgba_float_to_uchar(), FontBLF::shadow, and FontBLF::shadow_color.

Referenced by draw_grid_unit_name(), draw_selected_name(), draw_vertical_scale_indicators(), draw_viewport_name(), DRW_draw_region_engine_info(), DRW_stats_draw(), ED_info_draw_stats(), ED_scene_draw_fps(), py_blf_shadow(), UI_fontstyle_draw_ex(), and UI_fontstyle_draw_rotated().

◆ 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 806 of file blf.c.

References blf_get(), FontBLF::shadow_x, FontBLF::shadow_y, x, and y.

Referenced by draw_grid_unit_name(), draw_selected_name(), draw_vertical_scale_indicators(), draw_viewport_name(), DRW_draw_region_engine_info(), DRW_stats_draw(), ED_info_draw_stats(), ED_scene_draw_fps(), py_blf_shadow_offset(), UI_fontstyle_draw_ex(), and UI_fontstyle_draw_rotated().

◆ BLF_size()

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

◆ BLF_unload()

void BLF_unload ( const char *  name)

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

void BLF_unload_all ( void  )

Definition at line 256 of file blf.c.

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

Referenced by uiStyleInit().

◆ BLF_unload_id()

void BLF_unload_id ( int  fontid)

◆ BLF_width()

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

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

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

The next both function return the width and height of the string, using the current font and both value are multiplied by the aspect of the font.

Definition at line 675 of file blf.c.

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

Referenced by BLF_width(), and ui_tooltip_create_with_data().

◆ BLF_width_max()

int BLF_width_max ( int  fontid)

Definition at line 733 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  str_len,
float  width,
float r_width 
)

Same as BLF_width_to_strlen but search from the string end.

Definition at line 618 of file blf.c.

References FontBLF::aspect, BLF_ASPECT, blf_font_width_to_rstrlen(), blf_get(), FontBLF::flags, float(), ret, str, and width.

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 596 of file blf.c.

References FontBLF::aspect, BLF_ASPECT, blf_font_width_to_strlen(), blf_get(), FontBLF::flags, float(), ret, str, and width.

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

◆ BLF_wordwrap()

void BLF_wordwrap ( int  fontid,
int  wrap_width 
)

Variable Documentation

◆ blf_mono_font

int blf_mono_font = -1

◆ blf_mono_font_render

int blf_mono_font_render = -1

◆ global_font

FontBLF* global_font[BLF_MAX_FONT] = {NULL}