Blender V5.3
blf_internal.hh File Reference
#include "BLI_array.hh"
#include "BLI_bounds_types.hh"
#include "BLI_function_ref.hh"
#include "BLI_string_ref.hh"
#include "BLI_vector.hh"
#include "DNA_listBase.h"

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define BLF_MAX_FONT   64
#define BLF_SUBPIXEL_POSITION
#define BLF_SUBPIXEL_AA
#define BLF_CACHE_MAX_FACES   8
#define BLF_CACHE_MAX_SIZES   16
#define BLF_CACHE_BYTES   0x100000
#define BLF_ICON_OFFSET   0x100000L
#define BLF_DPI   72

Functions

char * blender::blf_dir_metrics_search (const char *filepath)
void blender::blf_draw_buffer__start (FontBLF *font)
void blender::blf_draw_buffer__end ()
void blender::blf_font_boundbox_foreach_glyph (FontBLF *font, const char *str, size_t str_len, bool(*user_fn)(const char *str, size_t str_step_ofs, const rcti *bounds, void *user_data), void *user_data)
Glyph Batching
void blender::blf_batch_draw_begin (FontBLF *font)
void blender::blf_batch_draw ()
Font Subsystem Init/Exit
int blender::blf_font_init ()
void blender::blf_font_exit ()
FreeType Utilities (Internal)
uint blender::blf_get_char_index (FontBLF *font, const uint charcode)
Font New/Free
bool blender::blf_ensure_face (FontBLF *font)
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)
Font Configure
void blender::blf_ensure_size (FontBLF *font)
bool blender::blf_font_size (FontBLF *font, float size)
Text Drawing: GPU
void blender::blf_font_draw (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
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)
int blender::blf_font_draw_mono (FontBLF *font, const char *str, const size_t str_len, const int char_width, const int tab_columns)
Text Evaluation: Word-Wrap with Callback
void blender::blf_font_draw__wrap (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
Vector< StringRef > blender::blf_font_string_wrap (FontBLF *font, StringRef str, int max_pixel_width, BLFWrapMode mode)
void blender::blf_font_draw_buffer__wrap (FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
void blender::blf_font_boundbox__wrap (FontBLF *font, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info)
Text Drawing: Buffer
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:

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
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_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)
size_t blender::blf_str_offset_from_cursor_position (FontBLF *font, const char *str, size_t str_len, int location_x)
void blender::blf_str_offset_to_glyph_bounds (FontBLF *font, const char *str, size_t str_offset, rcti *r_glyph_bounds)
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)
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)
Font Query: Attributes
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)
Glyph Cache
GlyphCacheBLF * blender::blf_glyph_cache_acquire (FontBLF *font)
void blender::blf_glyph_cache_release (FontBLF *font)
void blender::blf_glyph_cache_clear (FontBLF *font)
Glyph Access (Ensure/Free)
GlyphBLF * blender::blf_glyph_ensure (FontBLF *font, GlyphCacheBLF *gc, const uint charcode, uint8_t subpixel)
GlyphBLF * blender::blf_glyph_ensure_subpixel (FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, int32_t pen_x)
GlyphBLF * blender::blf_glyph_ensure_icon (GlyphCacheBLF *gc, const uint icon_id, bool color, FunctionRef< void(std::string &)> edit_source_cb)
Glyph Drawing
void blender::blf_glyph_draw (FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, const int x, const int y)
Convert Glyph to Curves
bool blender::blf_character_to_curves (FontBLF *font, uint unicode, ListBaseT< Nurb > *nurbsbase, const float scale, bool use_fallback, float *r_advance, rctf *r_bounds)

Macro Definition Documentation

◆ BLF_CACHE_BYTES

#define BLF_CACHE_BYTES   0x100000

Maximum number of bytes to use for cached data nodes. 0 is default of 200,000.

Definition at line 51 of file blf_internal.hh.

Referenced by blender::blf_font_init().

◆ BLF_CACHE_MAX_FACES

#define BLF_CACHE_MAX_FACES   8

Maximum number of opened FT_Face objects managed by cache. 0 is default of 2.

Definition at line 47 of file blf_internal.hh.

Referenced by blender::blf_font_init().

◆ BLF_CACHE_MAX_SIZES

#define BLF_CACHE_MAX_SIZES   16

Maximum number of opened FT_Size objects managed by cache. 0 is default of 4

Definition at line 49 of file blf_internal.hh.

Referenced by blender::blf_font_init().

◆ BLF_DPI

#define BLF_DPI   72

We assume square pixels at a fixed DPI of 72, scaling only the size. Therefore font size = points = pixels, i.e. a size of 20 will result in a 20-pixel EM square. Although we could use the actual monitor DPI instead, we would then have to scale the size to cancel that out. Other libraries like Skia use this same fixed value.

Definition at line 65 of file blf_internal.hh.

Referenced by blender::blf_ensure_size(), and blender::blf_font_size().

◆ BLF_ICON_OFFSET

#define BLF_ICON_OFFSET   0x100000L

Offset from icon id to Unicode Supplementary Private Use Area-B, added with Unicode 2.0. 65,536 code-points at U+100000..U+10FFFF.

Definition at line 57 of file blf_internal.hh.

Referenced by blender::blf_glyph_cache_add_svg(), and blender::blf_glyph_ensure_icon().

◆ BLF_MAX_FONT

#define BLF_MAX_FONT   64

Max number of FontBLFs in memory. Take care that every font has a glyph cache per size/dpi, so we don't need load the same font with different size, just load one and call #BLF_size.

Definition at line 34 of file blf_internal.hh.

Referenced by blender::BLF_cache_clear(), blender::BLF_exit(), blender::blf_get(), blender::blf_glyph_index_from_charcode(), blender::BLF_init(), blender::BLF_reset_fonts(), blender::blf_search_available(), blender::blf_search_by_filepath(), blender::blf_search_by_mem_name(), blender::BLF_unload(), and blender::BLF_unload_all().

◆ BLF_SUBPIXEL_AA

#define BLF_SUBPIXEL_AA

If enabled, glyphs are rendered at multiple horizontal subpixel positions.

Definition at line 44 of file blf_internal.hh.

◆ BLF_SUBPIXEL_POSITION

#define BLF_SUBPIXEL_POSITION

If enabled, glyphs positions are on 64ths of a pixel. Disabled, they are on whole pixels.

Definition at line 39 of file blf_internal.hh.