Blender V5.3
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.hh"
#include "BLI_math_color_blend.hh"
#include "BLI_math_matrix_c.hh"
#include "BLI_mutex.hh"
#include "BLI_path_utils.hh"
#include "BLI_rect.hh"
#include "BLI_string.hh"
#include "BLI_string_cursor_utf8.hh"
#include "BLI_string_utf8.hh"
#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.hh"

Go to the source code of this file.

Classes

struct  blender::GlyphStepData
struct  blender::CursorPositionForeachGlyph_Data
struct  blender::StrOffsetToGlyphBounds_Data
struct  blender::FaceDetails

Namespaces

namespace  blender
 BMesh Iterators.

Functions

Font Query: Attributes
static ft_pix blender::blf_font_height_max_ft_pix (FontBLF *font)
static ft_pix blender::blf_font_width_max_ft_pix (FontBLF *font)
int blender::blf_font_height_max (FontBLF *font)
int blender::blf_font_width_max (FontBLF *font)
int blender::blf_font_descender (FontBLF *font)
int blender::blf_font_ascender (FontBLF *font)
bool blender::blf_font_bounds_max (FontBLF *font, rctf *r_bounds)
char * blender::blf_display_name (FontBLF *font)
FreeType Caching
static bool blender::blf_setup_face (FontBLF *font)
static void blender::blf_face_finalizer (void *object)
static FT_Error blender::blf_cache_face_requester (FTC_FaceID faceID, FT_Library lib, FT_Pointer, FT_Face *face)
static void blender::blf_size_finalizer (void *object)
FreeType Utilities (Internal)
uint blender::blf_get_char_index (FontBLF *font, const uint charcode)
static ft_pix blender::blf_unscaled_F26Dot6_to_pixels (FontBLF *font, const FT_Pos value)
Glyph Batching
static void blender::blf_batch_draw_init ()
static void blender::blf_batch_draw_exit ()
void blender::blf_batch_draw_begin (FontBLF *font)
static gpu::Texture * blender::blf_batch_cache_texture_load ()
void blender::blf_batch_draw ()
static void blender::blf_batch_draw_end ()
void blender::BLF_batch_discard ()
Glyph Stepping Utilities (Internal)
BLI_INLINE ft_pix blender::blf_kerning (FontBLF *font, const GlyphBLF *g_prev, const GlyphBLF *g)
BLI_INLINE GlyphBLF * blender::blf_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)
BLI_INLINE bool blender::blf_glyph_is_combining (const GlyphBLF *g)
BLI_INLINE bool blender::blf_glyph_step (FontBLF *font, GlyphCacheBLF *gc, GlyphStepData &step, const char *str, const size_t str_len)
BLI_INLINE void blender::blf_glyph_step_reset_for_newline (GlyphStepData &step)
UTF8 Utilities (Internal)
static int blender::blf_str_is_utf8_valid_lazy_init (const char *str, const size_t str_len, int &is_utf8_valid)
Text Drawing: GPU
static void blender::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 blender::blf_font_draw (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
int blender::blf_font_draw_mono (FontBLF *font, const char *str, const size_t str_len, const int char_width, const int tab_columns)
void blender::blf_draw_svg_icon (FontBLF *font, const uint icon_id, const float size, const float color[4], const float outline_alpha, const bool multicolor, FunctionRef< void(std::string &)> edit_source_cb)
Array< uchar > blender::blf_svg_icon_bitmap (FontBLF *font, const uint icon_id, const float size, int *r_width, int *r_height, const bool multicolor, FunctionRef< void(std::string &)> edit_source_cb)
Text Drawing: Buffer
static void blender::blf_glyph_draw_buffer (FontBufInfoBLF *buf_info, GlyphBLF *g, const ft_pix pen_x, const ft_pix pen_y_basis)
static void blender::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 blender::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 blender::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 blender::blf_font_width_to_strlen (FontBLF *font, const char *str, const size_t str_len, int width, int *r_width)
size_t blender::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 blender::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 blender::blf_font_boundbox (FontBLF *font, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info)
void blender::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 blender::blf_font_width (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
float blender::blf_font_height (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
float blender::blf_font_fixed_width (FontBLF *font)
int blender::blf_font_glyph_advance (FontBLF *font, const char *str)
void blender::blf_font_boundbox_foreach_glyph (FontBLF *font, const char *str, const size_t str_len, BLF_GlyphBoundsFn user_fn, void *user_data)
void blender::blf_font_info_foreach_glyph (FontBLF *font, const char *str, size_t str_len, FunctionRef< void(int index, size_t byte_offset, int byte_len, int advance_x)> callback)
static bool blender::blf_cursor_position_foreach_glyph (const char *, const size_t str_step_ofs, const rcti *bounds, void *user_data)
size_t blender::blf_str_offset_from_cursor_position (FontBLF *font, const char *str, size_t str_len, int location_x)
static bool blender::blf_str_offset_foreach_glyph (const char *, const size_t str_step_ofs, const rcti *bounds, void *user_data)
void blender::blf_str_offset_to_glyph_bounds (FontBLF *font, const char *str, size_t str_offset, rcti *r_glyph_bounds)
int blender::blf_str_offset_to_cursor (FontBLF *font, const char *str, const size_t str_len, const size_t str_offset, const int cursor_width)
Vector< Bounds< int > > blender::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 blender::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 blender::blf_font_draw__wrap_cb (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *)
void blender::blf_font_draw__wrap (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
static void blender::blf_font_boundbox_wrap_cb (FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *userdata)
void blender::blf_font_boundbox__wrap (FontBLF *font, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info)
static void blender::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 blender::blf_font_draw_buffer__wrap (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
static void blender::blf_font_string_wrap_cb (FontBLF *, GlyphCacheBLF *, const char *str, const size_t str_len, const ft_pix, void *str_list_ptr)
Vector< StringRef > blender::blf_font_string_wrap (FontBLF *font, StringRef str, int max_pixel_width, BLFWrapMode mode)
Font Subsystem Init/Exit
int blender::blf_font_init ()
void blender::blf_font_exit ()
void blender::BLF_cache_flush_set_fn (void(*cache_flush_fn)())
Font Configure
void blender::blf_ensure_size (FontBLF *font)
bool blender::blf_font_size (FontBLF *font, float size)

Variables

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

Font New/Free

static const FaceDetails blender::static_face_details []
static void blender::blf_font_fill (FontBLF *font)
static void blender::blf_font_metrics (FT_Face face, FontMetrics *metrics)
bool blender::blf_ensure_face (FontBLF *font)
static FontBLF * blender::blf_font_new_impl (const char *filepath, const char *mem_name, const uchar *mem, const size_t mem_size)
FontBLF * blender::blf_font_new_from_filepath (const char *filepath)
FontBLF * blender::blf_font_new_from_mem (const char *mem_name, const uchar *mem, const size_t mem_size)
void blender::blf_font_attach_from_mem (FontBLF *font, const uchar *mem, const size_t mem_size)
void blender::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.