diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-10-04 15:25:59 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-10-04 15:25:59 +0200 |
commit | b32e4f18a26aaeb28f66b17102d070908c804a23 (patch) | |
tree | b367f0bb6920ddded71adb8a070fb8915833e277 | |
parent | 31c90080ff3175050961d68451ece26e41a7f1f9 (diff) |
Font loading debug
-rw-r--r-- | src/ResourceLoader.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ResourceLoader.cpp b/src/ResourceLoader.cpp index d503f14..dba23ac 100644 --- a/src/ResourceLoader.cpp +++ b/src/ResourceLoader.cpp @@ -46,6 +46,17 @@ namespace QuickMedia { } namespace QuickMedia::FontLoader { + static const char *font_type_str(FontType font_type) { + switch(font_type) { + case FontType::LATIN: return "LATIN"; + case FontType::LATIN_BOLD: return "LATIN_BOLD"; + case FontType::LATIN_MONOSPACE: return "LATIN_MONOSPACE"; + case FontType::CJK: return "CJK"; + case FontType::SYMBOLS: return "SYMBOLS"; + default: return "UNKNOWN"; + } + } + mgl::Font* get_font(FontType font_type, unsigned int character_size) { // Make mgl font size match sfml font size character_size += 5; @@ -164,6 +175,8 @@ namespace QuickMedia::FontLoader { mgl::Font *font = font_cache[(unsigned int)font_type][character_size].get(); if(!font) { + fprintf(stderr, "### Loading font type: %s, size: %d, latin font: %s, config: %p\n", font_type_str(font_type), (int)character_size, get_config().font.latin.c_str(), (void*)&get_config()); + auto new_font = std::make_unique<mgl::Font>(); if(!new_font->load_from_file(*mapped_file, character_size)) { fprintf(stderr, "Warning: Failed to load font at character size %u\n", character_size); |