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