11#include "testing/testing.h"
19 path,
sizeof(path), tests::flags_test_asset_dir().c_str(),
"blenfont", font_name.c_str());
20 return std::string(path);
48 const int id =
BLF_load(path.c_str());
92 float ascend_ratio = 0.0f;
93 float em_ratio = 0.0f;
122 const char sample[] =
"MM";
183 const char sample[] =
"XX";
194 const char sample[] =
"X";
205 const char sample[] =
"X";
219 "xxxxxxxxxxxxxxxxxxx!\"#$%&\'()*+,-./"
220 "0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
233 const char sample[] =
"x xxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx ";
238 EXPECT_TRUE(wrapped.
size() == 2 && wrapped[0].back() ==
' ' && wrapped[1].substr(0, 1) !=
" ");
245 const char sample[] =
"x\nxxxxxxxxxxxxxxxx\n\nxxxxxxxxxxxxxxxxxxx\n";
257 const char sample[] =
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
273 "xxxxxxxxxxxxxxxxxxx!\"#$\'()*+,"
274 "0123456789:;<>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^`abcdefghijklmnopqrstuvwxyz{|}~";
288 const char sample[] =
"x xxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx ";
304 const char sample[] =
"x_xx_xxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxx_";
318 const char sample[] =
"xxxxxxxxxx" SEP_STR "xxxxxxxxxxxxxxxxxxxxxx";
329 const char sample[] =
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
344 const char sample[] =
"xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
357 const char sample[] =
"xxxxxxxxxxx\\xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
370 const char sample[] =
"xxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
383 const char sample[] =
"xxxxxxxxxxxxxx/xx3/xxxxxxxxxxxxxxxxxxxxx";
396 const char sample[] =
"xxxxxxxxxxxxxx-xx /xxxxxxxxxxxxxxxxxxxxx";
412 "xxxxxxxxxxxxxxxxxxxxx";
428 "xxxxxxxxxxxxxxxxxxxxx";
441 const char sample[] =
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
454 const char sample[] =
"aeiouáéíóú ;'/./\n\n1234567890-=";
457 "a",
"e",
"i",
"o",
"u",
"á",
"é",
"í",
"ó",
"ú",
" ",
";",
"\'",
"/",
".",
458 "/",
"",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"0",
"-",
"=",
460 for (
float size : {0.1f, 1.0f, 5.0f, 10.0f}) {
#define BLI_path_join(...)
float3x3 scale(float3x3 mat, float2 scale)
#define EXPECT_TRUE(result)
#define EXPECT_NEAR(result, expect, threshold)
static std::string font_path(std::string font_name)
TEST_F(BlfLoadTest, load)
static void close_font(int id)
static int open_font(std::string font_name)
bool BLF_is_loaded_id(int fontid) ATTR_WARN_UNUSED_RESULT
int BLF_glyph_advance(int fontid, const char *str)
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
int BLF_width_max(int fontid) ATTR_WARN_UNUSED_RESULT
bool BLF_get_vfont_metrics(int fontid, float *ascend_ratio, float *em_ratio, float *scale)
int bool BLF_is_loaded(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLF_character_weight(int fontid, int weight)
void BLF_size(int fontid, float size)
int BLF_load(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
float BLF_height(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
int BLF_default_weight(int fontid) ATTR_WARN_UNUSED_RESULT
Vector< StringRef > BLF_string_wrap(int fontid, StringRef str, const int max_pixel_width, BLFWrapMode mode=BLFWrapMode::Minimal)
float BLF_fixed_width(int fontid) ATTR_WARN_UNUSED_RESULT
bool BLF_has_variable_weight(int fontid) ATTR_WARN_UNUSED_RESULT
bool BLF_has_glyph(int fontid, unsigned int unicode) ATTR_WARN_UNUSED_RESULT
int BLF_ascender(int fontid) ATTR_WARN_UNUSED_RESULT
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT
char * BLF_display_name_from_file(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
char * BLF_display_name_from_id(int fontid)
bool BLF_unload_id(int fontid)