From b32e4f18a26aaeb28f66b17102d070908c804a23 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 4 Oct 2023 15:25:59 +0200 Subject: Font loading debug --- src/ResourceLoader.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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(); if(!new_font->load_from_file(*mapped_file, character_size)) { fprintf(stderr, "Warning: Failed to load font at character size %u\n", character_size); -- cgit v1.2.3