119 for (; font; font = font->
next) {
124 return static_cast<uiFont *
>(
U.uifonts.first);
132 const size_t str_len,
147 const float shadow_color[4] = {
181 yofs = std::max(0, yofs);
182 xofs = std::max(0, xofs);
203 const size_t str_len,
231 const float shadow_color[4] = {
248 const int max_line_count = max_height / line_height;
255 fs,
str, str_buf,
sizeof(str_buf), max_width, max_line_count);
264 yofs = std::max(0, yofs);
278 xofs = std::max(0, xofs);
343 txtrect.
ymin - yofs - xofs - 4,
355 const float shadow_color[4] = {
382 const float col_fg[4],
383 const float col_bg[4])
391 const float margin = height / 4.0f;
394 rect.
xmin =
x - margin;
395 rect.
xmax =
x + width + margin;
396 rect.
ymin = (
y + decent) - margin;
397 rect.
ymax = (
y + decent) + height + margin;
414 style =
BLI_findstring(&
U.uistyles,
"Unifont Style",
sizeof(style) * 2);
415 return (style !=
nullptr) ? style :
U.uistyles.first;
417 return static_cast<const uiStyle *
>(
U.uistyles.first);
488 if (font_first ==
nullptr) {
493 if (
U.font_path_ui[0]) {
503 const bool unique =
false;
509 font->blf_id =
BLF_load(font->filepath);
510 if (font->blf_id == -1) {
517 if (font->blf_id == -1) {
519 CLOG_WARN(&
LOG,
"%s: error, no fonts available", __func__);
524 if (style ==
nullptr) {
537 if (
U.font_path_ui_mono[0]) {
541 const bool unique =
true;
571 if (font->blf_id != -1) {
589 const bool unique =
true;
void BLF_size(int fontid, float size)
void BLF_default_set(int fontid)
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_enable(int fontid, FontFlags flag)
void BLF_shadow(int fontid, FontShadowType type, const float rgba[4]=nullptr)
void BLF_clipping(int fontid, int xmin, int ymin, int xmax, int ymax)
int BLF_load_default(bool unique)
void BLF_cache_flush_set_fn(void(*cache_flush_fn)())
void BLF_color4fv(int fontid, const float rgba[4])
void BLF_shadow_offset(int fontid, int x, int y)
#define BLF_DRAW_STR_DUMMY_MAX
void BLF_rotation(int fontid, float angle)
void BLF_draw(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
void BLF_default_size(float size)
int BLF_load_mono_default(bool unique)
int BLF_load(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLF_load_unique(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLF_load_font_stack()
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
void BLF_disable(int fontid, FontFlags flag)
int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_color4ubv(int fontid, const unsigned char rgba[4])
int BLF_ascender(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_character_weight(int fontid, int weight)
void BLF_position(int fontid, float x, float y, float z)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
char * STRNCPY(char(&dst)[N], const char *src)
#define STRNCPY_UTF8(dst, src)
#define CLOG_WARN(clg_ref,...)
@ USER_TEXT_HINTING_SLIGHT
@ USER_TEXT_RENDER_SUBPIXELAA
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Read Guarded memory(de)allocation.
void UI_draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
#define UI_DEFAULT_TOOLTIP_POINTS
void UI_draw_roundbox_corner_set(int type)
blender::Vector< blender::StringRef > UI_text_clip_multiline_middle(const uiFontStyle *fstyle, const char *str, char *clipped_str_buf, const size_t max_len_clipped_str_buf, const float max_line_width, const int max_lines)
#define UI_DEFAULT_TITLE_POINTS
#define UI_DEFAULT_TEXT_POINTS
void UI_widgetbase_draw_cache_flush()
static uiStyle * ui_style_new(ListBase *styles, const char *name, short uifont_id)
void UI_fontstyle_draw_simple(const uiFontStyle *fs, float x, float y, const char *str, const uchar col[4])
int UI_fontstyle_string_width_with_block_aspect(const uiFontStyle *fs, const StringRef str, const float aspect)
int UI_fontstyle_string_width(const uiFontStyle *fs, const char *str)
void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs, float x, float y, const blender::StringRef str, const float col_fg[4], const float col_bg[4])
void UI_fontstyle_draw(const uiFontStyle *fs, const rcti *rect, const char *str, const size_t str_len, const uchar col[4], const uiFontStyleDraw_Params *fs_params)
const uiStyle * UI_style_get_dpi()
int UI_fontstyle_height_max(const uiFontStyle *fs)
void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const char *str, const uchar col[4])
const uiStyle * UI_style_get()
void UI_fontstyle_set(const uiFontStyle *fs)
void UI_fontstyle_draw_ex(const uiFontStyle *fs, const rcti *rect, const char *str, const size_t str_len, const uchar col[4], const uiFontStyleDraw_Params *fs_params, int *r_xofs, int *r_yofs, ResultBLF *r_info)
static void fontstyle_set_ex(const uiFontStyle *fs, const float dpi_fac)
void UI_fontstyle_draw_multiline_clipped_ex(const uiFontStyle *fs, const rcti *rect, const char *str, const uchar col[4], const eFontStyle_Align align, int *r_xofs, int *r_yofs, ResultBLF *r_info)
static uiFont * uifont_to_blfont(int id)
void UI_fontstyle_draw_multiline_clipped(const uiFontStyle *fs, const rcti *rect, const char *str, const uchar col[4], const eFontStyle_Align align)
void * MEM_callocN(size_t len, const char *str)