Blender V5.0
interface_style.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cmath>
10#include <cstdio>
11#include <cstdlib>
12#include <cstring>
13
14#include "MEM_guardedalloc.h"
15
16#include "DNA_userdef_types.h"
17
18#include "BLI_listbase.h"
19#include "BLI_rect.h"
20#include "BLI_string.h"
21#include "BLI_string_utf8.h"
22#include "BLI_utildefines.h"
23
24#include "BKE_global.hh"
25
26#include "BLF_api.hh"
27
28#include "CLG_log.h"
29
30#include "interface_intern.hh"
31
32#ifdef WIN32
33# include "BLI_math_base.h" /* M_PI */
34#endif
35
37
38static CLG_LogRef LOG = {"ui.font"};
39
40static void fontstyle_set_ex(const uiFontStyle *fs, const float dpi_fac);
41
42/* style + theme + layout-engine = UI */
43
58
59/* ********************************************** */
60
61static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id)
62{
63 uiStyle *style = MEM_callocN<uiStyle>(__func__);
64
65 BLI_addtail(styles, style);
66 STRNCPY_UTF8(style->name, name);
67
68 style->panelzoom = 1.0; /* unused */
69
70 style->paneltitle.uifont_id = uifont_id;
72 style->paneltitle.character_weight = 400;
73 style->paneltitle.shadow = 3;
74 style->paneltitle.shadx = 0;
75 style->paneltitle.shady = -1;
76 style->paneltitle.shadowalpha = 0.5f;
77 style->paneltitle.shadowcolor = 0.0f;
78
79 style->grouplabel.uifont_id = uifont_id;
81 style->grouplabel.character_weight = 400;
82 style->grouplabel.shadow = 3;
83 style->grouplabel.shadx = 0;
84 style->grouplabel.shady = -1;
85 style->grouplabel.shadowalpha = 0.5f;
86 style->grouplabel.shadowcolor = 0.0f;
87
88 style->widget.uifont_id = uifont_id;
90 style->widget.character_weight = 400;
91 style->widget.shadow = 1;
92 style->widget.shady = -1;
93 style->widget.shadowalpha = 0.5f;
94 style->widget.shadowcolor = 0.0f;
95
96 style->tooltip.uifont_id = uifont_id;
98 style->tooltip.character_weight = 400;
99 style->tooltip.shadow = 1;
100 style->tooltip.shady = -1;
101 style->tooltip.shadowalpha = 0.5f;
102 style->tooltip.shadowcolor = 0.0f;
103
104 style->columnspace = 8;
105 style->templatespace = 5;
106 style->boxspace = 5;
107 style->buttonspacex = 8;
108 style->buttonspacey = 2;
109 style->panelspace = 8;
110 style->panelouter = 4;
111
112 return style;
113}
114
116{
117 uiFont *font = static_cast<uiFont *>(U.uifonts.first);
118
119 for (; font; font = font->next) {
120 if (font->uifont_id == id) {
121 return font;
122 }
123 }
124 return static_cast<uiFont *>(U.uifonts.first);
125}
126
127/* *************** draw ************************ */
128
130 const rcti *rect,
131 const char *str,
132 const size_t str_len,
133 const uchar col[4],
134 const uiFontStyleDraw_Params *fs_params,
135 int *r_xofs,
136 int *r_yofs,
137 ResultBLF *r_info)
138{
139 int xofs = 0, yofs;
140 FontFlags font_flag = BLF_CLIPPING;
141
143
144 /* set the flag */
145 if (fs->shadow) {
146 font_flag |= BLF_SHADOW;
147 const float shadow_color[4] = {
149 BLF_shadow(fs->uifont_id, FontShadowType(fs->shadow), shadow_color);
150 BLF_shadow_offset(fs->uifont_id, fs->shadx, fs->shady);
151 }
152 if (fs_params->word_wrap == 1) {
153 font_flag |= BLF_WORD_WRAP;
154 }
155 if (fs->bold) {
156 font_flag |= BLF_BOLD;
157 }
158 if (fs->italic) {
159 font_flag |= BLF_ITALIC;
160 }
161
162 BLF_enable(fs->uifont_id, font_flag);
163
164 if (fs_params->word_wrap == 1) {
165 /* Draw from bound-box top. */
166 yofs = BLI_rcti_size_y(rect) - BLF_height_max(fs->uifont_id);
167 }
168 else {
169 /* Draw from bound-box center. */
170 const int height = BLF_ascender(fs->uifont_id) + BLF_descender(fs->uifont_id);
171 yofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height));
172 }
173
174 if (fs_params->align == UI_STYLE_TEXT_CENTER) {
175 xofs = floor(0.5f * (BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, str_len)));
176 }
177 else if (fs_params->align == UI_STYLE_TEXT_RIGHT) {
178 xofs = BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, str_len);
179 }
180
181 yofs = std::max(0, yofs);
182 xofs = std::max(0, xofs);
183
184 BLF_clipping(fs->uifont_id, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
185 BLF_position(fs->uifont_id, rect->xmin + xofs, rect->ymin + yofs, 0.0f);
187
188 BLF_draw(fs->uifont_id, str, str_len, r_info);
189
190 BLF_disable(fs->uifont_id, font_flag);
191
192 if (r_xofs) {
193 *r_xofs = xofs;
194 }
195 if (r_yofs) {
196 *r_yofs = yofs;
197 }
198}
199
201 const rcti *rect,
202 const char *str,
203 const size_t str_len,
204 const uchar col[4],
205 const uiFontStyleDraw_Params *fs_params)
206{
207 UI_fontstyle_draw_ex(fs, rect, str, str_len, col, fs_params, nullptr, nullptr, nullptr);
208}
209
211 const rcti *rect,
212 const char *str,
213 const uchar col[4],
214 const eFontStyle_Align align,
215 int *r_xofs,
216 int *r_yofs,
217 ResultBLF *r_info)
218{
219 int xofs = 0, yofs;
220 FontFlags font_flag = BLF_CLIPPING;
221
222 /* Recommended for testing: Results should be the same with or without BLF clipping since the
223 * string is wrapped and shortened to fit. Disabling it can help spot issues. */
224 // font_flag &= ~BLF_CLIPPING;
225
227
228 /* set the flag */
229 if (fs->shadow) {
230 font_flag |= BLF_SHADOW;
231 const float shadow_color[4] = {
233 BLF_shadow(fs->uifont_id, FontShadowType(fs->shadow), shadow_color);
234 BLF_shadow_offset(fs->uifont_id, fs->shadx, fs->shady);
235 }
236 if (fs->bold) {
237 font_flag |= BLF_BOLD;
238 }
239 if (fs->italic) {
240 font_flag |= BLF_ITALIC;
241 }
242
243 BLF_enable(fs->uifont_id, font_flag);
244
245 const int max_width = BLI_rcti_size_x(rect);
246 const int max_height = BLI_rcti_size_y(rect);
247 const int line_height = BLF_height_max(fs->uifont_id);
248 const int max_line_count = max_height / line_height;
249
250 BLF_clipping(fs->uifont_id, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
252
253 char str_buf[UI_MAX_DRAW_STR];
255 fs, str, str_buf, sizeof(str_buf), max_width, max_line_count);
256
257 BLI_assert(lines.size() <= max_line_count);
258
259 /* Draw so that overall text is centered vertically. */
260 yofs = (max_height + lines.size() * line_height) / 2.0f - BLF_ascender(fs->uifont_id) -
261 /* Not sure subtracting the descender is always wanted,
262 * gives best results where this is currently used. */
263 BLF_descender(fs->uifont_id) / 2.0f;
264 yofs = std::max(0, yofs);
265
266 ResultBLF line_result = {0, 0};
267 /* Draw each line with the given alignment. */
268 for (StringRef line : lines) {
269 /* String wrapping might have trailing/leading white-space. */
270 line = line.trim();
271
272 if (align == UI_STYLE_TEXT_CENTER) {
273 xofs = floor(0.5f * (max_width - BLF_width(fs->uifont_id, line.data(), line.size())));
274 }
275 else if (align == UI_STYLE_TEXT_RIGHT) {
276 xofs = max_width - BLF_width(fs->uifont_id, line.data(), line.size());
277 }
278 xofs = std::max(0, xofs);
279
280 BLF_position(fs->uifont_id, rect->xmin + xofs, rect->ymin + yofs, 0.0f);
281 BLF_draw(fs->uifont_id, line.data(), line.size(), &line_result);
282
283 yofs -= line_height;
284 }
285
286 if (r_info) {
287 r_info->width = rect->xmin + xofs + line_result.width;
288 r_info->lines = lines.size();
289 }
290
291 BLF_disable(fs->uifont_id, font_flag);
292
293 if (r_xofs) {
294 *r_xofs = xofs;
295 }
296 if (r_yofs) {
297 *r_yofs = yofs;
298 }
299}
300
302 const rcti *rect,
303 const char *str,
304 const uchar col[4],
305 const eFontStyle_Align align)
306{
307 UI_fontstyle_draw_multiline_clipped_ex(fs, rect, str, col, align, nullptr, nullptr, nullptr);
308}
309
311 const rcti *rect,
312 const char *str,
313 const uchar col[4])
314{
315 float height;
316 int xofs, yofs;
317 float angle;
318 rcti txtrect;
319
321
322 height = BLF_ascender(fs->uifont_id) + BLF_descender(fs->uifont_id);
323 /* becomes x-offset when rotated */
324 xofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height));
325
326 /* ignore UI_STYLE, always aligned to top */
327
328 /* Rotate counter-clockwise for now (assumes left-to-right language). */
329 xofs += height;
331 angle = M_PI_2;
332
333 /* translate rect to vertical */
334 txtrect.xmin = rect->xmin - BLI_rcti_size_y(rect);
335 txtrect.ymin = rect->ymin - BLI_rcti_size_x(rect);
336 txtrect.xmax = rect->xmin;
337 txtrect.ymax = rect->ymin;
338
339 /* clip is very strict, so we give it some space */
340 /* clipping is done without rotation, so make rect big enough to contain both positions */
342 txtrect.xmin - 1,
343 txtrect.ymin - yofs - xofs - 4,
344 rect->xmax + 1,
345 rect->ymax + 4);
347 BLF_position(fs->uifont_id, txtrect.xmin + xofs, txtrect.ymax - yofs, 0.0f);
348
352
353 if (fs->shadow) {
355 const float shadow_color[4] = {
357 BLF_shadow(fs->uifont_id, FontShadowType(fs->shadow), shadow_color);
358 BLF_shadow_offset(fs->uifont_id, fs->shadx, fs->shady);
359 }
360
364 if (fs->shadow) {
366 }
367}
368
370 const uiFontStyle *fs, float x, float y, const char *str, const uchar col[4])
371{
373 BLF_position(fs->uifont_id, x, y, 0.0f);
376}
377
379 float x,
380 float y,
382 const float col_fg[4],
383 const float col_bg[4])
384{
386
387 {
388 const int width = BLF_width(fs->uifont_id, str.data(), str.size());
389 const int height = BLF_height_max(fs->uifont_id);
390 const int decent = BLF_descender(fs->uifont_id);
391 const float margin = height / 4.0f;
392
393 rctf rect;
394 rect.xmin = x - margin;
395 rect.xmax = x + width + margin;
396 rect.ymin = (y + decent) - margin;
397 rect.ymax = (y + decent) + height + margin;
399 UI_draw_roundbox_4fv(&rect, true, margin, col_bg);
400 }
401
402 BLF_position(fs->uifont_id, x, y, 0.0f);
403 BLF_color4fv(fs->uifont_id, col_fg);
404 BLF_draw(fs->uifont_id, str.data(), str.size());
405}
406
407/* ************** helpers ************************ */
408
410{
411#if 0
412 uiStyle *style = nullptr;
413 /* offset is two struct uiStyle pointers */
414 style = BLI_findstring(&U.uistyles, "Unifont Style", sizeof(style) * 2);
415 return (style != nullptr) ? style : U.uistyles.first;
416#else
417 return static_cast<const uiStyle *>(U.uistyles.first);
418#endif
419}
420
422{
423 const uiStyle *style = UI_style_get();
424 static uiStyle _style;
425
426 _style = *style;
427
428 _style.paneltitle.shadx = short(UI_SCALE_FAC * _style.paneltitle.shadx);
429 _style.paneltitle.shady = short(UI_SCALE_FAC * _style.paneltitle.shady);
430 _style.grouplabel.shadx = short(UI_SCALE_FAC * _style.grouplabel.shadx);
431 _style.grouplabel.shady = short(UI_SCALE_FAC * _style.grouplabel.shady);
432 _style.widget.shadx = short(UI_SCALE_FAC * _style.widget.shadx);
433 _style.widget.shady = short(UI_SCALE_FAC * _style.widget.shady);
434 _style.tooltip.shadx = short(UI_SCALE_FAC * _style.tooltip.shadx);
435 _style.tooltip.shady = short(UI_SCALE_FAC * _style.tooltip.shady);
436
437 _style.columnspace = short(UI_SCALE_FAC * _style.columnspace);
438 _style.templatespace = short(UI_SCALE_FAC * _style.templatespace);
439 _style.boxspace = short(UI_SCALE_FAC * _style.boxspace);
440 _style.buttonspacex = short(UI_SCALE_FAC * _style.buttonspacex);
441 _style.buttonspacey = short(UI_SCALE_FAC * _style.buttonspacey);
442 _style.panelspace = short(UI_SCALE_FAC * _style.panelspace);
443 _style.panelouter = short(UI_SCALE_FAC * _style.panelouter);
444
445 return &_style;
446}
447
448int UI_fontstyle_string_width(const uiFontStyle *fs, const char *str)
449{
452}
453
455 const StringRef str,
456 const float aspect)
457{
458 /* FIXME(@ideasman42): the final scale of the font is rounded which should be accounted for.
459 * Failing to do so causes bad alignment when zoomed out very far in the node-editor. */
460 fontstyle_set_ex(fs, UI_SCALE_FAC / aspect);
461 return int(BLF_width(fs->uifont_id, str.data(), str.size()) * aspect);
462}
463
465{
467 return BLF_height_max(fs->uifont_id);
468}
469
470/* ************** init exit ************************ */
471
473{
474 const uiStyle *style = static_cast<uiStyle *>(U.uistyles.first);
475
476 /* Recover from uninitialized DPI. */
477 if (U.dpi == 0) {
478 U.dpi = 72;
479 }
480 CLAMP(U.dpi, 48, 144);
481
482 /* Needed so that custom fonts are always first. */
484
485 uiFont *font_first = static_cast<uiFont *>(U.uifonts.first);
486
487 /* default builtin */
488 if (font_first == nullptr) {
489 font_first = MEM_callocN<uiFont>(__func__);
490 BLI_addtail(&U.uifonts, font_first);
491 }
492
493 if (U.font_path_ui[0]) {
494 STRNCPY(font_first->filepath, U.font_path_ui);
495 font_first->uifont_id = UIFONT_CUSTOM1;
496 }
497 else {
498 STRNCPY(font_first->filepath, "default");
499 font_first->uifont_id = UIFONT_DEFAULT;
500 }
501
502 LISTBASE_FOREACH (uiFont *, font, &U.uifonts) {
503 const bool unique = false;
504
505 if (font->uifont_id == UIFONT_DEFAULT) {
506 font->blf_id = BLF_load_default(unique);
507 }
508 else {
509 font->blf_id = BLF_load(font->filepath);
510 if (font->blf_id == -1) {
511 font->blf_id = BLF_load_default(unique);
512 }
513 }
514
515 BLF_default_set(font->blf_id);
516
517 if (font->blf_id == -1) {
518 if (G.debug & G_DEBUG) {
519 CLOG_WARN(&LOG, "%s: error, no fonts available", __func__);
520 }
521 }
522 }
523
524 if (style == nullptr) {
525 style = ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT);
526 }
527
529
531
532 /* XXX, this should be moved into a style,
533 * but for now best only load the monospaced font once. */
535 /* Use unique font loading to avoid thread safety issues with mono font
536 * used for render metadata stamp in threads. */
537 if (U.font_path_ui_mono[0]) {
538 blf_mono_font = BLF_load_unique(U.font_path_ui_mono);
539 }
540 if (blf_mono_font == -1) {
541 const bool unique = true;
543 }
544
545 /* Set default flags based on UI preferences (not render fonts) */
546 {
549 FontFlags flag_enable = BLF_NONE;
550
551 if (U.text_render & USER_TEXT_HINTING_NONE) {
552 flag_enable |= BLF_HINTING_NONE;
553 }
554 else if (U.text_render & USER_TEXT_HINTING_SLIGHT) {
555 flag_enable |= BLF_HINTING_SLIGHT;
556 }
557 else if (U.text_render & USER_TEXT_HINTING_FULL) {
558 flag_enable |= BLF_HINTING_FULL;
559 }
560
561 if (U.text_render & USER_TEXT_DISABLE_AA) {
562 flag_enable |= BLF_MONOCHROME;
563 }
564 else {
565 if (U.text_render & USER_TEXT_RENDER_SUBPIXELAA) {
566 flag_enable |= BLF_RENDER_SUBPIXELAA;
567 }
568 }
569
570 LISTBASE_FOREACH (uiFont *, font, &U.uifonts) {
571 if (font->blf_id != -1) {
572 BLF_disable(font->blf_id, flag_disable);
573 BLF_enable(font->blf_id, flag_enable);
574 }
575 }
576 if (blf_mono_font != -1) {
577 BLF_disable(blf_mono_font, flag_disable);
578 BLF_enable(blf_mono_font, flag_enable);
579 }
580 }
581
588 if (blf_mono_font_render == -1) {
589 const bool unique = true;
591 }
592
593 /* Load the fallback fonts last. */
595}
596
597static void fontstyle_set_ex(const uiFontStyle *fs, const float dpi_fac)
598{
599 const uiFont *font = uifont_to_blfont(fs->uifont_id);
600
601 BLF_size(font->blf_id, fs->points * dpi_fac);
603}
604
606{
608}
@ G_DEBUG
void BLF_size(int fontid, float size)
Definition blf.cc:443
void BLF_default_set(int fontid)
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
Definition blf.cc:872
void BLF_enable(int fontid, FontFlags flag)
Definition blf.cc:320
void BLF_shadow(int fontid, FontShadowType type, const float rgba[4]=nullptr)
Definition blf.cc:934
void BLF_unload_all()
Definition blf.cc:297
void BLF_clipping(int fontid, int xmin, int ymin, int xmax, int ymax)
Definition blf.cc:912
int BLF_load_default(bool unique)
void BLF_cache_flush_set_fn(void(*cache_flush_fn)())
Definition blf_font.cc:1633
void BLF_color4fv(int fontid, const float rgba[4])
Definition blf.cc:505
void BLF_shadow_offset(int fontid, int x, int y)
Definition blf.cc:946
int blf_mono_font_render
Definition blf.cc:49
#define BLF_DRAW_STR_DUMMY_MAX
Definition BLF_api.hh:440
void BLF_rotation(int fontid, float angle)
Definition blf.cc:903
void BLF_draw(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
Definition blf.cc:585
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)
Definition blf.cc:175
int blf_mono_font
Definition blf.cc:48
int BLF_load_unique(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition blf.cc:188
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)
Definition blf.cc:802
void BLF_disable(int fontid, FontFlags flag)
Definition blf.cc:329
int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT
Definition blf.cc:850
void BLF_color4ubv(int fontid, const unsigned char rgba[4])
Definition blf.cc:452
int BLF_ascender(int fontid) ATTR_WARN_UNUSED_RESULT
Definition blf.cc:883
void BLF_character_weight(int fontid, int weight)
Definition blf.cc:347
void BLF_position(int fontid, float x, float y, float z)
Definition blf.cc:388
FontFlags
Definition BLF_enums.hh:31
@ BLF_RENDER_SUBPIXELAA
Definition BLF_enums.hh:62
@ BLF_ITALIC
Definition BLF_enums.hh:46
@ BLF_ROTATION
Definition BLF_enums.hh:33
@ BLF_HINTING_NONE
Definition BLF_enums.hh:42
@ BLF_NONE
Definition BLF_enums.hh:32
@ BLF_WORD_WRAP
Definition BLF_enums.hh:39
@ BLF_MONOCHROME
Definition BLF_enums.hh:41
@ BLF_BOLD
Definition BLF_enums.hh:45
@ BLF_HINTING_FULL
Definition BLF_enums.hh:44
@ BLF_HINTING_SLIGHT
Definition BLF_enums.hh:43
@ BLF_SHADOW
Definition BLF_enums.hh:35
@ BLF_CLIPPING
Definition BLF_enums.hh:34
FontShadowType
Definition BLF_enums.hh:13
#define BLI_assert(a)
Definition BLI_assert.h:46
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:608
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
#define M_PI_2
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.h:198
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:194
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:693
#define STRNCPY_UTF8(dst, src)
unsigned char uchar
#define CLAMP(a, b, c)
#define CLOG_WARN(clg_ref,...)
Definition CLG_log.h:189
@ UIFONT_DEFAULT
@ UIFONT_CUSTOM1
#define UI_SCALE_FAC
@ USER_TEXT_HINTING_SLIGHT
@ USER_TEXT_HINTING_FULL
@ USER_TEXT_DISABLE_AA
@ USER_TEXT_HINTING_NONE
@ USER_TEXT_RENDER_SUBPIXELAA
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Definition IK_Math.h:117
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)
eFontStyle_Align
@ UI_STYLE_TEXT_CENTER
@ UI_STYLE_TEXT_RIGHT
@ UI_CNR_ALL
#define UI_DEFAULT_TITLE_POINTS
#define UI_DEFAULT_TEXT_POINTS
void UI_widgetbase_draw_cache_flush()
#define UI_MAX_DRAW_STR
#define U
int64_t size() const
#define str(s)
uint col
#define floor
#define ceil
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()
void uiStyleInit()
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)
#define LOG(level)
Definition log.h:97
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
#define G(x, y, z)
const char * name
int lines
Definition BLF_api.hh:453
int width
Definition BLF_api.hh:457
float xmax
float xmin
float ymax
float ymin
int ymin
int ymax
int xmin
int xmax
short blf_id
struct uiFont * next
char filepath[1024]
short uifont_id
short buttonspacey
uiFontStyle tooltip
uiFontStyle paneltitle
uiFontStyle grouplabel
short buttonspacex
short panelouter
short templatespace
short panelspace
float panelzoom
uiFontStyle widget
short columnspace
char name[64]