41#define BLF_RESULT_CHECK_INIT(r_info) \
43 memset(r_info, 0, sizeof(*(r_info))); \
111 return blf_get(fontid) !=
nullptr;
118 if ((font ==
nullptr) || (font->
mem_name ==
nullptr)) {
133 if ((font ==
nullptr) || (font->
filepath ==
nullptr)) {
194 printf(
"Too many fonts!!!\n");
201 printf(
"Can't find font: %s\n", filepath);
208 printf(
"Can't load font: %s\n", filepath);
244 printf(
"Too many fonts!!!\n");
249 printf(
"Can't load font: %s from memory!!\n", name);
255 printf(
"Can't load font: %s from memory!!\n", name);
268 if (font ==
nullptr || font->
filepath ==
nullptr) {
317 font->
flags |= option;
326 font->
flags &= ~option;
391 if (remainder > 0.4f && remainder < 0.6f) {
392 if (remainder < 0.5f) {
401 if (remainder > 0.4f && remainder < 0.6f) {
402 if (remainder < 0.5f) {
411 if (remainder > 0.4f && remainder < 0.6f) {
412 if (remainder < 0.5f) {
440 font->
color[0] = rgba[0];
441 font->
color[1] = rgba[1];
442 font->
color[2] = rgba[2];
443 font->
color[3] = rgba[3];
452 font->
color[0] = rgb[0];
453 font->
color[1] = rgb[1];
454 font->
color[2] = rgb[2];
455 font->
color[3] = alpha;
472 font->
color[3] = alpha;
484 font->
color[3] = 255;
499 const float rgba[4] = {r, g,
b, a};
513 const float rgba[4] = {r, g,
b, 1.0f};
572 if (str_len == 0 ||
str[0] ==
'\0') {
594int BLF_draw_mono(
int fontid,
const char *
str,
const size_t str_len,
int cwidth,
int tab_columns)
596 if (str_len == 0 ||
str[0] ==
'\0') {
616 const float color[4],
648 UNUSED_VARS(icon_id,
size, r_width, r_height, multicolor, edit_source_cb);
684 rcti *r_glyph_bounds)
696 const size_t str_len,
697 const size_t str_offset,
698 const int cursor_width)
708 int fontid,
const char *
str,
size_t str_len,
size_t sel_start,
size_t sel_length)
718 int fontid,
const char *
str,
const size_t str_len,
float width,
float *r_width)
728 *r_width =
float(width_result) * xa;
740 int fontid,
const char *
str,
const size_t str_len,
float width,
float *r_width)
750 *r_width =
float(width_result) * xa;
762 int fontid,
const char *
str,
const size_t str_len,
rcti *r_box,
ResultBLF *r_info)
779 int fontid,
const char *
str,
const size_t str_len,
float *r_width,
float *r_height)
787 *r_width = *r_height = 0.0f;
980 const int max_pixel_width)
994 char *name =
nullptr;
995 FT_Library ft_library;
996 if (FT_Init_FreeType(&ft_library) == FT_Err_Ok) {
998 if (FT_New_Face(ft_library, filepath, 0, &face) == FT_Err_Ok) {
999 if (face->family_name) {
1000 name =
BLI_sprintfN(
"%s %s", face->family_name, face->style_name);
1004 FT_Done_FreeType(ft_library);
1033 const bool complete_font = (font->
face->ascender != 0) && (font->
face->descender != 0) &&
1034 (font->
face->ascender != font->
face->descender);
1036 if (complete_font) {
1039 *ascend_ratio =
float(font->
face->ascender) / (font->
face->ascender - font->
face->descender);
1042 *ascend_ratio = 0.8f;
1047 if (font->
face->bbox.yMax != font->
face->bbox.yMin) {
1048 *scale =
float(1.0 /
double(font->
face->bbox.yMax - font->
face->bbox.yMin));
1050 if (complete_font) {
1051 *em_ratio =
float(font->
face->ascender - font->
face->descender) /
1052 (font->
face->bbox.yMax - font->
face->bbox.yMin);
1056 *scale = 1.0f / 1000.0f;
1076 printf(
"fontid %d %p\n", fontid, (
void *)font);
1077 printf(
" mem_name: '%s'\n", font->mem_name ? font->mem_name :
"<none>");
1078 printf(
" filepath: '%s'\n", font->filepath ? font->filepath :
"<none>");
1079 printf(
" size: %f\n", font->size);
1081 printf(
" aspect: (%d) %.6f %.6f %.6f\n",
1084 printf(
" angle: (%d) %.6f\n", (font->flags &
BLF_ASPECT) != 0, font->angle);
1085 printf(
" flag: %d\n", font->flags);
1088 printf(
"fontid %d (nullptr)\n", fontid);
void BLF_default_set(int fontid)
bool(* BLF_GlyphBoundsFn)(const char *str, size_t str_step_ofs, const rcti *bounds, void *user_data)
File and directory operations.
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
MINLINE int round_fl_to_int(float a)
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
void GPU_matrix_scale_3fv(const float vec[3])
void GPU_matrix_rotate_2d(float deg)
void GPU_matrix_translate_3f(float x, float y, float z)
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
void IMB_colormanagement_display_to_scene_linear_v3(float pixel[3], ColorManagedDisplay *display)
Read Guarded memory(de)allocation.
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 Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves 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 Invert a color
void BLF_color3ubv(int fontid, const uchar rgb[3])
size_t BLF_width_to_rstrlen(int fontid, const char *str, const size_t str_len, float width, float *r_width)
void BLF_state_print(int fontid)
static int blf_search_available()
void BLF_color4ub(int fontid, uchar r, uchar g, uchar b, uchar alpha)
void BLF_color4ubv(int fontid, const uchar rgba[4])
int BLF_load(const char *filepath)
void BLF_size(int fontid, float size)
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)
int BLF_draw_mono(int fontid, const char *str, const size_t str_len, int cwidth, int tab_columns)
void BLF_aspect(int fontid, float x, float y, float z)
void blf_draw_buffer__start(FontBLF *font)
bool BLF_has_glyph(int fontid, uint unicode)
static FontBLF * blf_get(int fontid)
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)
float BLF_width(int fontid, const char *str, const size_t str_len, ResultBLF *r_info)
bool BLF_is_loaded(const char *filepath)
void BLF_clipping(int fontid, int xmin, int ymin, int xmax, int ymax)
size_t BLF_width_to_strlen(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_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)
void BLF_color3ub(int fontid, uchar r, uchar g, uchar b)
void BLF_unload(const char *filepath)
void BLF_color3ubv_alpha(int fontid, const uchar rgb[3], uchar alpha)
void BLF_color3f(int fontid, float r, float g, float b)
float BLF_fixed_width(int fontid)
char * BLF_display_name_from_id(int fontid)
void BLF_color3fv_alpha(int fontid, const float rgb[3], float alpha)
void BLF_color4fv(int fontid, const float rgba[4])
#define BLF_RESULT_CHECK_INIT(r_info)
bool blf_font_id_is_valid(int fontid)
static int blf_search_by_filepath(const char *filepath)
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)
char * BLF_display_name_from_file(const char *filepath)
bool BLF_get_vfont_metrics(int fontid, float *ascend_ratio, float *em_ratio, float *scale)
void BLF_shadow_offset(int fontid, int x, int y)
static void blf_draw_gpu__end(const FontBLF *font)
int BLF_width_max(int fontid)
int BLF_ascender(int fontid)
void BLF_batch_draw_begin()
int BLF_load_mem_unique(const char *name, const uchar *mem, int mem_size)
void BLF_buffer(int fontid, float *fbuf, uchar *cbuf, int w, int h, ColorManagedDisplay *display)
void BLF_boundbox_foreach_glyph(int fontid, const char *str, size_t str_len, BLF_GlyphBoundsFn user_fn, void *user_data)
void BLF_disable(int fontid, int option)
void BLF_rotation(int fontid, float angle)
void BLF_metrics_attach(const int fontid, const uchar *mem, const int mem_size)
void BLF_buffer_col(int fontid, const float rgba[4])
void BLF_batch_draw_end()
static void blf_draw_gpu__start(const FontBLF *font)
static int blf_search_by_mem_name(const char *mem_name)
size_t BLF_str_offset_from_cursor_position(int fontid, const char *str, size_t str_len, int location_x)
int BLF_descender(int fontid)
void BLF_unload_id(int fontid)
FontBLF * global_font[BLF_MAX_FONT]
int BLF_default_weight(int fontid)
void BLF_draw(int fontid, const char *str, const size_t str_len, ResultBLF *r_info)
void BLF_batch_draw_flush()
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_enable(int fontid, int option)
void BLF_shadow(int fontid, FontShadowType type, const float rgba[4])
void BLF_width_and_height(int fontid, const char *str, const size_t str_len, float *r_width, float *r_height)
bool BLF_is_loaded_mem(const char *name)
bool BLF_str_offset_to_glyph_bounds(int fontid, const char *str, size_t str_offset, rcti *r_glyph_bounds)
int BLF_load_unique(const char *filepath)
void BLF_color4f(int fontid, float r, float g, float b, float a)
bool BLF_has_variable_weight(int fontid)
void blf_draw_buffer__end()
void BLF_character_weight(int fontid, int weight)
float BLF_character_to_curves(int fontid, uint unicode, ListBase *nurbsbase, const float scale)
int BLF_height_max(int fontid)
void BLF_wordwrap(int fontid, int wrap_width)
void BLF_position(int fontid, float x, float y, float z)
float BLF_height(int fontid, const char *str, const size_t str_len, ResultBLF *r_info)
int BLF_load_mem(const char *name, const uchar *mem, int mem_size)
size_t blf_str_offset_from_cursor_position(FontBLF *font, const char *str, size_t str_len, int location_x)
void blf_str_offset_to_glyph_bounds(FontBLF *font, const char *str, size_t str_offset, rcti *r_glyph_bounds)
size_t blf_font_width_to_rstrlen(FontBLF *font, const char *str, const size_t str_len, int width, int *r_width)
int blf_font_ascender(FontBLF *font)
void blf_draw_svg_icon(FontBLF *font, 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)
float blf_font_width(FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
bool blf_ensure_face(FontBLF *font)
blender::Vector< blender::StringRef > blf_font_string_wrap(FontBLF *font, blender::StringRef str, int max_pixel_width)
void blf_font_draw_buffer(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, int cwidth, int tab_columns)
blender::Array< uchar > blf_svg_icon_bitmap(FontBLF *font, uint icon_id, float size, int *r_width, int *r_height, bool multicolor, blender::FunctionRef< void(std::string &)> edit_source_cb)
void blf_font_free(FontBLF *font)
void blf_font_boundbox_foreach_glyph(FontBLF *font, const char *str, const size_t str_len, BLF_GlyphBoundsFn user_fn, void *user_data)
bool blf_font_size(FontBLF *font, float size)
float blf_font_fixed_width(FontBLF *font)
float blf_font_height(FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
int blf_font_width_max(FontBLF *font)
void blf_font_boundbox__wrap(FontBLF *font, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info)
void blf_font_boundbox(FontBLF *font, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info)
uint blf_get_char_index(FontBLF *font, uint charcode)
char * blf_display_name(FontBLF *font)
FontBLF * blf_font_new_from_mem(const char *mem_name, const uchar *mem, const size_t mem_size)
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)
void blf_font_attach_from_mem(FontBLF *font, const uchar *mem, const size_t mem_size)
size_t blf_font_width_to_strlen(FontBLF *font, const char *str, const size_t str_len, int width, int *r_width)
int blf_font_descender(FontBLF *font)
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)
void blf_font_draw(FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
FontBLF * blf_font_new_from_filepath(const char *filepath)
void blf_font_draw_buffer__wrap(FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
int blf_font_height_max(FontBLF *font)
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)
void blf_font_draw__wrap(FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
void blf_glyph_cache_clear(FontBLF *font)
float blf_character_to_curves(FontBLF *font, uint unicode, ListBase *nurbsbase, const float scale)
#define BLF_VARIATION_AXIS_WEIGHT
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
local_group_size(16, 16) .push_constant(Type b
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
unsigned int reference_count
unsigned char shadow_color[4]
ColorManagedDisplay * display
unsigned char col_char[4]