diff --git a/butano/include/bn_config_sprite_text.h b/butano/include/bn_config_sprite_text.h index 8f4c600c7..0a0f55b59 100644 --- a/butano/include/bn_config_sprite_text.h +++ b/butano/include/bn_config_sprite_text.h @@ -26,4 +26,15 @@ #define BN_CFG_SPRITE_TEXT_MAX_UTF8_CHARACTERS 4096 #endif +/** + * @def BN_CFG_SPRITE_TEXT_MAX_UTF8_CHARACTERS_FOR_DUPLICATION_CHECK + * + * Specifies the maximum number of UTF-8 characters for duplication check to save compile time. + * + * @ingroup text + */ +#ifndef BN_CFG_SPRITE_TEXT_MAX_UTF8_CHARACTERS_FOR_DUPLICATION_CHECK + #define BN_CFG_SPRITE_TEXT_MAX_UTF8_CHARACTERS_FOR_DUPLICATION_CHECK 100 +#endif + #endif diff --git a/butano/include/bn_sprite_font.h b/butano/include/bn_sprite_font.h index 67abda401..c33ce1c32 100644 --- a/butano/include/bn_sprite_font.h +++ b/butano/include/bn_sprite_font.h @@ -118,7 +118,8 @@ class sprite_font BN_ASSERT(utf8_characters_ref.size() <= BN_CFG_SPRITE_TEXT_MAX_UTF8_CHARACTERS, "Invalid UTF-8 characters count: ", utf8_characters_ref.size()); BN_ASSERT(_validate_utf8_characters(), "UTF-8 characters validation failed"); - //BN_ASSERT(! _duplicated_utf8_characters(), "There's duplicated UTF-8 characters"); + BN_ASSERT(BN_CFG_SPRITE_TEXT_MAX_UTF8_CHARACTERS > BN_CFG_SPRITE_TEXT_MAX_UTF8_CHARACTERS_FOR_DUPLICATION_CHECK || + ! _duplicated_utf8_characters(), "There's duplicated UTF-8 characters"); BN_ASSERT(character_widths_ref.empty() || character_widths_ref.size() == 1 + minimum_graphics + utf8_characters_ref.size(), "Invalid character widths count: ", character_widths_ref.size(), " - ",