|
Blender V4.3
|
#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <ft2build.h>#include "MEM_guardedalloc.h"#include "BLI_fileops.h"#include "BLI_math_rotation.h"#include "BLI_path_utils.hh"#include "BLI_string.h"#include "BLI_threads.h"#include "BLF_api.hh"#include "IMB_colormanagement.hh"#include "GPU_matrix.hh"#include "GPU_shader.hh"#include "blf_internal.hh"#include "blf_internal_types.hh"Go to the source code of this file.
Macros | |
| #define | BLF_RESULT_CHECK_INIT(r_info) |
Functions | |
| static FontBLF * | blf_get (int fontid) |
| int | BLF_init () |
| void | BLF_exit () |
| void | BLF_reset_fonts () |
| void | BLF_cache_clear () |
| bool | blf_font_id_is_valid (int fontid) |
| static int | blf_search_by_mem_name (const char *mem_name) |
| static int | blf_search_by_filepath (const char *filepath) |
| static int | blf_search_available () |
| bool | BLF_has_glyph (int fontid, uint unicode) |
| bool | BLF_is_loaded (const char *filepath) |
| bool | BLF_is_loaded_mem (const char *name) |
| int | BLF_load (const char *filepath) |
| int | BLF_load_unique (const char *filepath) |
| void | BLF_metrics_attach (const int fontid, const uchar *mem, const int mem_size) |
| int | BLF_load_mem (const char *name, const uchar *mem, int mem_size) |
| int | BLF_load_mem_unique (const char *name, const uchar *mem, int mem_size) |
| void | BLF_unload (const char *filepath) |
| void | BLF_unload_id (int fontid) |
| void | BLF_unload_all () |
| void | BLF_enable (int fontid, int option) |
| void | BLF_disable (int fontid, int option) |
| void | BLF_character_weight (int fontid, int weight) |
| int | BLF_default_weight (int fontid) |
| bool | BLF_has_variable_weight (int fontid) |
| 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_color4ubv (int fontid, const uchar rgba[4]) |
| void | BLF_color3ubv_alpha (int fontid, const uchar rgb[3], uchar alpha) |
| void | BLF_color3ubv (int fontid, const uchar rgb[3]) |
| void | BLF_color4ub (int fontid, uchar r, uchar g, uchar b, uchar alpha) |
| void | BLF_color3ub (int fontid, uchar r, uchar g, uchar 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 | BLF_batch_draw_flush () |
| void | BLF_batch_draw_end () |
| static void | blf_draw_gpu__start (const FontBLF *font) |
| static void | blf_draw_gpu__end (const FontBLF *font) |
| void | BLF_draw (int fontid, const char *str, const size_t str_len, ResultBLF *r_info) |
| int | BLF_draw_mono (int fontid, const char *str, const size_t str_len, int cwidth, int tab_columns) |
| void | BLF_draw_svg_icon (uint icon_id, float x, float y, float size, const float color[4], float outline_alpha, bool multicolor, blender::FunctionRef< void(std::string &)> edit_source_cb) |
| blender::Array< uchar > | BLF_svg_icon_bitmap (uint icon_id, float size, int *r_width, int *r_height, bool multicolor, blender::FunctionRef< void(std::string &)> edit_source_cb) |
| void | BLF_boundbox_foreach_glyph (int fontid, const char *str, size_t str_len, BLF_GlyphBoundsFn user_fn, void *user_data) |
| size_t | BLF_str_offset_from_cursor_position (int fontid, const char *str, size_t str_len, int location_x) |
| bool | BLF_str_offset_to_glyph_bounds (int fontid, const char *str, size_t str_offset, rcti *r_glyph_bounds) |
| int | BLF_str_offset_to_cursor (int fontid, 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 (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, 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 (int fontid, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info) |
| void | BLF_width_and_height (int fontid, const char *str, const size_t str_len, float *r_width, float *r_height) |
| float | BLF_width (int fontid, const char *str, const size_t str_len, ResultBLF *r_info) |
| float | BLF_fixed_width (int fontid) |
| float | BLF_height (int fontid, const char *str, const size_t str_len, ResultBLF *r_info) |
| 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, FontShadowType type, const float rgba[4]) |
| void | BLF_shadow_offset (int fontid, int x, int y) |
| void | BLF_buffer (int fontid, float *fbuf, uchar *cbuf, int w, int h, 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 | BLF_draw_buffer (int fontid, const char *str, const size_t str_len, ResultBLF *r_info) |
| blender::Vector< blender::StringRef > | BLF_string_wrap (int fontid, blender::StringRef str, const int max_pixel_width) |
| char * | BLF_display_name_from_file (const char *filepath) |
| 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, uint unicode, ListBase *nurbsbase, const float scale) |
| void | BLF_state_print (int fontid) |
Variables | |
| FontBLF * | global_font [BLF_MAX_FONT] = {nullptr} |
| int | blf_mono_font = -1 |
| int | blf_mono_font_render = -1 |
Main BlenFont (BLF) API, public functions for font handling.
Wraps GPU display and FreeType.
Definition in file blf.cc.
| #define BLF_RESULT_CHECK_INIT | ( | r_info | ) |
Definition at line 41 of file blf.cc.
Referenced by BLF_boundbox(), BLF_draw(), BLF_height(), and BLF_width().
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().
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().
| 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().
| void BLF_batch_draw_end | ( | ) |
Definition at line 530 of file blf.cc.
References blf_batch_draw(), 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().
| 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().
| 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().
| 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.
| user_fn | Callback that runs on each glyph, returning false early exits. |
| user_data | User argument passed to user_fn. |
Definition at line 653 of file blf.cc.
References blf_font_boundbox_foreach_glyph(), blf_get(), BLF_WORD_WRAP, BLI_assert, and str.
| 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().
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().
| void BLF_cache_clear | ( | ) |
Definition at line 99 of file blf.cc.
References blf_glyph_cache_clear(), BLF_MAX_FONT, and global_font.
Referenced by ghost_event_proc(), reloadtranslation_exec(), and UI_view2d_zoom_cache_reset().
| 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().
Weight class: 100 (Thin) - 400 (Normal) - 900 (Heavy).
Definition at line 330 of file blf.cc.
References blf_get().
Referenced by fontstyle_set_ex().
Definition at line 881 of file blf.cc.
References blf_get().
Referenced by ED_region_image_metadata_draw(), ED_region_info_draw_multiline(), blender::ed::space_node::frame_node_draw_label(), py_blf_clipping(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_rotated(), and UI_view2d_text_cache_draw().
Definition at line 511 of file blf.cc.
References b, and BLF_color4fv().
Referenced by blender::ed::object::voxel_size_edit_draw().
Definition at line 503 of file blf.cc.
References BLF_color4fv(), and copy_v3_v3().
Definition at line 476 of file blf.cc.
Referenced by ED_image_draw_info().
Definition at line 459 of file blf.cc.
References BLF_color3ubv_alpha().
Referenced by ED_image_draw_info(), blender::ed::space_node::frame_node_draw_label(), gizmo_ruler_draw(), knifetool_draw_angle(), knifetool_draw_visible_distances(), slider_draw(), and UI_panel_category_draw_all().
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().
Definition at line 488 of file blf.cc.
References blf_get(), and rgba_float_to_uchar().
Referenced by BLF_color3f(), BLF_color3fv_alpha(), BLF_color4f(), drawAutoKeyWarning(), gizmo_axis_draw(), icon_draw_rect_input_text(), py_blf_color(), radial_control_paint_cursor(), screen_draw_area_drag_tip(), sequencer_preview_region_draw(), UI_fontstyle_draw_simple_backdrop(), and view3d_draw_region_info().
Definition at line 464 of file blf.cc.
Referenced by ED_scene_draw_fps().
Definition at line 435 of file blf.cc.
References blf_get().
Referenced by draw_marker_texts(), draw_view_axis(), drw_text_cache_draw_ex(), textview_draw_string(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_rotated(), UI_fontstyle_draw_simple(), UI_FontThemeColor(), UI_view2d_text_cache_draw(), and widget_draw_text().
Definition at line 850 of file blf.cc.
References blf_font_descender(), and blf_get().
Referenced by BKE_image_stamp_buf(), do_text_effect(), metadata_draw_imbuf(), screen_draw_area_drag_tip(), textview_draw(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_rotated(), and UI_fontstyle_draw_simple_backdrop().
Definition at line 321 of file blf.cc.
References blf_get().
Referenced by BKE_image_stamp_buf(), do_text_effect(), draw_vertical_scale_indicators(), drw_text_cache_draw_ex(), ED_region_image_metadata_draw(), ED_region_info_draw_multiline(), file_draw_string_multiline(), blender::ed::space_node::frame_node_draw_label(), gizmo_axis_draw(), gizmo_ruler_draw(), knifetool_draw_angle(), knifetool_draw_visible_distances(), metadata_box_height_get(), metadata_draw_imbuf(), py_blf_disable(), sequencer_preview_region_draw(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_rotated(), UI_panel_category_draw_all(), ui_tooltip_create_with_data(), ui_tooltip_region_draw_cb(), UI_view2d_text_cache_draw(), uiStyleInit(), view3d_draw_region_info(), and widget_draw_text_icon().
| char * BLF_display_name_from_file | ( | const char * | filepath | ) |
| 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().
Draw the string using the current font.
Definition at line 568 of file blf.cc.
References blf_draw_gpu__end(), blf_draw_gpu__start(), blf_font_draw(), blf_font_draw__wrap(), blf_get(), BLF_RESULT_CHECK_INIT, BLF_WORD_WRAP, GPU_bgl_end(), and str.
Referenced by BLF_draw_default(), clip_draw_dopesheet_channels(), draw_marker_texts(), ED_image_draw_info(), ED_region_cache_draw_curfra_label(), ED_region_info_draw_multiline(), blender::ed::space_node::frame_node_draw_label(), gizmo_axis_draw(), gizmo_ruler_draw(), icon_draw_rect_input_text(), knifetool_draw_angle(), knifetool_draw_visible_distances(), loggerwindow_do_draw(), metadata_custom_draw_fields(), metadata_draw_imbuf(), playanim_toscreen_ex(), py_blf_draw(), radial_control_paint_cursor(), region_draw_status_text(), screen_draw_area_drag_tip(), slider_draw(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_rotated(), UI_fontstyle_draw_simple(), UI_fontstyle_draw_simple_backdrop(), UI_panel_category_draw_all(), blender::ed::object::voxel_size_edit_draw(), and widget_draw_text().
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().
| void blf_draw_buffer__end | ( | ) |
Definition at line 960 of file blf.cc.
Referenced by BLF_draw_buffer().
| void blf_draw_buffer__start | ( | FontBLF * | font | ) |
Definition at line 946 of file blf.cc.
References FontBufInfoBLF::col_char, FontBufInfoBLF::col_float, FontBufInfoBLF::col_init, copy_v4_v4(), FontBufInfoBLF::display, IMB_colormanagement_display_to_scene_linear_v3(), rgba_float_to_uchar(), and srgb_to_linearrgb_v4().
Referenced by BLF_draw_buffer().
|
static |
Definition at line 561 of file blf.cc.
References BLF_ASPECT, BLF_ROTATION, and GPU_matrix_pop().
Referenced by BLF_draw(), BLF_draw_mono(), and BLF_draw_svg_icon().
|
static |
Definition at line 537 of file blf.cc.
References BLF_ASPECT, BLF_ROTATION, GPU_matrix_push(), GPU_matrix_rotate_2d(), GPU_matrix_scale_3fv(), GPU_matrix_translate_3f(), and RAD2DEG.
Referenced by BLF_draw(), BLF_draw_mono(), and BLF_draw_svg_icon().
| int BLF_draw_mono | ( | int | fontid, |
| const char * | str, | ||
| const size_t | str_len, | ||
| int | cwidth, | ||
| int | tab_columns ) |
Definition at line 594 of file blf.cc.
References blf_draw_gpu__end(), blf_draw_gpu__start(), blf_font_draw_mono(), blf_get(), and str.
Referenced by text_font_draw(), text_font_draw_character(), text_font_draw_character_utf8(), and textview_draw_string().
| void BLF_draw_svg_icon | ( | uint | icon_id, |
| float | x, | ||
| float | y, | ||
| float | size, | ||
| const float | color[4], | ||
| float | outline_alpha, | ||
| bool | multicolor, | ||
| blender::FunctionRef< void(std::string &)> | edit_source_cb ) |
Definition at line 612 of file blf.cc.
References blf_draw_gpu__end(), blf_draw_gpu__start(), blf_draw_svg_icon(), global_font, GPU_bgl_end(), and UNUSED_VARS.
Referenced by icon_draw_icon(), and icon_draw_size().
Definition at line 312 of file blf.cc.
References blf_get().
Referenced by BKE_image_stamp_buf(), blf_load_datafiles_dir(), BLF_load_default(), BLF_load_mono_default(), do_text_effect(), draw_vertical_scale_indicators(), drw_text_cache_draw_ex(), ED_region_image_metadata_draw(), ED_region_info_draw_multiline(), file_draw_string_multiline(), blender::ed::space_node::frame_node_draw_label(), gizmo_axis_draw(), gizmo_ruler_draw(), IMB_font_preview(), knifetool_draw_angle(), knifetool_draw_visible_distances(), metadata_box_height_get(), metadata_draw_imbuf(), playanim_toscreen_ex(), py_blf_enable(), sequencer_preview_region_draw(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_rotated(), UI_panel_category_draw_all(), ui_tooltip_create_with_data(), UI_view2d_text_cache_draw(), uiStyleInit(), and view3d_draw_region_info().
| void BLF_exit | ( | ) |
Definition at line 71 of file blf.cc.
References blf_font_exit(), blf_font_free(), BLF_MAX_FONT, and global_font.
Referenced by multitestapp_free(), BlendfileLoadingBaseTest::TearDownTestCase(), WM_exit_ex(), and wm_main_playanim_intern().
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().
| bool blf_font_id_is_valid | ( | int | fontid | ) |
Definition at line 54 of file blf.cc.
References BLF_MAX_FONT, and global_font.
Referenced by BLF_ascender(), BLF_aspect(), BLF_boundbox(), BLF_boundbox_foreach_glyph(), BLF_buffer(), BLF_buffer_col(), BLF_character_to_curves(), BLF_character_weight(), BLF_clipping(), BLF_color3ub(), BLF_color3ubv_alpha(), BLF_color4fv(), BLF_color4ub(), BLF_color4ubv(), BLF_default_weight(), BLF_descender(), BLF_disable(), BLF_display_name_from_id(), BLF_draw(), BLF_draw_buffer(), BLF_draw_mono(), BLF_enable(), BLF_fixed_width(), blf_font_id_is_valid(), BLF_get_vfont_metrics(), BLF_has_glyph(), BLF_has_variable_weight(), BLF_height(), BLF_height_max(), BLF_metrics_attach(), BLF_position(), BLF_rotation(), BLF_shadow(), BLF_shadow_offset(), BLF_size(), BLF_state_print(), BLF_str_offset_from_cursor_position(), BLF_str_offset_to_cursor(), BLF_str_offset_to_glyph_bounds(), BLF_str_selection_boxes(), BLF_string_wrap(), BLF_unload_id(), BLF_width(), BLF_width_and_height(), BLF_width_max(), BLF_width_to_rstrlen(), BLF_width_to_strlen(), and BLF_wordwrap().
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().
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().
| 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().
Definition at line 815 of file blf.cc.
References blf_font_height(), blf_get(), BLF_RESULT_CHECK_INIT, and str.
Referenced by clip_draw_dopesheet_channels(), draw_vertical_scale_indicators(), file_font_pointsize(), label_rect_get(), loggerwindow_new(), and UI_view2d_text_cache_draw().
Return dimensions of the font without any sample text.
Definition at line 828 of file blf.cc.
References blf_font_height_max(), and blf_get().
Referenced by BKE_image_stamp_buf(), do_text_effect(), draw_marker_texts(), blender::ed::space_node::frame_node_draw_label(), metadata_box_height_get(), metadata_draw_imbuf(), screen_draw_area_drag_tip(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_simple_backdrop(), UI_fontstyle_height_max(), and ui_tooltip_create_with_data().
| int BLF_init | ( | ) |
Definition at line 62 of file blf.cc.
References blf_font_init(), BLF_MAX_FONT, and global_font.
Referenced by main(), BlendfileLoadingBaseTest::SetUpTestCase(), WM_init(), and wm_main_playanim_intern().
| 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().
| bool BLF_is_loaded_mem | ( | const char * | name | ) |
Definition at line 169 of file blf.cc.
References blf_search_by_mem_name().
| 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().
Definition at line 226 of file blf.cc.
References BLF_load_mem_unique(), and blf_search_by_mem_name().
Definition at line 236 of file blf.cc.
References blf_font_new_from_mem(), blf_search_available(), global_font, and printf.
Referenced by BLF_load_mem().
| int BLF_load_unique | ( | const char * | filepath | ) |
Definition at line 187 of file blf.cc.
References blf_font_new_from_filepath(), blf_search_available(), BLI_exists(), global_font, and printf.
Referenced by BLF_load(), blf_load_font_default(), and uiStyleInit().
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().
Definition at line 371 of file blf.cc.
References BLF_ASPECT, blf_get(), floorf, round_fl_to_int(), and z().
Referenced by BKE_image_stamp_buf(), BLF_draw_default(), checker_board_text(), clip_draw_dopesheet_channels(), do_text_effect(), draw_marker_texts(), draw_text_outline(), ED_image_draw_info(), ED_region_cache_draw_curfra_label(), ED_region_info_draw_multiline(), blender::ed::space_node::frame_node_draw_label(), gizmo_axis_draw(), gizmo_ruler_draw(), icon_draw_rect_input_text(), IMB_font_preview(), knifetool_draw_angle(), knifetool_draw_visible_distances(), loggerwindow_do_draw(), metadata_custom_draw_fields(), metadata_draw_imbuf(), playanim_toscreen_ex(), py_blf_position(), radial_control_paint_cursor(), region_draw_status_text(), screen_draw_area_drag_tip(), slider_draw(), text_font_draw(), text_font_draw_character(), text_font_draw_character_utf8(), textview_draw_string(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_rotated(), UI_fontstyle_draw_simple(), UI_fontstyle_draw_simple_backdrop(), UI_panel_category_draw_all(), blender::ed::object::voxel_size_edit_draw(), and widget_draw_text().
| 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().
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().
|
static |
Definition at line 144 of file blf.cc.
References BLF_MAX_FONT, and global_font.
Referenced by BLF_load_mem_unique(), and BLF_load_unique().
|
static |
Definition at line 129 of file blf.cc.
References BLF_MAX_FONT, BLI_path_cmp, and global_font.
Referenced by BLF_is_loaded(), and BLF_load().
|
static |
Definition at line 114 of file blf.cc.
References BLF_MAX_FONT, global_font, and STREQ.
Referenced by BLF_is_loaded_mem(), and BLF_load_mem().
| void BLF_shadow | ( | int | fontid, |
| FontShadowType | type, | ||
| const float | rgba[4] = nullptr ) |
Note that shadow needs to be enabled with BLF_enable.
Definition at line 902 of file blf.cc.
References blf_get(), and rgba_float_to_uchar().
Referenced by draw_vertical_scale_indicators(), drawAutoKeyWarning(), drw_text_cache_draw_ex(), py_blf_shadow(), sequencer_preview_region_draw(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_rotated(), and view3d_draw_region_info().
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().
Definition at line 426 of file blf.cc.
References blf_font_size(), and blf_get().
Referenced by BKE_image_stamp_buf(), BKE_vfontdata_char_from_freetypefont(), BLF_draw_default(), BLF_set_default(), checker_board_text(), clip_draw_dopesheet_channels(), do_text_effect(), draw_marker_texts(), ED_image_draw_info(), ED_region_cache_draw_curfra_label(), ED_region_image_metadata_draw(), ED_region_info_draw_multiline(), fontstyle_set_ex(), blender::ed::space_node::frame_node_draw_label(), blender::ed::spreadsheet::get_column_width(), blender::ed::spreadsheet::get_index_column_width(), gizmo_axis_draw(), gizmo_ruler_draw(), icon_draw_rect_input_text(), IMB_font_preview(), knifetool_draw_angle(), knifetool_draw_visible_distances(), loggerwindow_new(), playanim_window_font_scale_from_dpi(), py_blf_size(), radial_control_paint_cursor(), screen_draw_area_drag_tip(), text_font_begin(), textview_font_begin(), ui_def_but_rna__menu(), UI_panel_category_draw_all(), ui_tooltip_create_with_data(), ui_tooltip_data_from_button_or_extra_icon(), ui_tooltip_region_draw_cb(), and blender::ed::object::voxel_size_edit_draw().
| void BLF_state_print | ( | int | fontid | ) |
Definition at line 1072 of file blf.cc.
References BLF_ASPECT, blf_get(), BLF_ROTATION, printf, and UNPACK3.
| 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().
| 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().
| bool BLF_str_offset_to_glyph_bounds | ( | int | fontid, |
| const char * | str, | ||
| size_t | str_offset, | ||
| rcti * | r_glyph_bounds ) |
Definition at line 681 of file blf.cc.
References blf_get(), blf_str_offset_to_glyph_bounds(), and str.
| 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().
| 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.
| blender::Array< uchar > BLF_svg_icon_bitmap | ( | uint | icon_id, |
| float | size, | ||
| int * | r_width, | ||
| int * | r_height, | ||
| bool | multicolor, | ||
| blender::FunctionRef< void(std::string &)> | edit_source_cb ) |
Definition at line 635 of file blf.cc.
References blf_svg_icon_bitmap(), global_font, and UNUSED_VARS.
Referenced by UI_svg_icon_bitmap().
| 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().
| 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().
| void BLF_unload_id | ( | int | fontid | ) |
Definition at line 284 of file blf.cc.
References blf_font_free(), blf_get(), BLI_assert, and global_font.
Referenced by BKE_blender_userdef_data_free(), BKE_vfontdata_char_from_freetypefont(), BKE_vfontdata_from_freetypefont(), IMB_font_preview(), and SEQ_effect_text_font_unload().
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 791 of file blf.cc.
References blf_font_width(), blf_get(), BLF_RESULT_CHECK_INIT, and str.
Referenced by draw_handle_transform_text(), draw_horizontal_scale_indicators(), ED_image_draw_info(), ED_info_draw_stats(), ED_region_info_draw_multiline(), file_string_width(), blender::ed::space_node::frame_node_draw_label(), blender::ed::spreadsheet::get_column_width(), blender::ed::spreadsheet::get_index_column_width(), label_rect_get(), metadata_draw_imbuf(), region_draw_status_text(), screen_draw_area_drag_tip(), ui_block_bounds_calc_text(), ui_def_but_rna__menu(), ui_draw_menu_item(), UI_fontstyle_draw_ex(), UI_fontstyle_draw_rotated(), UI_fontstyle_draw_simple_backdrop(), UI_fontstyle_string_width(), UI_fontstyle_string_width_with_block_aspect(), UI_panel_category_draw_all(), ui_text_clip_cursor(), UI_text_clip_middle_ex(), ui_text_clip_right_label(), ui_textedit_set_cursor_pos(), ui_tooltip_create_with_data(), ui_tooltip_data_from_button_or_extra_icon(), uiTemplateReportsBanner(), uiTemplateStatusInfo(), blender::ed::outliner::unused_message_popup_width_compute(), widget_draw_text(), and wm_block_dialog_create().
| void BLF_width_and_height | ( | int | fontid, |
| const char * | str, | ||
| size_t | str_len, | ||
| float * | r_width, | ||
| float * | r_height ) |
The following function return the width and height of the string, but just in one call, so avoid extra freetype2 stuff.
Definition at line 778 of file blf.cc.
References blf_font_width_and_height(), blf_get(), and str.
Referenced by draw_backdrop(), draw_histogram(), draw_vectorscope_graticule(), drawAutoKeyWarning(), drw_text_cache_draw_ex(), ED_region_cache_draw_curfra_label(), gizmo_axis_draw(), gizmo_ruler_draw(), IMB_font_preview(), knifetool_draw_angle(), knifetool_draw_visible_distances(), py_blf_dimensions(), radial_control_paint_cursor(), slider_draw(), and blender::ed::object::voxel_size_edit_draw().
Definition at line 839 of file blf.cc.
References blf_font_width_max(), and blf_get().
Referenced by BKE_image_stamp_buf().
| 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().
| 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().
Definition at line 893 of file blf.cc.
References blf_get().
Referenced by BKE_image_stamp_buf(), do_text_effect(), file_draw_string_multiline(), blender::ed::space_node::frame_node_draw_label(), metadata_box_height_get(), metadata_draw_imbuf(), py_blf_word_wrap(), ui_tooltip_create_with_data(), and ui_tooltip_region_draw_cb().
| int blf_mono_font = -1 |
Definition at line 51 of file blf.cc.
Referenced by BLF_reset_fonts(), BLF_unload_all(), ED_image_draw_info(), ED_region_image_metadata_draw(), gizmo_ruler_draw(), knifetool_draw_angle(), knifetool_draw_visible_distances(), space_text_draw_context_init(), textview_draw(), ui_tooltip_create_with_data(), ui_tooltip_data_from_button_or_extra_icon(), ui_tooltip_region_draw_cb(), and uiStyleInit().
| int blf_mono_font_render = -1 |
Definition at line 52 of file blf.cc.
Referenced by BKE_image_stamp_buf(), BLF_reset_fonts(), BLF_unload_all(), checker_board_text(), do_text_effect(), and uiStyleInit().
| FontBLF* global_font[BLF_MAX_FONT] = {nullptr} |
Font array.
Definition at line 47 of file blf.cc.
Referenced by BLF_cache_clear(), BLF_draw_svg_icon(), BLF_exit(), blf_get(), blf_glyph_index_from_charcode(), BLF_init(), BLF_load(), BLF_load_mem_unique(), BLF_load_unique(), BLF_reset_fonts(), blf_search_available(), blf_search_by_filepath(), blf_search_by_mem_name(), BLF_svg_icon_bitmap(), BLF_unload(), BLF_unload_all(), and BLF_unload_id().