Blender V5.0
blf_font.cc File Reference
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ft2build.h>
#include "MEM_guardedalloc.h"
#include "DNA_vec_types.h"
#include "BLI_math_bits.h"
#include "BLI_math_color_blend.h"
#include "BLI_math_matrix.h"
#include "BLI_mutex.hh"
#include "BLI_path_utils.hh"
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_string_cursor_utf8.h"
#include "BLI_string_utf8.h"
#include "BLI_vector.hh"
#include "BLF_api.hh"
#include "GPU_batch.hh"
#include "GPU_matrix.hh"
#include "GPU_state.hh"
#include "blf_internal.hh"
#include "blf_internal_types.hh"
#include "BLI_strict_flags.h"

Go to the source code of this file.

Classes

struct  CursorPositionForeachGlyph_Data
struct  StrOffsetToGlyphBounds_Data
struct  FaceDetails

Functions

Font Query: Attributes
static ft_pix blf_font_height_max_ft_pix (FontBLF *font)
static ft_pix blf_font_width_max_ft_pix (FontBLF *font)
int blf_font_height_max (FontBLF *font)
int blf_font_width_max (FontBLF *font)
int blf_font_descender (FontBLF *font)
int blf_font_ascender (FontBLF *font)
bool blf_font_bounds_max (FontBLF *font, rctf *r_bounds)
char * blf_display_name (FontBLF *font)
FreeType Caching
static bool blf_setup_face (FontBLF *font)
static void blf_face_finalizer (void *object)
static FT_Error blf_cache_face_requester (FTC_FaceID faceID, FT_Library lib, FT_Pointer, FT_Face *face)
static void blf_size_finalizer (void *object)
FreeType Utilities (Internal)
uint blf_get_char_index (FontBLF *font, const uint charcode)
static ft_pix blf_unscaled_F26Dot6_to_pixels (FontBLF *font, const FT_Pos value)
Glyph Batching
static void blf_batch_draw_init ()
static void blf_batch_draw_exit ()
void blf_batch_draw_begin (FontBLF *font)
static blender::gpu::Textureblf_batch_cache_texture_load ()
void blf_batch_draw ()
static void blf_batch_draw_end ()
void BLF_batch_discard ()
Glyph Stepping Utilities (Internal)
BLI_INLINE ft_pix blf_kerning (FontBLF *font, const GlyphBLF *g_prev, const GlyphBLF *g)
BLI_INLINE GlyphBLFblf_glyph_from_utf8_and_step (FontBLF *font, GlyphCacheBLF *gc, const GlyphBLF *g_prev, const char *str, const size_t str_len, size_t *i_p, int32_t *pen_x)
UTF8 Utilities (Internal)
static int blf_str_is_utf8_valid_lazy_init (const char *str, const size_t str_len, int &is_utf8_valid)
Text Drawing: GPU
static void blf_font_draw_ex (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ResultBLF *r_info, const ft_pix pen_y)
void blf_font_draw (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
int blf_font_draw_mono (FontBLF *font, const char *str, const size_t str_len, const int cwidth, const int tab_columns)
void blf_draw_svg_icon (FontBLF *font, const uint icon_id, const float x, const float y, const float size, const float color[4], const float outline_alpha, const bool multicolor, blender::FunctionRef< void(std::string &)> edit_source_cb)
blender::Array< ucharblf_svg_icon_bitmap (FontBLF *font, const uint icon_id, const float size, int *r_width, int *r_height, const bool multicolor, blender::FunctionRef< void(std::string &)> edit_source_cb)
Text Drawing: Buffer
static void blf_glyph_draw_buffer (FontBufInfoBLF *buf_info, GlyphBLF *g, const ft_pix pen_x, const ft_pix pen_y_basis)
static void blf_font_draw_buffer_ex (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, const ft_pix pen_y, ResultBLF *r_info)
void blf_font_draw_buffer (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
Text Evaluation: Width to String Length

Use to implement exported functions:

static bool blf_font_width_to_strlen_glyph_process (FontBLF *font, GlyphCacheBLF *gc, const GlyphBLF *g_prev, GlyphBLF *g, ft_pix *pen_x, const int width_i)
size_t blf_font_width_to_strlen (FontBLF *font, const char *str, const size_t str_len, int width, int *r_width)
size_t blf_font_width_to_rstrlen (FontBLF *font, const char *str, const size_t str_len, int width, int *r_width)
Text Evaluation: Glyph Bound Box with Callback
static void blf_font_boundbox_ex (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info, ft_pix pen_y)
void blf_font_boundbox (FontBLF *font, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info)
void blf_font_width_and_height (FontBLF *font, const char *str, const size_t str_len, float *r_width, float *r_height, ResultBLF *r_info)
float blf_font_width (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
float blf_font_height (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
float blf_font_fixed_width (FontBLF *font)
int blf_font_glyph_advance (FontBLF *font, const char *str)
void blf_font_boundbox_foreach_glyph (FontBLF *font, const char *str, const size_t str_len, BLF_GlyphBoundsFn user_fn, void *user_data)
static bool blf_cursor_position_foreach_glyph (const char *, const size_t str_step_ofs, const rcti *bounds, void *user_data)
size_t blf_str_offset_from_cursor_position (FontBLF *font, const char *str, size_t str_len, int location_x)
static bool blf_str_offset_foreach_glyph (const char *, const size_t str_step_ofs, const rcti *bounds, void *user_data)
void blf_str_offset_to_glyph_bounds (FontBLF *font, const char *str, size_t str_offset, rcti *r_glyph_bounds)
int blf_str_offset_to_cursor (FontBLF *font, const char *str, const size_t str_len, const size_t str_offset, const int cursor_width)
blender::Vector< blender::Bounds< int > > blf_str_selection_boxes (FontBLF *font, const char *str, size_t str_len, size_t sel_start, size_t sel_length)
Text Evaluation: Word-Wrap with Callback
static void blf_font_wrap_apply (FontBLF *font, const char *str, const size_t str_len, const int max_pixel_width, BLFWrapMode mode, ResultBLF *r_info, void(*callback)(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *userdata), void *userdata)
static void blf_font_draw__wrap_cb (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *)
void blf_font_draw__wrap (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
static void blf_font_boundbox_wrap_cb (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *userdata)
void blf_font_boundbox__wrap (FontBLF *font, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info)
static void blf_font_draw_buffer__wrap_cb (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, const ft_pix pen_y, void *)
void blf_font_draw_buffer__wrap (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
static void blf_font_string_wrap_cb (FontBLF *, GlyphCacheBLF *, const char *str, const size_t str_len, const ft_pix, void *str_list_ptr)
blender::Vector< blender::StringRefblf_font_string_wrap (FontBLF *font, blender::StringRef str, int max_pixel_width, BLFWrapMode mode)
Font Subsystem Init/Exit
int blf_font_init ()
void blf_font_exit ()
void BLF_cache_flush_set_fn (void(*cache_flush_fn)())
Font Configure
void blf_ensure_size (FontBLF *font)
bool blf_font_size (FontBLF *font, float size)

Variables

BatchBLF g_batch
static FT_Library ft_lib = nullptr
static FTC_Manager ftc_manager = nullptr
static FTC_CMapCache ftc_charmap_cache = nullptr
static blender::Mutex ft_lib_mutex
static void(* blf_draw_cache_flush )() = nullptr

Font New/Free

static const FaceDetails static_face_details []
static void blf_font_fill (FontBLF *font)
static void blf_font_metrics (FT_Face face, FontMetrics *metrics)
bool blf_ensure_face (FontBLF *font)
static FontBLFblf_font_new_impl (const char *filepath, const char *mem_name, const uchar *mem, const size_t mem_size, void *ft_library)
FontBLFblf_font_new_from_filepath (const char *filepath)
FontBLFblf_font_new_from_mem (const char *mem_name, const uchar *mem, const size_t mem_size)
void blf_font_attach_from_mem (FontBLF *font, const uchar *mem, const size_t mem_size)
void blf_font_free (FontBLF *font)

Detailed Description

Deals with drawing text to OpenGL or bitmap buffers.

Also low level functions for managing FontBLF.

Definition in file blf_font.cc.

Function Documentation

◆ blf_batch_cache_texture_load()

◆ BLF_batch_discard()

void BLF_batch_discard ( )

◆ blf_batch_draw()

◆ blf_batch_draw_begin()

◆ blf_batch_draw_end()

void blf_batch_draw_end ( )
static

Definition at line 339 of file blf_font.cc.

References blf_batch_draw(), and g_batch.

Referenced by blf_draw_svg_icon(), blf_font_draw_ex(), and blf_font_draw_mono().

◆ blf_batch_draw_exit()

void blf_batch_draw_exit ( )
static

Definition at line 197 of file blf_font.cc.

References g_batch, GPU_BATCH_DISCARD_SAFE, and GPU_storagebuf_free().

Referenced by blf_font_exit().

◆ blf_batch_draw_init()

void blf_batch_draw_init ( )
static

Draw-calls are precious! make them count! Since most of the Text elements are not covered by other UI elements, we can group some strings together and render them in one draw-call. This behavior is on demand only, between BLF_batch_draw_begin() and BLF_batch_draw_end().

Definition at line 188 of file blf_font.cc.

References g_batch, GPU_batch_create_procedural(), GPU_PRIM_TRI_STRIP, GPU_storagebuf_create_ex(), and GPU_USAGE_STREAM.

Referenced by blf_batch_draw_begin().

◆ blf_cache_face_requester()

FT_Error blf_cache_face_requester ( FTC_FaceID faceID,
FT_Library lib,
FT_Pointer ,
FT_Face * face )
static

Called in response to #FTC_Manager_LookupFace. Now add a face to our font.

Note
Unused arguments are kept to match #FTC_Face_Requester function signature.

Definition at line 97 of file blf_font.cc.

References blf_face_finalizer(), blf_setup_face(), FontBLF::face, FontBLF::filepath, ft_lib_mutex, lib, lock, FontBLF::mem, and FontBLF::mem_size.

Referenced by blf_font_init().

◆ 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 1633 of file blf_font.cc.

References blf_draw_cache_flush.

Referenced by uiStyleInit().

◆ blf_cursor_position_foreach_glyph()

bool blf_cursor_position_foreach_glyph ( const char * ,
const size_t str_step_ofs,
const rcti * bounds,
void * user_data )
static

Definition at line 1112 of file blf_font.cc.

References bounds(), and data.

Referenced by blf_str_offset_from_cursor_position().

◆ blf_display_name()

char * blf_display_name ( FontBLF * font)

Definition at line 1587 of file blf_font.cc.

References blf_ensure_face(), BLI_sprintfN(), and FontBLF::face.

Referenced by BLF_display_name_from_id().

◆ blf_draw_svg_icon()

void blf_draw_svg_icon ( FontBLF * font,
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_ensure_face()

◆ blf_ensure_size()

◆ blf_face_finalizer()

void blf_face_finalizer ( void * object)
static

Called when a face is removed by the cache. FreeType will call #FT_Done_Face.

Definition at line 85 of file blf_font.cc.

References FontBLF::face.

Referenced by blf_cache_face_requester().

◆ blf_font_ascender()

int blf_font_ascender ( FontBLF * font)

Definition at line 1568 of file blf_font.cc.

References blf_ensure_size(), ft_pix_to_int(), and FontBLF::ft_size.

Referenced by BLF_ascender().

◆ blf_font_attach_from_mem()

void blf_font_attach_from_mem ( FontBLF * font,
const uchar * mem,
const size_t mem_size )

Definition at line 2102 of file blf_font.cc.

References blf_ensure_face(), and FontBLF::face.

Referenced by BLF_metrics_attach().

◆ blf_font_boundbox()

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

◆ blf_font_boundbox__wrap()

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

◆ blf_font_boundbox_ex()

◆ blf_font_boundbox_foreach_glyph()

◆ blf_font_boundbox_wrap_cb()

void blf_font_boundbox_wrap_cb ( FontBLF * font,
GlyphCacheBLF * gc,
const char * str,
const size_t str_len,
ft_pix pen_y,
void * userdata )
static

Utility for blf_font_boundbox__wrap.

Definition at line 1445 of file blf_font.cc.

References blf_font_boundbox_ex(), BLI_rcti_union(), and str.

Referenced by blf_font_boundbox__wrap().

◆ blf_font_bounds_max()

bool blf_font_bounds_max ( FontBLF * font,
rctf * r_bounds )

◆ blf_font_descender()

int blf_font_descender ( FontBLF * font)

Definition at line 1562 of file blf_font.cc.

References blf_ensure_size(), ft_pix_to_int(), and FontBLF::ft_size.

Referenced by BLF_descender().

◆ blf_font_draw()

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

Definition at line 487 of file blf_font.cc.

References blf_font_draw_ex(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), and str.

Referenced by BLF_draw().

◆ blf_font_draw__wrap()

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

◆ blf_font_draw__wrap_cb()

void blf_font_draw__wrap_cb ( FontBLF * font,
GlyphCacheBLF * gc,
const char * str,
const size_t str_len,
ft_pix pen_y,
void *  )
static

Utility for blf_font_draw__wrap.

Definition at line 1423 of file blf_font.cc.

References blf_font_draw_ex(), and str.

Referenced by blf_font_draw__wrap().

◆ blf_font_draw_buffer()

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

◆ blf_font_draw_buffer__wrap()

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

◆ blf_font_draw_buffer__wrap_cb()

void blf_font_draw_buffer__wrap_cb ( FontBLF * font,
GlyphCacheBLF * gc,
const char * str,
const size_t str_len,
const ft_pix pen_y,
void *  )
static

Utility for blf_font_draw_buffer__wrap.

Definition at line 1477 of file blf_font.cc.

References blf_font_draw_buffer_ex(), and str.

Referenced by blf_font_draw_buffer__wrap().

◆ blf_font_draw_buffer_ex()

void blf_font_draw_buffer_ex ( FontBLF * font,
GlyphCacheBLF * gc,
const char * str,
const size_t str_len,
const ft_pix pen_y,
ResultBLF * r_info )
static

◆ blf_font_draw_ex()

void blf_font_draw_ex ( FontBLF * font,
GlyphCacheBLF * gc,
const char * str,
const size_t str_len,
ResultBLF * r_info,
const ft_pix pen_y )
static

◆ blf_font_draw_mono()

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

◆ blf_font_exit()

void blf_font_exit ( )

Definition at line 1622 of file blf_font.cc.

References blf_batch_draw_exit(), ft_lib, and ftc_manager.

Referenced by BLF_exit().

◆ blf_font_fill()

◆ blf_font_fixed_width()

float blf_font_fixed_width ( FontBLF * font)

◆ blf_font_free()

◆ blf_font_glyph_advance()

int blf_font_glyph_advance ( FontBLF * font,
const char * str )

◆ blf_font_height()

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

◆ blf_font_height_max()

int blf_font_height_max ( FontBLF * font)

Definition at line 1545 of file blf_font.cc.

References blf_font_height_max_ft_pix(), and ft_pix_to_int().

Referenced by BLF_height_max().

◆ blf_font_height_max_ft_pix()

ft_pix blf_font_height_max_ft_pix ( FontBLF * font)
static

Definition at line 1538 of file blf_font.cc.

References blf_ensure_size(), ft_pix_from_int(), and FontBLF::ft_size.

Referenced by blf_font_height_max(), and blf_font_wrap_apply().

◆ blf_font_init()

int blf_font_init ( )

◆ blf_font_metrics()

◆ blf_font_new_from_filepath()

FontBLF * blf_font_new_from_filepath ( const char * filepath)

Definition at line 2092 of file blf_font.cc.

References blf_font_new_impl().

Referenced by BLF_load_unique().

◆ blf_font_new_from_mem()

FontBLF * blf_font_new_from_mem ( const char * mem_name,
const uchar * mem,
const size_t mem_size )

Definition at line 2097 of file blf_font.cc.

References blf_font_new_impl().

Referenced by BLF_load_mem_unique().

◆ blf_font_new_impl()

FontBLF * blf_font_new_impl ( const char * filepath,
const char * mem_name,
const uchar * mem,
const size_t mem_size,
void * ft_library )
static

Create a new font from filename OR memory pointer. For normal operation pass nullptr as FT_Library object. Pass a custom FT_Library if you want to use the font without its lifetime being managed by the FreeType cache subsystem.

Definition at line 2023 of file blf_font.cc.

References ARRAY_SIZE, BLF_CACHED, blf_ensure_face(), blf_font_fill(), blf_font_free(), BLF_LAST_RESORT, BLI_path_basename(), BLI_path_cmp, BLI_strdup(), FaceDetails::coverage1, FaceDetails::coverage2, FaceDetails::coverage3, FaceDetails::coverage4, FontBLF::face, FontBLF::filepath, FontBLF::flags, FontBLF::ft_lib, ft_lib, i, FontBLF::mem, FontBLF::mem_name, FontBLF::mem_size, static_face_details, and FontBLF::unicode_ranges.

Referenced by blf_font_new_from_filepath(), and blf_font_new_from_mem().

◆ blf_font_size()

bool blf_font_size ( FontBLF * font,
float size )

Change font's output size. Returns true if successful in changing the size.

Definition at line 2174 of file blf_font.cc.

References BLF_CACHED, BLF_DPI, blf_ensure_face(), blf_size_finalizer(), FontBLF::face, FontBLF::flags, float, FontBLF::ft_size, ftc_manager, round_fl_to_uint(), FontBLF::size, and size().

Referenced by blf_draw_svg_icon(), blf_glyph_render(), BLF_size(), and blf_svg_icon_bitmap().

◆ blf_font_string_wrap()

blender::Vector< blender::StringRef > blf_font_string_wrap ( FontBLF * font,
blender::StringRef str,
int max_pixel_width,
BLFWrapMode mode )

Definition at line 1515 of file blf_font.cc.

References blf_font_string_wrap_cb(), blf_font_wrap_apply(), and str.

Referenced by BLF_string_wrap().

◆ blf_font_string_wrap_cb()

void blf_font_string_wrap_cb ( FontBLF * ,
GlyphCacheBLF * ,
const char * str,
const size_t str_len,
const ft_pix ,
void * str_list_ptr )
static

◆ blf_font_width()

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

◆ blf_font_width_and_height()

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

◆ blf_font_width_max()

int blf_font_width_max ( FontBLF * font)

Definition at line 1557 of file blf_font.cc.

References blf_font_width_max_ft_pix(), and ft_pix_to_int().

Referenced by BLF_width_max().

◆ blf_font_width_max_ft_pix()

ft_pix blf_font_width_max_ft_pix ( FontBLF * font)
static

Definition at line 1550 of file blf_font.cc.

References blf_ensure_size(), ft_pix_from_int(), and FontBLF::ft_size.

Referenced by blf_font_width_max().

◆ blf_font_width_to_rstrlen()

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

◆ blf_font_width_to_strlen()

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

◆ blf_font_width_to_strlen_glyph_process()

bool blf_font_width_to_strlen_glyph_process ( FontBLF * font,
GlyphCacheBLF * gc,
const GlyphBLF * g_prev,
GlyphBLF * g,
ft_pix * pen_x,
const int width_i )
static

◆ blf_font_wrap_apply()

void blf_font_wrap_apply ( FontBLF * font,
const char * str,
const size_t str_len,
const int max_pixel_width,
BLFWrapMode mode,
ResultBLF * r_info,
void(* callback )(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *userdata),
void * userdata )
static

Generic function to add word-wrap support for other existing functions.

Wraps on spaces and respects newlines. Intentionally ignores non-unix newlines, tabs and more advanced text formatting.

Note
If we want rich text - we better have a higher level API to handle that (color, bold, switching fonts... etc).

Implementation Detail (UTF8).

Take care with single byte offsets here, since this is UTF8 we can't be sure a single byte is a single character.

This is only done when we know for sure the character is ASCII (newline or a space).

Definition at line 1259 of file blf_font.cc.

References GlyphBLF::advance_x, blf_font_height_max_ft_pix(), blf_glyph_cache_acquire(), blf_glyph_cache_release(), blf_glyph_from_utf8_and_step(), BLI_str_utf32_char_is_breaking_space(), BLI_str_utf32_char_is_optional_break_after(), BLI_str_utf32_char_is_optional_break_before(), BLI_str_utf8_as_unicode_safe(), BLI_str_utf8_from_unicode_len(), GlyphBLF::c, ELEM, ft_pix_from_int(), ft_pix_to_int(), HardLimit, i, ResultBLF::lines, Minimal, Path, printf, SEP, str, Typographical, UNLIKELY, ResultBLF::width, and wrap().

Referenced by blf_font_boundbox__wrap(), blf_font_draw__wrap(), blf_font_draw_buffer__wrap(), and blf_font_string_wrap().

◆ blf_get_char_index()

uint blf_get_char_index ( FontBLF * font,
uint charcode )

◆ blf_glyph_draw_buffer()

◆ blf_glyph_from_utf8_and_step()

◆ blf_kerning()

◆ blf_setup_face()

◆ blf_size_finalizer()

void blf_size_finalizer ( void * object)
static

Called when the FreeType cache is removing a font size.

Definition at line 135 of file blf_font.cc.

References FontBLF::ft_size, and size().

Referenced by blf_ensure_size(), and blf_font_size().

◆ blf_str_is_utf8_valid_lazy_init()

int blf_str_is_utf8_valid_lazy_init ( const char * str,
const size_t str_len,
int & is_utf8_valid )
static

Only assert on invalid UTF8 handling if the strings are valid UTF8.

Definition at line 436 of file blf_font.cc.

References BLI_str_utf8_invalid_byte(), and str.

Referenced by blf_font_width_to_rstrlen().

◆ blf_str_offset_foreach_glyph()

bool blf_str_offset_foreach_glyph ( const char * ,
const size_t str_step_ofs,
const rcti * bounds,
void * user_data )
static

Definition at line 1163 of file blf_font.cc.

References bounds(), and data.

Referenced by blf_str_offset_to_glyph_bounds().

◆ blf_str_offset_from_cursor_position()

size_t blf_str_offset_from_cursor_position ( FontBLF * font,
const char * str,
size_t str_len,
int location_x )

◆ blf_str_offset_to_cursor()

int blf_str_offset_to_cursor ( FontBLF * font,
const char * str,
const size_t str_len,
const size_t str_offset,
const int cursor_width )

◆ blf_str_offset_to_glyph_bounds()

void blf_str_offset_to_glyph_bounds ( FontBLF * font,
const char * str,
size_t str_offset,
rcti * r_glyph_bounds )

◆ blf_str_selection_boxes()

blender::Vector< blender::Bounds< int > > blf_str_selection_boxes ( FontBLF * font,
const char * str,
size_t str_len,
size_t sel_start,
size_t sel_length )

◆ blf_svg_icon_bitmap()

◆ blf_unscaled_F26Dot6_to_pixels()

ft_pix blf_unscaled_F26Dot6_to_pixels ( FontBLF * font,
const FT_Pos value )
static

Definition at line 159 of file blf_font.cc.

References blf_ensure_size(), FontBLF::ft_size, and scaled().

Referenced by blf_kerning().

Variable Documentation

◆ blf_draw_cache_flush

void(* blf_draw_cache_flush) () ( ) = nullptr
static

Definition at line 70 of file blf_font.cc.

Referenced by blf_batch_draw(), and BLF_cache_flush_set_fn().

◆ ft_lib

FT_Library ft_lib = nullptr
static

Definition at line 62 of file blf_font.cc.

Referenced by blf_font_exit(), blf_font_init(), blf_font_new_impl(), and BLF_thumb_preview().

◆ ft_lib_mutex

blender::Mutex ft_lib_mutex
static

Definition at line 67 of file blf_font.cc.

Referenced by blf_cache_face_requester(), blf_ensure_face(), and blf_font_free().

◆ ftc_charmap_cache

FTC_CMapCache ftc_charmap_cache = nullptr
static

Definition at line 64 of file blf_font.cc.

Referenced by blf_font_init(), and blf_get_char_index().

◆ ftc_manager

FTC_Manager ftc_manager = nullptr
static

◆ g_batch

◆ static_face_details

const FaceDetails static_face_details[]
static

Definition at line 1983 of file blf_font.cc.

Referenced by blf_font_new_impl().