Blender  V3.3
interface_style.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2009 Blender Foundation. All rights reserved. */
3 
8 #include <climits>
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.h"
24 
25 #include "BLF_api.h"
26 
27 #include "BLT_translation.h"
28 
29 #include "UI_interface.h"
30 
31 #include "ED_datafiles.h"
32 
33 #include "interface_intern.h"
34 
35 #ifdef WIN32
36 # include "BLI_math_base.h" /* M_PI */
37 #endif
38 
39 /* style + theme + layout-engine = UI */
40 
56 /* ********************************************** */
57 
58 static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id)
59 {
60  uiStyle *style = MEM_cnew<uiStyle>(__func__);
61 
62  BLI_addtail(styles, style);
63  BLI_strncpy(style->name, name, MAX_STYLE_NAME);
64 
65  style->panelzoom = 1.0; /* unused */
66 
67  style->paneltitle.uifont_id = uifont_id;
69  style->paneltitle.shadow = 3;
70  style->paneltitle.shadx = 0;
71  style->paneltitle.shady = -1;
72  style->paneltitle.shadowalpha = 0.5f;
73  style->paneltitle.shadowcolor = 0.0f;
74 
75  style->grouplabel.uifont_id = uifont_id;
77  style->grouplabel.shadow = 3;
78  style->grouplabel.shadx = 0;
79  style->grouplabel.shady = -1;
80  style->grouplabel.shadowalpha = 0.5f;
81  style->grouplabel.shadowcolor = 0.0f;
82 
83  style->widgetlabel.uifont_id = uifont_id;
85  style->widgetlabel.shadow = 3;
86  style->widgetlabel.shadx = 0;
87  style->widgetlabel.shady = -1;
88  style->widgetlabel.shadowalpha = 0.5f;
89  style->widgetlabel.shadowcolor = 0.0f;
90 
91  style->widget.uifont_id = uifont_id;
93  style->widget.shadow = 1;
94  style->widget.shady = -1;
95  style->widget.shadowalpha = 0.5f;
96  style->widget.shadowcolor = 0.0f;
97 
98  style->columnspace = 8;
99  style->templatespace = 5;
100  style->boxspace = 5;
101  style->buttonspacex = 8;
102  style->buttonspacey = 2;
103  style->panelspace = 8;
104  style->panelouter = 4;
105 
106  return style;
107 }
108 
109 static uiFont *uifont_to_blfont(int id)
110 {
111  uiFont *font = static_cast<uiFont *>(U.uifonts.first);
112 
113  for (; font; font = font->next) {
114  if (font->uifont_id == id) {
115  return font;
116  }
117  }
118  return static_cast<uiFont *>(U.uifonts.first);
119 }
120 
121 /* *************** draw ************************ */
122 
124  const rcti *rect,
125  const char *str,
126  const size_t str_len,
127  const uchar col[4],
128  const struct uiFontStyleDraw_Params *fs_params,
129  int *r_xofs,
130  int *r_yofs,
131  struct ResultBLF *r_info)
132 {
133  int xofs = 0, yofs;
134  int font_flag = BLF_CLIPPING;
135 
136  UI_fontstyle_set(fs);
137 
138  /* set the flag */
139  if (fs->shadow) {
140  font_flag |= BLF_SHADOW;
141  const float shadow_color[4] = {
142  fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha};
143  BLF_shadow(fs->uifont_id, fs->shadow, shadow_color);
144  BLF_shadow_offset(fs->uifont_id, fs->shadx, fs->shady);
145  }
146  if (fs_params->word_wrap == 1) {
147  font_flag |= BLF_WORD_WRAP;
148  }
149  if (fs->bold) {
150  font_flag |= BLF_BOLD;
151  }
152  if (fs->italic) {
153  font_flag |= BLF_ITALIC;
154  }
155 
156  BLF_enable(fs->uifont_id, font_flag);
157 
158  if (fs_params->word_wrap == 1) {
159  /* Draw from bound-box top. */
160  yofs = BLI_rcti_size_y(rect) - BLF_height_max(fs->uifont_id);
161  }
162  else {
163  /* Draw from bound-box center. */
164  const int height = BLF_ascender(fs->uifont_id) + BLF_descender(fs->uifont_id);
165  yofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height));
166  }
167 
168  if (fs_params->align == UI_STYLE_TEXT_CENTER) {
169  xofs = floor(0.5f * (BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, str_len)));
170  }
171  else if (fs_params->align == UI_STYLE_TEXT_RIGHT) {
172  xofs = BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, str_len);
173  }
174 
175  yofs = MAX2(0, yofs);
176  xofs = MAX2(0, xofs);
177 
178  BLF_clipping(fs->uifont_id, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
179  BLF_position(fs->uifont_id, rect->xmin + xofs, rect->ymin + yofs, 0.0f);
181 
182  BLF_draw_ex(fs->uifont_id, str, str_len, r_info);
183 
184  BLF_disable(fs->uifont_id, font_flag);
185 
186  if (r_xofs) {
187  *r_xofs = xofs;
188  }
189  if (r_yofs) {
190  *r_yofs = yofs;
191  }
192 }
193 
195  const rcti *rect,
196  const char *str,
197  const size_t str_len,
198  const uchar col[4],
199  const struct uiFontStyleDraw_Params *fs_params)
200 {
201  UI_fontstyle_draw_ex(fs, rect, str, str_len, col, fs_params, nullptr, nullptr, nullptr);
202 }
203 
205  const rcti *rect,
206  const char *str,
207  const uchar col[4])
208 {
209  float height;
210  int xofs, yofs;
211  float angle;
212  rcti txtrect;
213 
214  UI_fontstyle_set(fs);
215 
217  /* becomes x-offset when rotated */
218  xofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height));
219 
220  /* ignore UI_STYLE, always aligned to top */
221 
222  /* Rotate counter-clockwise for now (assumes left-to-right language). */
223  xofs += height;
224  yofs = BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX) + 5;
225  angle = M_PI_2;
226 
227  /* translate rect to vertical */
228  txtrect.xmin = rect->xmin - BLI_rcti_size_y(rect);
229  txtrect.ymin = rect->ymin - BLI_rcti_size_x(rect);
230  txtrect.xmax = rect->xmin;
231  txtrect.ymax = rect->ymin;
232 
233  /* clip is very strict, so we give it some space */
234  /* clipping is done without rotation, so make rect big enough to contain both positions */
236  txtrect.xmin - 1,
237  txtrect.ymin - yofs - xofs - 4,
238  rect->xmax + 1,
239  rect->ymax + 4);
241  BLF_position(fs->uifont_id, txtrect.xmin + xofs, txtrect.ymax - yofs, 0.0f);
242 
246 
247  if (fs->shadow) {
249  const float shadow_color[4] = {
250  fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha};
251  BLF_shadow(fs->uifont_id, fs->shadow, shadow_color);
252  BLF_shadow_offset(fs->uifont_id, fs->shadx, fs->shady);
253  }
254 
258  if (fs->shadow) {
260  }
261 }
262 
264  const uiFontStyle *fs, float x, float y, const char *str, const uchar col[4])
265 {
266  UI_fontstyle_set(fs);
267  BLF_position(fs->uifont_id, x, y, 0.0f);
270 }
271 
273  float x,
274  float y,
275  const char *str,
276  const float col_fg[4],
277  const float col_bg[4])
278 {
279  UI_fontstyle_set(fs);
280 
281  {
283  const int height = BLF_height_max(fs->uifont_id);
284  const int decent = BLF_descender(fs->uifont_id);
285  const float margin = height / 4.0f;
286 
287  rctf rect;
288  rect.xmin = x - margin;
289  rect.xmax = x + width + margin;
290  rect.ymin = (y + decent) - margin;
291  rect.ymax = (y + decent) + height + margin;
293  UI_draw_roundbox_4fv(&rect, true, margin, col_bg);
294  }
295 
296  BLF_position(fs->uifont_id, x, y, 0.0f);
297  BLF_color4fv(fs->uifont_id, col_fg);
299 }
300 
301 /* ************** helpers ************************ */
302 
303 const uiStyle *UI_style_get(void)
304 {
305 #if 0
306  uiStyle *style = nullptr;
307  /* offset is two struct uiStyle pointers */
308  style = BLI_findstring(&U.uistyles, "Unifont Style", sizeof(style) * 2);
309  return (style != nullptr) ? style : U.uistyles.first;
310 #else
311  return static_cast<const uiStyle *>(U.uistyles.first);
312 #endif
313 }
314 
316 {
317  const uiStyle *style = UI_style_get();
318  static uiStyle _style;
319 
320  _style = *style;
321 
322  _style.paneltitle.shadx = (short)(UI_DPI_FAC * _style.paneltitle.shadx);
323  _style.paneltitle.shady = (short)(UI_DPI_FAC * _style.paneltitle.shady);
324  _style.grouplabel.shadx = (short)(UI_DPI_FAC * _style.grouplabel.shadx);
325  _style.grouplabel.shady = (short)(UI_DPI_FAC * _style.grouplabel.shady);
326  _style.widgetlabel.shadx = (short)(UI_DPI_FAC * _style.widgetlabel.shadx);
327  _style.widgetlabel.shady = (short)(UI_DPI_FAC * _style.widgetlabel.shady);
328 
329  _style.columnspace = (short)(UI_DPI_FAC * _style.columnspace);
330  _style.templatespace = (short)(UI_DPI_FAC * _style.templatespace);
331  _style.boxspace = (short)(UI_DPI_FAC * _style.boxspace);
332  _style.buttonspacex = (short)(UI_DPI_FAC * _style.buttonspacex);
333  _style.buttonspacey = (short)(UI_DPI_FAC * _style.buttonspacey);
334  _style.panelspace = (short)(UI_DPI_FAC * _style.panelspace);
335  _style.panelouter = (short)(UI_DPI_FAC * _style.panelouter);
336 
337  return &_style;
338 }
339 
340 int UI_fontstyle_string_width(const uiFontStyle *fs, const char *str)
341 {
342  UI_fontstyle_set(fs);
343  return (int)BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
344 }
345 
347  const char *str,
348  const float aspect)
349 {
350  uiFontStyle fs_buf;
351  if (aspect != 1.0f) {
352  fs_buf = *fs;
353  ui_fontscale(&fs_buf.points, aspect);
354  fs = &fs_buf;
355  }
356 
358 
359  if (aspect != 1.0f) {
360  /* While in most cases rounding up isn't important, it can make a difference
361  * with small fonts (3px or less), zooming out in the node-editor for e.g. */
362  width = (int)ceilf(width * aspect);
363  }
364  return width;
365 }
366 
368 {
369  UI_fontstyle_set(fs);
370  return BLF_height_max(fs->uifont_id);
371 }
372 
373 /* ************** init exit ************************ */
374 
375 void uiStyleInit(void)
376 {
377  const uiStyle *style = static_cast<uiStyle *>(U.uistyles.first);
378 
379  /* Recover from uninitialized DPI. */
380  if (U.dpi == 0) {
381  U.dpi = 72;
382  }
383  CLAMP(U.dpi, 48, 144);
384 
385  /* Needed so that custom fonts are always first. */
386  BLF_unload_all();
387 
388  uiFont *font_first = static_cast<uiFont *>(U.uifonts.first);
389 
390  /* default builtin */
391  if (font_first == nullptr) {
392  font_first = MEM_cnew<uiFont>(__func__);
393  BLI_addtail(&U.uifonts, font_first);
394  }
395 
396  if (U.font_path_ui[0]) {
397  BLI_strncpy(font_first->filepath, U.font_path_ui, sizeof(font_first->filepath));
398  font_first->uifont_id = UIFONT_CUSTOM1;
399  }
400  else {
401  BLI_strncpy(font_first->filepath, "default", sizeof(font_first->filepath));
402  font_first->uifont_id = UIFONT_DEFAULT;
403  }
404 
405  LISTBASE_FOREACH (uiFont *, font, &U.uifonts) {
406  const bool unique = false;
407 
408  if (font->uifont_id == UIFONT_DEFAULT) {
409  font->blf_id = BLF_load_default(unique);
410  }
411  else {
412  font->blf_id = BLF_load(font->filepath);
413  if (font->blf_id == -1) {
414  font->blf_id = BLF_load_default(unique);
415  }
416  }
417 
418  BLF_default_set(font->blf_id);
419 
420  if (font->blf_id == -1) {
421  if (G.debug & G_DEBUG) {
422  printf("%s: error, no fonts available\n", __func__);
423  }
424  }
425  }
426 
427  if (style == nullptr) {
428  style = ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT);
429  }
430 
432 
434 
435  /* XXX, this should be moved into a style,
436  * but for now best only load the monospaced font once. */
437  BLI_assert(blf_mono_font == -1);
438  /* Use unique font loading to avoid thread safety issues with mono font
439  * used for render metadata stamp in threads. */
440  if (U.font_path_ui_mono[0]) {
441  blf_mono_font = BLF_load_unique(U.font_path_ui_mono);
442  }
443  if (blf_mono_font == -1) {
444  const bool unique = true;
446  }
447 
448  /* Set default flags based on UI preferences (not render fonts) */
449  {
450  const int flag_disable = (BLF_MONOCHROME | BLF_HINTING_NONE | BLF_HINTING_SLIGHT |
452  int flag_enable = 0;
453 
454  if (U.text_render & USER_TEXT_HINTING_NONE) {
455  flag_enable |= BLF_HINTING_NONE;
456  }
457  else if (U.text_render & USER_TEXT_HINTING_SLIGHT) {
458  flag_enable |= BLF_HINTING_SLIGHT;
459  }
460  else if (U.text_render & USER_TEXT_HINTING_FULL) {
461  flag_enable |= BLF_HINTING_FULL;
462  }
463 
464  if (U.text_render & USER_TEXT_DISABLE_AA) {
465  flag_enable |= BLF_MONOCHROME;
466  }
467 
468  LISTBASE_FOREACH (uiFont *, font, &U.uifonts) {
469  if (font->blf_id != -1) {
470  BLF_disable(font->blf_id, flag_disable);
471  BLF_enable(font->blf_id, flag_enable);
472  }
473  }
474  if (blf_mono_font != -1) {
475  BLF_disable(blf_mono_font, flag_disable);
476  BLF_enable(blf_mono_font, flag_enable);
477  }
478  }
479 
486  if (blf_mono_font_render == -1) {
487  const bool unique = true;
489  }
490 
491  /* Load the fallback fonts last. */
493 }
494 
496 {
497  uiFont *font = uifont_to_blfont(fs->uifont_id);
498 
499  BLF_size(font->blf_id, fs->points * U.pixelsize, U.dpi);
500 }
@ G_DEBUG
Definition: BKE_global.h:174
@ BLF_ITALIC
Definition: BLF_api.h:347
@ BLF_ROTATION
Definition: BLF_api.h:334
@ BLF_HINTING_NONE
Definition: BLF_api.h:343
@ BLF_WORD_WRAP
Definition: BLF_api.h:340
@ BLF_MONOCHROME
Definition: BLF_api.h:342
@ BLF_BOLD
Definition: BLF_api.h:346
@ BLF_HINTING_FULL
Definition: BLF_api.h:345
@ BLF_HINTING_SLIGHT
Definition: BLF_api.h:344
@ BLF_SHADOW
Definition: BLF_api.h:336
@ BLF_CLIPPING
Definition: BLF_api.h:335
void BLF_default_set(int fontid)
Definition: blf_default.c:37
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
Definition: blf.c:744
void BLF_clipping(int fontid, int xmin, int ymin, int xmax, int ymax)
Definition: blf.c:775
int BLF_load_default(bool unique)
void BLF_color4fv(int fontid, const float rgba[4])
Definition: blf.c:437
void BLF_unload_all(void)
Definition: blf.c:256
void BLF_shadow_offset(int fontid, int x, int y)
Definition: blf.c:806
int blf_mono_font_render
Definition: blf.c:49
void BLF_shadow(int fontid, int level, const float rgba[4]) ATTR_NONNULL(3)
Definition: blf.c:796
#define BLF_DRAW_STR_DUMMY_MAX
Definition: BLF_api.h:356
void BLF_disable(int fontid, int option)
Definition: blf.c:279
void BLF_rotation(int fontid, float angle)
Definition: blf.c:766
void BLF_draw_ex(int fontid, const char *str, size_t str_len, struct ResultBLF *r_info) ATTR_NONNULL(2)
Definition: blf.c:521
void BLF_cache_flush_set_fn(void(*cache_flush_fn)(void))
Definition: blf_font.c:1188
void BLF_default_size(float size)
Definition: blf_default.c:32
int BLF_load_unique(const char *name) ATTR_NONNULL()
Definition: blf.c:148
int BLF_load_mono_default(bool unique)
float BLF_width(int fontid, const char *str, size_t str_len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: blf.c:688
void BLF_draw(int fontid, const char *str, size_t str_len) ATTR_NONNULL(2)
Definition: blf.c:538
int blf_mono_font
Definition: blf.c:48
void BLF_load_font_stack(void)
void BLF_enable(int fontid, int option)
Definition: blf.c:270
int BLF_load(const char *name) ATTR_NONNULL()
Definition: blf.c:135
int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT
Definition: blf.c:722
void BLF_color4ubv(int fontid, const unsigned char rgba[4])
Definition: blf.c:383
void BLF_size(int fontid, float size, int dpi)
Definition: blf.c:363
int BLF_ascender(int fontid) ATTR_WARN_UNUSED_RESULT
Definition: blf.c:755
void BLF_position(int fontid, float x, float y, float z)
Definition: blf.c:308
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define M_PI_2
Definition: BLI_math_base.h:23
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:190
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:186
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
unsigned char uchar
Definition: BLI_sys_types.h:70
#define MAX2(a, b)
#define MAX_STYLE_NAME
@ UIFONT_DEFAULT
@ UIFONT_CUSTOM1
@ USER_TEXT_HINTING_SLIGHT
@ USER_TEXT_HINTING_FULL
@ USER_TEXT_DISABLE_AA
@ USER_TEXT_HINTING_NONE
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
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 Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
void UI_draw_roundbox_4fv(const struct rctf *rect, bool filled, float rad, const float col[4])
void UI_draw_roundbox_corner_set(int type)
@ UI_STYLE_TEXT_CENTER
@ UI_STYLE_TEXT_RIGHT
#define UI_DPI_FAC
Definition: UI_interface.h:305
@ UI_CNR_ALL
#define UI_DEFAULT_TITLE_POINTS
Definition: UI_interface.h:238
#define UI_DEFAULT_TEXT_POINTS
Definition: UI_interface.h:235
void UI_widgetbase_draw_cache_flush(void)
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
#define str(s)
uint col
void ui_fontscale(float *points, float aspect)
Definition: interface.cc:2014
int UI_fontstyle_string_width_with_block_aspect(const uiFontStyle *fs, const char *str, const float aspect)
void UI_fontstyle_draw(const uiFontStyle *fs, const rcti *rect, const char *str, const size_t str_len, const uchar col[4], const struct uiFontStyleDraw_Params *fs_params)
void UI_fontstyle_draw_ex(const uiFontStyle *fs, const rcti *rect, const char *str, const size_t str_len, const uchar col[4], const struct uiFontStyleDraw_Params *fs_params, int *r_xofs, int *r_yofs, struct ResultBLF *r_info)
void UI_fontstyle_draw_simple(const uiFontStyle *fs, float x, float y, const char *str, const uchar col[4])
int UI_fontstyle_string_width(const uiFontStyle *fs, const char *str)
const uiStyle * UI_style_get_dpi(void)
const uiStyle * UI_style_get(void)
void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs, float x, float y, const char *str, const float col_fg[4], const float col_bg[4])
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])
void UI_fontstyle_set(const uiFontStyle *fs)
static uiFont * uifont_to_blfont(int id)
void uiStyleInit(void)
static uiStyle * ui_style_new(ListBase *styles, const char *name, short uifont_id)
ccl_device_inline float3 ceil(const float3 &a)
Definition: math_float3.h:363
#define G(x, y, z)
#define ceilf(x)
Definition: metal/compat.h:225
T floor(const T &a)
float xmax
Definition: DNA_vec_types.h:69
float xmin
Definition: DNA_vec_types.h:69
float ymax
Definition: DNA_vec_types.h:70
float ymin
Definition: DNA_vec_types.h:70
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63
eFontStyle_Align align
short blf_id
struct uiFont * next
char filepath[1024]
short uifont_id
short boxspace
short buttonspacey
uiFontStyle paneltitle
uiFontStyle grouplabel
short buttonspacex
short panelouter
short templatespace
short panelspace
float panelzoom
uiFontStyle widget
short columnspace
char name[64]
uiFontStyle widgetlabel