23#include FT_MULTIPLE_MASTERS_H
24#include FT_TRUETYPE_IDS_H
25#include FT_TRUETYPE_TABLES_H
54# define FT_New_Face FT_New_Face__win32_compat
87 FT_Face face =
static_cast<FT_Face
>(object);
103 int err = FT_Err_Cannot_Open_Resource;
109 else if (font->
mem) {
110 err = FT_New_Memory_Face(
111 lib,
static_cast<const FT_Byte *
>(font->
mem), (FT_Long)font->
mem_size, 0, face);
114 if (err == FT_Err_Ok) {
116 font->
face->generic.data = font;
121 err = FT_Err_Cannot_Open_Resource;
137 FT_Size
size =
static_cast<FT_Size
>(object);
165 FT_Long
scaled = FT_MulFix(value, font->
ft_size->metrics.x_scale);
169 if (font->
ft_size->metrics.x_ppem < 25) {
207 if (
g_batch.batch ==
nullptr) {
211 const bool font_changed = (
g_batch.font != font);
213 const bool shader_changed = (simple_shader !=
g_batch.simple_shader);
241 if (mat_changed || font_changed || shader_changed) {
243 g_batch.simple_shader = simple_shader;
261 g_batch.simple_shader = simple_shader;
275 int remain = gc->
bitmap_len - bitmap_len_landed;
276 int offset_x = bitmap_len_landed % tex_width;
277 int offset_y = bitmap_len_landed / tex_width;
281 int remain_row = tex_width - offset_x;
282 int width = remain > remain_row ? remain_row : remain;
293 bitmap_len_landed += width;
368 if (FT_HAS_KERNING(font) && g_prev) {
379 FT_Get_Kerning(font->
face, g_prev->
idx, g->
idx, FT_KERNING_UNSCALED, &delta);
400 const size_t str_len,
412#ifdef BLF_SUBPIXEL_POSITION
420#ifdef BLF_SUBPIXEL_AA
437 const size_t str_len,
440 if (is_utf8_valid == -1) {
443 return is_utf8_valid;
455 const size_t str_len,
470 while ((
i < str_len) &&
str[
i]) {
495 FontBLF *font,
const char *
str,
const size_t str_len,
const int cwidth,
const int tab_columns)
499 ft_pix pen_x = 0, pen_y = 0;
508 while ((
i < str_len) &&
str[
i]) {
517 const int col =
UNLIKELY(g->
c ==
'\t') ? (tab_columns - (columns % tab_columns)) :
520 pen_x += cwidth_fpx *
col;
535 const float color[4],
536 const float outline_alpha,
537 const bool multicolor,
542 font->
pos[0] = int(
x);
543 font->
pos[1] = int(
y);
546 if (color !=
nullptr) {
550 if (outline_alpha > 0.0f) {
569 if (outline_alpha > 0) {
582 const bool multicolor,
596 *r_width = g->
dims[0];
597 *r_height = g->
dims[1];
639 if ((chx + g->
dims[0]) < 0 ||
640 chx >= buf_info->
dims[0] ||
649 int width_clip = g->
dims[0];
650 int height_clip = g->
dims[1];
651 int yb_start = g->
pitch < 0 ? 0 : g->
dims[1] - 1;
653 if (width_clip + chx > buf_info->
dims[0]) {
654 width_clip -= chx + width_clip - buf_info->
dims[0];
670 const float *b_col_float = buf_info->
col_float;
673 if (buf_info->
fbuf) {
675 for (
int y = ((chy >= 0) ? 0 : -chy);
y < height_clip;
y++) {
676 const int x_start = (chx >= 0) ? 0 : -chx;
678 const int64_t buf_ofs = (
int64_t(buf_info->
dims[0]) * (pen_y_px +
y) + (chx + x_start)) * 4;
679 float *fbuf = buf_info->
fbuf + buf_ofs;
680 for (
int x = x_start;
x < width_clip;
x++, a_ptr++, fbuf += 4) {
681 const char a_byte = *a_ptr;
683 const float a = (a_byte / 255.0f) * b_col_float[3];
686 font_pixel[0] = b_col_float[0] * a;
687 font_pixel[1] = b_col_float[1] * a;
688 font_pixel[2] = b_col_float[2] * a;
703 if (buf_info->
cbuf) {
705 for (
int y = ((chy >= 0) ? 0 : -chy);
y < height_clip;
y++) {
706 const int x_start = (chx >= 0) ? 0 : -chx;
708 const int64_t buf_ofs = (
int64_t(buf_info->
dims[0]) * (pen_y_px +
y) + (chx + x_start)) * 4;
710 for (
int x = x_start;
x < width_clip;
x++, a_ptr++, cbuf += 4) {
711 const char a_byte = *a_ptr;
714 const float a = (a_byte / 255.0f) * b_col_float[3];
717 font_pixel[0] = b_col_char[0];
718 font_pixel[1] = b_col_char[1];
719 font_pixel[2] = b_col_char[2];
739 const size_t str_len,
753 while ((
i < str_len) &&
str[
i]) {
801#ifdef BLF_SUBPIXEL_POSITION
809#ifdef BLF_SUBPIXEL_AA
821 FontBLF *font,
const char *
str,
const size_t str_len,
int width,
int *r_width)
830 const int width_i = width;
832 for (i_prev =
i = 0, width_new = pen_x = 0, g_prev =
nullptr; (
i < str_len) &&
str[
i];
833 i_prev =
i, width_new = pen_x, g_prev = g)
850 FontBLF *font,
const char *
str,
const size_t str_len,
int width,
int *r_width)
854 size_t i, i_prev, i_tmp;
855 std::optional<size_t> i_next = {};
856 const char *s, *s_prev;
860 int is_utf8_valid = -1;
867 i_prev = size_t(s_prev -
str);
871 for (width_new = pen_x = 0; (s !=
nullptr &&
i > 0);
872 i_next =
i,
i = i_prev, s = s_prev, g = g_prev, g_prev =
nullptr, width_new = pen_x)
875 i_prev = size_t(s_prev -
str);
893 return i_next ? *i_next :
i;
905 const size_t str_len,
919 while ((
i < str_len) &&
str[
i]) {
931 std::max(pen_x_next, pen_x + g->
box_xmax);
935 box_xmin = std::min(gbox_xmin, box_xmin);
936 box_ymin = std::min(gbox_ymin, box_ymin);
938 box_xmax = std::max(gbox_xmax, box_xmax);
939 box_ymax = std::max(gbox_ymax, box_ymax);
944 if (box_xmin > box_xmax) {
971 const size_t str_len,
1062 return glyph_advance;
1067 const size_t str_len,
1071 if (str_len == 0 ||
str[0] == 0) {
1082 while ((
i < str_len) &&
str[
i]) {
1083 const size_t i_curr =
i;
1096 if (user_fn(
str, i_curr, &
bounds, user_data) ==
false) {
1113 const size_t str_step_ofs,
1120 data->r_offset = str_step_ofs;
1134 if (!
str || !
str[0] || !str_len) {
1139 data.location_x = location_x;
1140 data.r_offset = size_t(-1);
1144 if (
data.r_offset ==
size_t(-1)) {
1150 int offset = int(
data.r_offset);
1152 data.r_offset = size_t(offset);
1155 return data.r_offset;
1164 const size_t str_step_ofs,
1169 if (
data->str_offset == str_step_ofs) {
1179 rcti *r_glyph_bounds)
1182 data.str_offset = str_offset;
1186 *r_glyph_bounds =
data.bounds;
1191 const size_t str_len,
1192 const size_t str_offset,
1193 const int cursor_width)
1201 if (str_offset > 0) {
1207 if (str_offset < strlen(
str)) {
1211 if ((prev.xmax == prev.xmin) &&
next.xmax) {
1213 return next.xmin - (cursor_width / 2);
1215 if ((prev.xmax != prev.xmin) && !
next.xmax) {
1217 return prev.xmax - (cursor_width / 2);
1219 if (prev.xmax &&
next.xmax) {
1221 if (
next.xmin >= prev.xmax ||
next.xmin ==
next.xmax) {
1222 return ((prev.xmax +
next.xmin) - cursor_width) / 2;
1225 return ((
next.xmax + prev.xmin) - cursor_width) / 2;
1229 return 0 - cursor_width;
1235 FontBLF *font,
const char *
str,
size_t str_len,
size_t sel_start,
size_t sel_length)
1261 const size_t str_len,
1262 const int max_pixel_width,
1265 void (*callback)(
FontBLF *font,
1268 const size_t str_len,
1282 size_t clip_bytes = 0;
1288 struct WordWrapVars {
1290 size_t start, last[2];
1294 while ((
i < str_len) &&
str[
i]) {
1297 const size_t i_curr =
i;
1298 bool do_draw =
false;
1304 const uint codepoint_prev = g_prev ? g_prev->
c : 0;
1314 pen_x_next = pen_x + advance_x;
1320 (pen_x_next >=
wrap.wrap_width) && (advance_x != 0)))
1322 wrap.last[0] = i_curr;
1323 wrap.last[1] = i_curr;
1329 wrap.last[0] =
i + ((codepoint !=
'\n') ? 1 : 0);
1334 else if (
UNLIKELY(codepoint ==
'\n')) {
1335 wrap.last[0] = i_curr + 1;
1341 codepoint !=
' ' && (g_prev ? g_prev->
c ==
' ' :
false)))
1343 wrap.last[0] = i_curr;
1344 wrap.last[1] = i_curr;
1348 if (
ELEM(codepoint,
SEP,
' ',
'?',
'&',
'=')) {
1354 else if (
ELEM(codepoint,
'-',
'_',
'.',
'%')) {
1356 wrap.last[0] = i_curr;
1357 wrap.last[1] = i_curr;
1366 wrap.last[0] = i_curr;
1367 wrap.last[1] = i_curr;
1382 wrap.last[0] = i_curr;
1383 wrap.last[1] = i_curr;
1389 printf(
"(%03d..%03d) `%.*s`\n",
1397 font, gc, &
str[
wrap.start], (
wrap.last[0] -
wrap.start) - clip_bytes, pen_y, userdata);
1401 pen_y -= line_height;
1414 r_info->
lines = lines;
1426 const size_t str_len,
1448 const size_t str_len,
1452 rcti *box =
static_cast<rcti *
>(userdata);
1461 r_box->
xmin = 32000;
1462 r_box->
xmax = -32000;
1463 r_box->
ymin = 32000;
1464 r_box->
ymax = -32000;
1480 const size_t str_len,
1488 const size_t str_len,
1505 const size_t str_len,
1517 int max_pixel_width,
1604 int err = FT_Init_FreeType(&
ft_lib);
1605 if (err == FT_Err_Ok) {
1607 err = FTC_Manager_New(
ft_lib,
1614 if (err == FT_Err_Ok) {
1628 FT_Done_FreeType(
ft_lib);
1655 font->
color[0] = 255;
1656 font->
color[1] = 255;
1658 font->
color[3] = 255;
1692 metrics->
width = 1.0f;
1694 const TT_OS2 *os2_table = (
const TT_OS2 *)FT_Get_Sfnt_Table(face, FT_SFNT_OS2);
1697 if (os2_table->usWeightClass >= 1 && os2_table->usWeightClass <= 1000) {
1698 metrics->
weight = short(os2_table->usWeightClass);
1702 if (os2_table->usWidthClass >= 1 && os2_table->usWidthClass <= 9) {
1703 switch (os2_table->usWidthClass) {
1705 metrics->
width = 0.5f;
1708 metrics->
width = 0.625f;
1711 metrics->
width = 0.75f;
1714 metrics->
width = 0.875f;
1717 metrics->
width = 1.0f;
1720 metrics->
width = 1.125f;
1723 metrics->
width = 1.25f;
1726 metrics->
width = 1.5f;
1729 metrics->
width = 2.0f;
1742 metrics->
family_class = short(os2_table->sFamilyClass);
1746 if (os2_table->version > 1) {
1747 metrics->
cap_height = short(os2_table->sCapHeight);
1748 metrics->
x_height = short(os2_table->sxHeight);
1753 const TT_Postscript *post_table = (
const TT_Postscript *)FT_Get_Sfnt_Table(face, FT_SFNT_POST);
1755 if (post_table->italicAngle != 0) {
1756 metrics->
slant =
float(post_table->italicAngle) / -65536.0f;
1762 metrics->
ascender = short(face->ascender);
1763 metrics->
descender = short(face->descender);
1773 FT_UInt gi = FT_Get_Char_Index(face,
uint(
'H'));
1774 if (gi && FT_Load_Glyph(face, gi, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP) == FT_Err_Ok) {
1775 metrics->
cap_height = short(face->glyph->metrics.height);
1784 FT_UInt gi = FT_Get_Char_Index(face,
uint(
'x'));
1785 if (gi && FT_Load_Glyph(face, gi, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP) == FT_Err_Ok) {
1786 metrics->
x_height = short(face->glyph->metrics.height);
1793 FT_UInt gi = FT_Get_Char_Index(face,
uint(
'o'));
1794 if (gi && FT_Load_Glyph(face, gi, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP) == FT_Err_Ok) {
1808 if (metrics->
weight == 400 && face->style_flags & FT_STYLE_FLAG_BOLD) {
1813 if (metrics->
slant == 0.0f && face->style_flags & FT_STYLE_FLAG_ITALIC) {
1815 metrics->
slant = 8.0f;
1850 metrics->
valid =
true;
1861 if (FT_HAS_MULTIPLE_MASTERS(font) && !font->
variations) {
1873 if (FT_IS_FIXED_WIDTH(font)) {
1911 err = FT_New_Memory_Face(font->
ft_lib,
1912 static_cast<const FT_Byte *
>(font->
mem),
1918 font->
face->generic.data = font;
1923 if (
ELEM(err, FT_Err_Unknown_File_Format, FT_Err_Unimplemented_Feature)) {
1924 printf(
"Format of this font file is not supported\n");
1927 printf(
"Error encountered while opening font file\n");
1933 if (font->
face && !(font->
face->face_flags & FT_FACE_FLAG_SCALABLE)) {
1934 printf(
"Font is not scalable\n");
1938 err = FT_Select_Charmap(font->
face, FT_ENCODING_UNICODE);
1940 err = FT_Select_Charmap(font->
face, FT_ENCODING_APPLE_ROMAN);
1942 if (err && font->
face->num_charmaps > 0) {
1943 err = FT_Select_Charmap(font->
face, font->
face->charmaps[0]->encoding);
1946 printf(
"Can't set a character map!\n");
1954 err = FT_Attach_File(font->
face, mfile);
1957 "FT_Attach_File failed to load '%s' with error %d\n",
1984 {
"Noto Sans CJK Regular.woff2",
1986 TT_UCR_CJK_SYMBOLS | TT_UCR_HIRAGANA | TT_UCR_KATAKANA | TT_UCR_BOPOMOFO | TT_UCR_CJK_MISC |
1987 TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS | TT_UCR_CJK_COMPATIBILITY |
1988 TT_UCR_CJK_UNIFIED_IDEOGRAPHS | TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS,
1989 TT_UCR_CJK_COMPATIBILITY_FORMS,
1991 {
"NotoEmoji-VariableFont_wght.woff2", 0x80000003L, 0x241E4ACL, 0x14000000L, 0x4000000L},
1992 {
"NotoSansArabic-VariableFont_wdth,wght.woff2",
1994 uint(TT_UCR_ARABIC_PRESENTATION_FORMS_A),
1995 TT_UCR_ARABIC_PRESENTATION_FORMS_B,
1997 {
"NotoSansArmenian-VariableFont_wdth,wght.woff2", TT_UCR_ARMENIAN, 0, 0, 0},
1998 {
"NotoSansBengali-VariableFont_wdth,wght.woff2", TT_UCR_BENGALI, 0, 0, 0},
1999 {
"NotoSansDevanagari-Regular.woff2", TT_UCR_DEVANAGARI, 0, 0, 0},
2000 {
"NotoSansEthiopic-Regular.woff2", 0, 0, TT_UCR_ETHIOPIC, 0},
2001 {
"NotoSansGeorgian-VariableFont_wdth,wght.woff2", TT_UCR_GEORGIAN, 0, 0, 0},
2002 {
"NotoSansGujarati-Regular.woff2", TT_UCR_GUJARATI, 0, 0, 0},
2003 {
"NotoSansGurmukhi-VariableFont_wdth,wght.woff2", TT_UCR_GURMUKHI, 0, 0, 0},
2004 {
"NotoSansHebrew-Regular.woff2", TT_UCR_HEBREW, 0, 0, 0},
2005 {
"NotoSansJavanese-Regular.woff2", 0x80000003L, 0x2000L, 0, 0},
2006 {
"NotoSansKannada-VariableFont_wdth,wght.woff2", TT_UCR_KANNADA, 0, 0, 0},
2007 {
"NotoSansKhmer-VariableFont_wdth,wght.woff2", 0, 0, TT_UCR_KHMER, 0},
2008 {
"NotoSansMalayalam-VariableFont_wdth,wght.woff2", TT_UCR_MALAYALAM, 0, 0, 0},
2009 {
"NotoSansMath-Regular.woff2", 0, TT_UCR_MATHEMATICAL_OPERATORS, 0, 0},
2010 {
"NotoSansMyanmar-Regular.woff2", 0, 0, TT_UCR_MYANMAR, 0},
2011 {
"NotoSansSymbols-VariableFont_wght.woff2", 0x3L, 0x200E4B4L, 0, 0},
2012 {
"NotoSansSymbols2-Regular.woff2", 0x80000003L, 0x200E3E4L, 0x40020L, 0x580A048L},
2013 {
"NotoSansTamil-VariableFont_wdth,wght.woff2", TT_UCR_TAMIL, 0, 0, 0},
2014 {
"NotoSansTelugu-VariableFont_wdth,wght.woff2", TT_UCR_TELUGU, 0, 0, 0},
2015 {
"NotoSansThai-VariableFont_wdth,wght.woff2", TT_UCR_THAI, 0, 0, 0},
2024 const char *mem_name,
2026 const size_t mem_size,
2029 FontBLF *font = MEM_new<FontBLF>(__func__);
2034 font->
mem = (
void *)mem;
2039 if (ft_library && ((FT_Library)ft_library !=
ft_lib)) {
2046 font->
ft_lib = ft_library ? (FT_Library)ft_library :
ft_lib;
2049 bool face_needed =
true;
2060 face_needed =
false;
2073 const TT_OS2 *os2_table = (
const TT_OS2 *)FT_Get_Sfnt_Table(font->
face, FT_SFNT_OS2);
2106 open.flags = FT_OPEN_MEMORY;
2107 open.memory_base = (
const FT_Byte *)mem;
2108 open.memory_size = (FT_Long)mem_size;
2110 FT_Attach_Stream(font->
face, &open);
2132 FT_Done_Face(font->
face);
2134 font->
face =
nullptr;
2158 FTC_ScalerRec scaler = {
nullptr};
2159 scaler.face_id = font;
2166 font->
ft_size->generic.data = (
void *)font;
2187 FTC_ScalerRec scaler = {
nullptr};
2188 scaler.face_id = font;
2190 scaler.height = ft_size;
2197 font->
ft_size->generic.data = (
void *)font;
bool(*)(const char *str, size_t str_step_ofs, const rcti *bounds, void *user_dataconst) BLF_GlyphBoundsFn
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
MINLINE unsigned int round_fl_to_uint(float a)
MINLINE int is_power_of_2_i(int n)
MINLINE int bitscan_reverse_i(int a)
MINLINE void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
MINLINE void blend_color_mix_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_mix_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
bool equals_m4m4(const float mat1[4][4], const float mat2[4][4])
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void BLI_rcti_union(struct rcti *rct_a, const struct rcti *rct_b)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
int char char int int int int size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BLI_str_cursor_step_prev_utf8(const char *str, int str_maxlen, int *pos)
bool BLI_str_utf32_char_is_breaking_space(char32_t codepoint)
bool BLI_str_utf32_char_is_optional_break_before(char32_t codepoint, char32_t codepoint_prev)
int BLI_str_utf8_char_width_or_error(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
ptrdiff_t BLI_str_utf8_invalid_byte(const char *str, size_t str_len) ATTR_NONNULL(1)
const char * BLI_str_find_prev_char_utf8(const char *p, const char *str_start) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1
unsigned int BLI_str_utf8_as_unicode_step_safe(const char *__restrict p, size_t p_len, size_t *__restrict index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
bool BLI_str_utf32_char_is_optional_break_after(char32_t codepoint, char32_t codepoint_prev)
unsigned int unsigned int size_t BLI_str_utf8_from_unicode_len(unsigned int c) ATTR_WARN_UNUSED_RESULT
int BLI_wcwidth_safe(char32_t ucs) ATTR_WARN_UNUSED_RESULT
unsigned int BLI_str_utf8_as_unicode_safe(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void GPU_batch_draw_advanced(blender::gpu::Batch *batch, int vertex_first, int vertex_count, int instance_first, int instance_count)
void GPU_batch_program_set_builtin(blender::gpu::Batch *batch, GPUBuiltinShader shader_id)
#define GPU_batch_texture_bind(batch, name, tex)
#define GPU_BATCH_DISCARD_SAFE(batch)
blender::gpu::Batch * GPU_batch_create_procedural(GPUPrimType primitive_type, int32_t vertex_count)
#define GPU_batch_uniform_1i(batch, name, x)
#define GPU_matrix_model_view_get(x)
#define GPU_matrix_set(x)
void GPU_blend(GPUBlend blend)
void GPU_storagebuf_free(blender::gpu::StorageBuf *ssbo)
blender::gpu::StorageBuf * GPU_storagebuf_create_ex(size_t size, const void *data, GPUUsageType usage, const char *name)
void GPU_storagebuf_update(blender::gpu::StorageBuf *ssbo, const void *data)
void GPU_storagebuf_bind(blender::gpu::StorageBuf *ssbo, int slot)
void GPU_storagebuf_usage_size_set(blender::gpu::StorageBuf *ssbo, size_t size)
void GPU_texture_update_sub(blender::gpu::Texture *texture, eGPUDataFormat data_format, const void *pixels, int offset_x, int offset_y, int offset_z, int width, int height, int depth)
void GPU_texture_unbind(blender::gpu::Texture *texture)
int GPU_texture_width(const blender::gpu::Texture *texture)
Read Guarded memory(de)allocation.
char * blf_dir_metrics_search(const char *filepath)
static ft_pix blf_font_width_max_ft_pix(FontBLF *font)
static void blf_font_string_wrap_cb(FontBLF *, GlyphCacheBLF *, const char *str, const size_t str_len, const ft_pix, void *str_list_ptr)
size_t blf_str_offset_from_cursor_position(FontBLF *font, const char *str, size_t str_len, int location_x)
static const FaceDetails static_face_details[]
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)
static void blf_font_draw_buffer__wrap_cb(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, const ft_pix pen_y, void *)
static void blf_font_fill(FontBLF *font)
int blf_font_ascender(FontBLF *font)
static void(* blf_draw_cache_flush)()
blender::Vector< blender::StringRef > blf_font_string_wrap(FontBLF *font, blender::StringRef str, int max_pixel_width, BLFWrapMode mode)
static bool blf_str_offset_foreach_glyph(const char *, const size_t str_step_ofs, const rcti *bounds, void *user_data)
int blf_font_draw_mono(FontBLF *font, const char *str, const size_t str_len, const int cwidth, const int tab_columns)
float blf_font_width(FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
bool blf_ensure_face(FontBLF *font)
static FTC_Manager ftc_manager
static FTC_CMapCache ftc_charmap_cache
static ft_pix blf_font_height_max_ft_pix(FontBLF *font)
static void blf_batch_draw_end()
static void blf_font_draw__wrap_cb(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *)
void blf_ensure_size(FontBLF *font)
static void blf_font_boundbox_ex(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info, ft_pix pen_y)
static void blf_glyph_draw_buffer(FontBufInfoBLF *buf_info, GlyphBLF *g, const ft_pix pen_x, const ft_pix pen_y_basis)
bool blf_font_bounds_max(FontBLF *font, rctf *r_bounds)
void blf_font_draw_buffer(FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
static void blf_font_wrap_apply(FontBLF *font, const char *str, const size_t str_len, const int max_pixel_width, BLFWrapMode mode, ResultBLF *r_info, void(*callback)(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *userdata), void *userdata)
void BLF_cache_flush_set_fn(void(*cache_flush_fn)())
static void blf_batch_draw_exit()
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)
static void blf_face_finalizer(void *object)
static void blf_font_boundbox_wrap_cb(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *userdata)
static FT_Error blf_cache_face_requester(FTC_FaceID faceID, FT_Library lib, FT_Pointer, FT_Face *face)
float blf_font_height(FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
uint blf_get_char_index(FontBLF *font, const uint charcode)
static bool blf_font_width_to_strlen_glyph_process(FontBLF *font, GlyphCacheBLF *gc, const GlyphBLF *g_prev, GlyphBLF *g, ft_pix *pen_x, const int width_i)
static void blf_font_draw_buffer_ex(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, const ft_pix pen_y, ResultBLF *r_info)
BLI_INLINE GlyphBLF * blf_glyph_from_utf8_and_step(FontBLF *font, GlyphCacheBLF *gc, const GlyphBLF *g_prev, const char *str, const size_t str_len, size_t *i_p, int32_t *pen_x)
int blf_font_width_max(FontBLF *font)
blender::Array< uchar > blf_svg_icon_bitmap(FontBLF *font, const uint icon_id, const float size, int *r_width, int *r_height, const bool multicolor, blender::FunctionRef< void(std::string &)> edit_source_cb)
void blf_draw_svg_icon(FontBLF *font, const uint icon_id, const float x, const float y, const float size, const float color[4], const float outline_alpha, const bool multicolor, blender::FunctionRef< void(std::string &)> edit_source_cb)
static ft_pix blf_unscaled_F26Dot6_to_pixels(FontBLF *font, const FT_Pos value)
void blf_batch_draw_begin(FontBLF *font)
static void blf_size_finalizer(void *object)
void blf_font_boundbox__wrap(FontBLF *font, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info)
static bool blf_cursor_position_foreach_glyph(const char *, const size_t str_step_ofs, const rcti *bounds, void *user_data)
static blender::gpu::Texture * blf_batch_cache_texture_load()
void blf_font_boundbox(FontBLF *font, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info)
int blf_font_glyph_advance(FontBLF *font, const char *str)
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)
static bool blf_setup_face(FontBLF *font)
void blf_font_attach_from_mem(FontBLF *font, const uchar *mem, const size_t mem_size)
static void blf_batch_draw_init()
BLI_INLINE ft_pix blf_kerning(FontBLF *font, const GlyphBLF *g_prev, const GlyphBLF *g)
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)
static blender::Mutex ft_lib_mutex
static void blf_font_draw_ex(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ResultBLF *r_info, const ft_pix pen_y)
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)
static int blf_str_is_utf8_valid_lazy_init(const char *str, const size_t str_len, int &is_utf8_valid)
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)
static void blf_font_metrics(FT_Face face, FontMetrics *metrics)
static FontBLF * blf_font_new_impl(const char *filepath, const char *mem_name, const uchar *mem, const size_t mem_size, void *ft_library)
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)
GlyphCacheBLF * blf_glyph_cache_acquire(FontBLF *font)
void blf_glyph_draw(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, const int x, const int y)
GlyphBLF * blf_glyph_ensure_subpixel(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, int32_t pen_x)
void blf_glyph_cache_release(FontBLF *font)
GlyphBLF * blf_glyph_ensure(FontBLF *font, GlyphCacheBLF *gc, const uint charcode, uint8_t subpixel)
GlyphBLF * blf_glyph_ensure_icon(GlyphCacheBLF *gc, const uint icon_id, bool color, blender::FunctionRef< void(std::string &)> edit_source_cb)
#define BLF_CACHE_MAX_FACES
#define BLF_CACHE_MAX_SIZES
ft_pix ft_pix_from_int(int v)
#define KERNING_CACHE_TABLE_SIZE
int ft_pix_to_int_floor(ft_pix v)
int ft_pix_to_int_ceil(ft_pix v)
#define KERNING_ENTRY_UNSET
int ft_pix_to_int(ft_pix v)
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
btMatrix3x3 scaled(const btVector3 &s) const
Create a scaled copy of the matrix.
void append(const T &value)
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
void * MEM_mallocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
MINLINE void zero_v2_int(int r[2])
float wrap(float value, float max, float min)
KerningCacheBLF * kerning_cache
unsigned char shadow_color[4]
unsigned char col_char[4]
short underline_thickness
short superscript_yoffset
short superscript_xoffset
short strikeout_thickness
blender::gpu::Texture * texture
int ascii_table[KERNING_CACHE_TABLE_SIZE][KERNING_CACHE_TABLE_SIZE]
static DynamicLibrary lib