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);
115 if (err == FT_Err_Ok) {
117 font->
face->generic.data = font;
122 err = FT_Err_Cannot_Open_Resource;
138 FT_Size
size =
static_cast<FT_Size
>(object);
166 FT_Long
scaled = FT_MulFix(value, font->
ft_size->metrics.x_scale);
170 if (font->
ft_size->metrics.x_ppem < 25) {
227 if (
g_batch.batch ==
nullptr) {
231 const bool font_changed = (
g_batch.font != font);
233 const bool shader_changed = (simple_shader !=
g_batch.simple_shader);
261 if (mat_changed || font_changed || shader_changed) {
263 g_batch.simple_shader = simple_shader;
281 g_batch.simple_shader = simple_shader;
295 int remain = gc->
bitmap_len - bitmap_len_landed;
296 int offset_x = bitmap_len_landed % tex_width;
297 int offset_y = bitmap_len_landed / tex_width;
301 int remain_row = tex_width - offset_x;
302 int width = remain > remain_row ? remain_row : remain;
313 bitmap_len_landed += width;
385 if (FT_HAS_KERNING(font) && g_prev) {
396 FT_Get_Kerning(font->
face, g_prev->
idx, g->
idx, FT_KERNING_UNSCALED, &delta);
429#ifdef BLF_SUBPIXEL_POSITION
437#ifdef BLF_SUBPIXEL_AA
453 const size_t str_len,
468 while ((i < str_len) &&
str[i]) {
493 FontBLF *font,
const char *
str,
const size_t str_len,
int cwidth,
int tab_columns)
497 ft_pix pen_x = 0, pen_y = 0;
506 while ((i < str_len) &&
str[i]) {
515 const int col =
UNLIKELY(g->
c ==
'\t') ? (tab_columns - (columns % tab_columns)) :
518 pen_x += cwidth_fpx *
col;
533 const float color[4],
543 if (
color !=
nullptr) {
547 if (outline_alpha > 0.0f) {
566 if (outline_alpha > 0) {
593 *r_width = g->
dims[0];
594 *r_height = g->
dims[1];
636 if ((chx + g->
dims[0]) < 0 ||
637 chx >= buf_info->
dims[0] ||
646 int width_clip = g->
dims[0];
647 int height_clip = g->
dims[1];
648 int yb_start = g->
pitch < 0 ? 0 : g->
dims[1] - 1;
650 if (width_clip + chx > buf_info->
dims[0]) {
651 width_clip -= chx + width_clip - buf_info->
dims[0];
667 const float *b_col_float = buf_info->
col_float;
670 if (buf_info->
fbuf) {
672 for (
int y = ((chy >= 0) ? 0 : -chy);
y < height_clip;
y++) {
673 const int x_start = (chx >= 0) ? 0 : -chx;
675 const int64_t buf_ofs = (
int64_t(buf_info->
dims[0]) * (pen_y_px +
y) + (chx + x_start)) * 4;
676 float *fbuf = buf_info->
fbuf + buf_ofs;
677 for (
int x = x_start;
x < width_clip;
x++, a_ptr++, fbuf += 4) {
678 const char a_byte = *a_ptr;
680 const float a = (a_byte / 255.0f) * b_col_float[3];
683 font_pixel[0] = b_col_float[0] * a;
684 font_pixel[1] = b_col_float[1] * a;
685 font_pixel[2] = b_col_float[2] * a;
700 if (buf_info->
cbuf) {
702 for (
int y = ((chy >= 0) ? 0 : -chy);
y < height_clip;
y++) {
703 const int x_start = (chx >= 0) ? 0 : -chx;
705 const int64_t buf_ofs = (
int64_t(buf_info->
dims[0]) * (pen_y_px +
y) + (chx + x_start)) * 4;
707 for (
int x = x_start;
x < width_clip;
x++, a_ptr++, cbuf += 4) {
708 const char a_byte = *a_ptr;
711 const float a = (a_byte / 255.0f) * b_col_float[3];
714 font_pixel[0] = b_col_char[0];
715 font_pixel[1] = b_col_char[1];
716 font_pixel[2] = b_col_char[2];
736 const size_t str_len,
750 while ((i < str_len) &&
str[i]) {
798#ifdef BLF_SUBPIXEL_POSITION
806#ifdef BLF_SUBPIXEL_AA
818 FontBLF *font,
const char *
str,
const size_t str_len,
int width,
int *r_width)
827 const int width_i =
int(width);
829 for (i_prev = i = 0, width_new = pen_x = 0, g_prev =
nullptr; (i < str_len) &&
str[i];
830 i_prev = i, width_new = pen_x, g_prev = g)
847 FontBLF *font,
const char *
str,
const size_t str_len,
int width,
int *r_width)
851 size_t i, i_prev, i_tmp;
852 const char *s, *s_prev;
860 i_prev = size_t(s_prev -
str);
864 for (width_new = pen_x = 0; (s !=
nullptr && i > 0);
865 i = i_prev, s = s_prev, g = g_prev, g_prev =
nullptr, width_new = pen_x)
868 i_prev = size_t(s_prev -
str);
896 const size_t str_len,
910 while ((i < str_len) &&
str[i]) {
919 const ft_pix gbox_xmax = std::max(pen_x_next, pen_x + g->
box_xmax);
923 if (gbox_xmin < box_xmin) {
924 box_xmin = gbox_xmin;
926 if (gbox_ymin < box_ymin) {
927 box_ymin = gbox_ymin;
930 if (gbox_xmax > box_xmax) {
931 box_xmax = gbox_xmax;
933 if (gbox_ymax > box_ymax) {
934 box_ymax = gbox_ymax;
940 if (box_xmin > box_xmax) {
967 const size_t str_len,
1046 const size_t str_len,
1050 if (str_len == 0 ||
str[0] == 0) {
1061 while ((i < str_len) &&
str[i]) {
1062 const size_t i_curr = i;
1075 if (user_fn(
str, i_curr, &
bounds, user_data) ==
false) {
1092 const size_t str_step_ofs,
1099 data->r_offset = str_step_ofs;
1113 if (!
str || !
str[0] || !str_len) {
1118 data.location_x = location_x;
1119 data.r_offset = size_t(-1);
1123 if (
data.r_offset ==
size_t(-1)) {
1129 int offset =
int(
data.r_offset);
1131 data.r_offset = size_t(offset);
1134 return data.r_offset;
1143 const size_t str_step_ofs,
1148 if (
data->str_offset == str_step_ofs) {
1158 rcti *r_glyph_bounds)
1161 data.str_offset = str_offset;
1165 *r_glyph_bounds =
data.bounds;
1170 const size_t str_len,
1171 const size_t str_offset,
1172 const int cursor_width)
1180 if (str_offset > 0) {
1186 if (str_offset < strlen(
str)) {
1190 if ((prev.xmax == prev.xmin) &&
next.xmax) {
1192 return next.xmin - (cursor_width / 2);
1194 if ((prev.xmax != prev.xmin) && !
next.xmax) {
1196 return prev.xmax - (cursor_width / 2);
1198 if (prev.xmax &&
next.xmax) {
1200 if (
next.xmin >= prev.xmax ||
next.xmin ==
next.xmax) {
1201 return ((prev.xmax +
next.xmin) - cursor_width) / 2;
1204 return ((
next.xmax + prev.xmin) - cursor_width) / 2;
1208 return 0 - cursor_width;
1214 FontBLF *font,
const char *
str,
size_t str_len,
size_t sel_start,
size_t sel_length)
1240 const size_t str_len,
1241 const int max_pixel_width,
1243 void (*callback)(
FontBLF *font,
1246 const size_t str_len,
1263 struct WordWrapVars {
1265 size_t start, last[2];
1269 while ((i < str_len) &&
str[i]) {
1272 const size_t i_curr = i;
1273 bool do_draw =
false;
1293 else if (
UNLIKELY(((i < str_len) &&
str[i]) == 0)) {
1295 wrap.last[0] = i + ((g->
c !=
'\n') ? 1 : 0);
1300 wrap.last[0] = i_curr + 1;
1304 else if (
UNLIKELY(g->
c !=
' ' && (g_prev ? g_prev->
c ==
' ' :
false))) {
1305 wrap.last[0] = i_curr;
1306 wrap.last[1] = i_curr;
1311 printf(
"(%03d..%03d) `%.*s`\n",
1318 callback(font, gc, &
str[
wrap.start], (
wrap.last[0] -
wrap.start) - 1, pen_y, userdata);
1322 pen_y -= line_height;
1335 r_info->
lines = lines;
1347 const size_t str_len,
1363 const size_t str_len,
1367 rcti *box =
static_cast<rcti *
>(userdata);
1376 r_box->
xmin = 32000;
1377 r_box->
xmax = -32000;
1378 r_box->
ymin = 32000;
1379 r_box->
ymax = -32000;
1389 const size_t str_len,
1397 const size_t str_len,
1408 const size_t str_len,
1420 int max_pixel_width)
1493 int err = FT_Init_FreeType(&
ft_lib);
1494 if (err == FT_Err_Ok) {
1496 err = FTC_Manager_New(
ft_lib,
1503 if (err == FT_Err_Ok) {
1518 FT_Done_FreeType(
ft_lib);
1545 font->
color[0] = 255;
1546 font->
color[1] = 255;
1548 font->
color[3] = 255;
1582 metrics->
width = 1.0f;
1584 const TT_OS2 *os2_table = (
const TT_OS2 *)FT_Get_Sfnt_Table(face, FT_SFNT_OS2);
1587 if (os2_table->usWeightClass >= 1 && os2_table->usWeightClass <= 1000) {
1588 metrics->
weight = short(os2_table->usWeightClass);
1592 if (os2_table->usWidthClass >= 1 && os2_table->usWidthClass <= 9) {
1593 switch (os2_table->usWidthClass) {
1595 metrics->
width = 0.5f;
1598 metrics->
width = 0.625f;
1601 metrics->
width = 0.75f;
1604 metrics->
width = 0.875f;
1607 metrics->
width = 1.0f;
1610 metrics->
width = 1.125f;
1613 metrics->
width = 1.25f;
1616 metrics->
width = 1.5f;
1619 metrics->
width = 2.0f;
1632 metrics->
family_class = short(os2_table->sFamilyClass);
1636 if (os2_table->version > 1) {
1637 metrics->
cap_height = short(os2_table->sCapHeight);
1638 metrics->
x_height = short(os2_table->sxHeight);
1643 const TT_Postscript *post_table = (
const TT_Postscript *)FT_Get_Sfnt_Table(face, FT_SFNT_POST);
1645 if (post_table->italicAngle != 0) {
1646 metrics->
slant =
float(post_table->italicAngle) / -65536.0f;
1652 metrics->
ascender = short(face->ascender);
1653 metrics->
descender = short(face->descender);
1663 FT_UInt gi = FT_Get_Char_Index(face,
uint(
'H'));
1664 if (gi && FT_Load_Glyph(face, gi, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP) == FT_Err_Ok) {
1665 metrics->
cap_height = short(face->glyph->metrics.height);
1674 FT_UInt gi = FT_Get_Char_Index(face,
uint(
'x'));
1675 if (gi && FT_Load_Glyph(face, gi, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP) == FT_Err_Ok) {
1676 metrics->
x_height = short(face->glyph->metrics.height);
1683 FT_UInt gi = FT_Get_Char_Index(face,
uint(
'o'));
1684 if (gi && FT_Load_Glyph(face, gi, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP) == FT_Err_Ok) {
1698 if (metrics->
weight == 400 && face->style_flags & FT_STYLE_FLAG_BOLD) {
1703 if (metrics->
slant == 0.0f && face->style_flags & FT_STYLE_FLAG_ITALIC) {
1705 metrics->
slant = 8.0f;
1740 metrics->
valid =
true;
1751 if (FT_HAS_MULTIPLE_MASTERS(font) && !font->
variations) {
1763 if (FT_IS_FIXED_WIDTH(font)) {
1802 err = FT_New_Memory_Face(font->
ft_lib,
1803 static_cast<const FT_Byte *
>(font->
mem),
1809 font->
face->generic.data = font;
1815 if (
ELEM(err, FT_Err_Unknown_File_Format, FT_Err_Unimplemented_Feature)) {
1816 printf(
"Format of this font file is not supported\n");
1819 printf(
"Error encountered while opening font file\n");
1825 if (font->
face && !(font->
face->face_flags & FT_FACE_FLAG_SCALABLE)) {
1826 printf(
"Font is not scalable\n");
1830 err = FT_Select_Charmap(font->
face, FT_ENCODING_UNICODE);
1832 err = FT_Select_Charmap(font->
face, FT_ENCODING_APPLE_ROMAN);
1834 if (err && font->
face->num_charmaps > 0) {
1835 err = FT_Select_Charmap(font->
face, font->
face->charmaps[0]->encoding);
1838 printf(
"Can't set a character map!\n");
1846 err = FT_Attach_File(font->
face, mfile);
1849 "FT_Attach_File failed to load '%s' with error %d\n",
1877 {
"Noto Sans CJK Regular.woff2",
1879 TT_UCR_CJK_SYMBOLS | TT_UCR_HIRAGANA | TT_UCR_KATAKANA | TT_UCR_BOPOMOFO | TT_UCR_CJK_MISC |
1880 TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS | TT_UCR_CJK_COMPATIBILITY |
1881 TT_UCR_CJK_UNIFIED_IDEOGRAPHS | TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS,
1882 TT_UCR_CJK_COMPATIBILITY_FORMS,
1884 {
"NotoEmoji-VariableFont_wght.woff2", 0x80000003L, 0x241E4ACL, 0x14000000L, 0x4000000L},
1885 {
"NotoSansArabic-VariableFont_wdth,wght.woff2",
1887 uint(TT_UCR_ARABIC_PRESENTATION_FORMS_A),
1888 TT_UCR_ARABIC_PRESENTATION_FORMS_B,
1890 {
"NotoSansArmenian-VariableFont_wdth,wght.woff2", TT_UCR_ARMENIAN, 0, 0, 0},
1891 {
"NotoSansBengali-VariableFont_wdth,wght.woff2", TT_UCR_BENGALI, 0, 0, 0},
1892 {
"NotoSansDevanagari-Regular.woff2", TT_UCR_DEVANAGARI, 0, 0, 0},
1893 {
"NotoSansEthiopic-Regular.woff2", 0, 0, TT_UCR_ETHIOPIC, 0},
1894 {
"NotoSansGeorgian-VariableFont_wdth,wght.woff2", TT_UCR_GEORGIAN, 0, 0, 0},
1895 {
"NotoSansGujarati-Regular.woff2", TT_UCR_GUJARATI, 0, 0, 0},
1896 {
"NotoSansGurmukhi-VariableFont_wdth,wght.woff2", TT_UCR_GURMUKHI, 0, 0, 0},
1897 {
"NotoSansHebrew-Regular.woff2", TT_UCR_HEBREW, 0, 0, 0},
1898 {
"NotoSansJavanese-Regular.woff2", 0x80000003L, 0x2000L, 0, 0},
1899 {
"NotoSansKannada-VariableFont_wdth,wght.woff2", TT_UCR_KANNADA, 0, 0, 0},
1900 {
"NotoSansKhmer-VariableFont_wdth,wght.woff2", 0, 0, TT_UCR_KHMER, 0},
1901 {
"NotoSansMalayalam-VariableFont_wdth,wght.woff2", TT_UCR_MALAYALAM, 0, 0, 0},
1902 {
"NotoSansMath-Regular.woff2", 0, TT_UCR_MATHEMATICAL_OPERATORS, 0, 0},
1903 {
"NotoSansMyanmar-Regular.woff2", 0, 0, TT_UCR_MYANMAR, 0},
1904 {
"NotoSansSymbols-VariableFont_wght.woff2", 0x3L, 0x200E4B4L, 0, 0},
1905 {
"NotoSansSymbols2-Regular.woff2", 0x80000003L, 0x200E3E4L, 0x40020L, 0x580A048L},
1906 {
"NotoSansTamil-VariableFont_wdth,wght.woff2", TT_UCR_TAMIL, 0, 0, 0},
1907 {
"NotoSansTelugu-VariableFont_wdth,wght.woff2", TT_UCR_TELUGU, 0, 0, 0},
1908 {
"NotoSansThai-VariableFont_wdth,wght.woff2", TT_UCR_THAI, 0, 0, 0},
1917 const char *mem_name,
1919 const size_t mem_size,
1922 FontBLF *font = MEM_new<FontBLF>(__func__);
1927 font->
mem = (
void *)mem;
1932 if (ft_library && ((FT_Library)ft_library !=
ft_lib)) {
1939 font->
ft_lib = ft_library ? (FT_Library)ft_library :
ft_lib;
1942 bool face_needed =
true;
1953 face_needed =
false;
1966 const TT_OS2 *os2_table = (
const TT_OS2 *)FT_Get_Sfnt_Table(font->
face, FT_SFNT_OS2);
1999 open.flags = FT_OPEN_MEMORY;
2000 open.memory_base = (
const FT_Byte *)mem;
2001 open.memory_size = (FT_Long)mem_size;
2003 FT_Attach_Stream(font->
face, &open);
2025 FT_Done_Face(font->
face);
2028 font->
face =
nullptr;
2052 FTC_ScalerRec scaler = {
nullptr};
2053 scaler.face_id = font;
2060 font->
ft_size->generic.data = (
void *)font;
2081 FTC_ScalerRec scaler = {
nullptr};
2082 scaler.face_id = font;
2084 scaler.height = ft_size;
2091 font->
ft_size->generic.data = (
void *)font;
bool(* BLF_GlyphBoundsFn)(const char *str, size_t str_step_ofs, const rcti *bounds, void *user_data)
#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)
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)
int BLI_str_utf8_char_width_or_error(const char *p) ATTR_WARN_UNUSED_RESULT 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
int BLI_wcwidth_safe(char32_t ucs) ATTR_WARN_UNUSED_RESULT
void BLI_mutex_end(ThreadMutex *mutex)
void BLI_mutex_init(ThreadMutex *mutex)
void BLI_mutex_lock(ThreadMutex *mutex)
void BLI_mutex_unlock(ThreadMutex *mutex)
pthread_mutex_t ThreadMutex
blender::gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, blender::gpu::VertBuf *vertex_buf, blender::gpu::IndexBuf *index_buf, eGPUBatchFlag owns_flag)
void GPU_batch_instbuf_set(blender::gpu::Batch *batch, blender::gpu::VertBuf *vertex_buf, bool own_vbo)
#define GPU_batch_texture_bind(batch, name, tex)
#define GPU_BATCH_DISCARD_SAFE(batch)
void GPU_batch_program_set_builtin(blender::gpu::Batch *batch, eGPUBuiltinShader shader_id)
void GPU_batch_draw(blender::gpu::Batch *batch)
#define GPU_batch_uniform_1i(batch, name, x)
#define GPU_matrix_model_view_get(x)
#define GPU_matrix_set(x)
void GPU_blend(eGPUBlend blend)
int GPU_texture_width(const GPUTexture *texture)
void GPU_texture_unbind(GPUTexture *texture)
void GPU_texture_update_sub(GPUTexture *texture, eGPUDataFormat data_format, const void *pixels, int offset_x, int offset_y, int offset_z, int width, int height, int depth)
void GPU_vertbuf_attr_get_raw_data(blender::gpu::VertBuf *, uint a_idx, GPUVertBufRaw *access)
#define GPU_vertbuf_create_with_format(format)
void GPU_vertbuf_use(blender::gpu::VertBuf *)
blender::gpu::VertBuf * GPU_vertbuf_create_with_format_ex(const GPUVertFormat &format, GPUUsageType usage)
void GPU_vertbuf_data_len_set(blender::gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
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 Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
char * blf_dir_metrics_search(const char *filepath)
static void blf_font_draw_buffer__wrap_cb(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ft_pix pen_y, void *)
static ft_pix blf_font_width_max_ft_pix(FontBLF *font)
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_fill(FontBLF *font)
int blf_font_ascender(FontBLF *font)
static void(* blf_draw_cache_flush)()
void blf_draw_svg_icon(FontBLF *font, uint icon_id, float x, float y, float size, const float color[4], float outline_alpha, bool multicolor, blender::FunctionRef< void(std::string &)> edit_source_cb)
static bool blf_str_offset_foreach_glyph(const char *, const size_t str_step_ofs, const rcti *bounds, void *user_data)
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 GPUTexture * blf_batch_cache_texture_load()
blender::Vector< blender::StringRef > blf_font_string_wrap(FontBLF *font, blender::StringRef str, int max_pixel_width)
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)
void blf_font_draw_buffer(FontBLF *font, const char *str, const size_t str_len, ResultBLF *r_info)
void BLF_cache_flush_set_fn(void(*cache_flush_fn)())
int blf_font_draw_mono(FontBLF *font, const char *str, const size_t str_len, int cwidth, int tab_columns)
blender::Array< uchar > blf_svg_icon_bitmap(FontBLF *font, uint icon_id, float size, int *r_width, int *r_height, bool multicolor, blender::FunctionRef< void(std::string &)> edit_source_cb)
static void blf_font_string_wrap_cb(FontBLF *, GlyphCacheBLF *, const char *str, const size_t str_len, ft_pix, void *str_list_ptr)
static void blf_batch_draw_exit()
static void blf_font_wrap_apply(FontBLF *font, const char *str, const size_t str_len, const int max_pixel_width, 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_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)
BLI_INLINE GlyphBLF * blf_glyph_from_utf8_and_step(FontBLF *font, GlyphCacheBLF *gc, const GlyphBLF *g_prev, const char *str, size_t str_len, size_t *i_p, int32_t *pen_x)
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)
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)
int blf_font_width_max(FontBLF *font)
void blf_batch_draw_begin(FontBLF *font)
static void blf_size_finalizer(void *object)
static ft_pix blf_unscaled_F26Dot6_to_pixels(FontBLF *font, FT_Pos value)
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)
void blf_font_boundbox(FontBLF *font, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info)
uint blf_get_char_index(FontBLF *font, uint charcode)
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_font_draw_buffer_ex(FontBLF *font, GlyphCacheBLF *gc, const char *str, const size_t str_len, ResultBLF *r_info, ft_pix pen_y)
static void blf_batch_draw_init()
BLI_INLINE ft_pix blf_kerning(FontBLF *font, const GlyphBLF *g_prev, const GlyphBLF *g)
static ThreadMutex ft_lib_mutex
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 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)
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 BLF_BATCH_DRAW_LEN_MAX
#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)
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)
local_group_size(16, 16) .push_constant(Type texture
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
#define unit_float_to_uchar_clamp(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
int ascii_table[KERNING_CACHE_TABLE_SIZE][KERNING_CACHE_TABLE_SIZE]
static DynamicLibrary lib