|
@@ -2560,7 +2560,9 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg)
|
|
// Default font TTF is compressed with stb_compress then base85 encoded (see misc/fonts/binary_to_compressed_c.cpp for encoder)
|
|
// Default font TTF is compressed with stb_compress then base85 encoded (see misc/fonts/binary_to_compressed_c.cpp for encoder)
|
|
static unsigned int stb_decompress_length(const unsigned char* input);
|
|
static unsigned int stb_decompress_length(const unsigned char* input);
|
|
static unsigned int stb_decompress(unsigned char* output, const unsigned char* input, unsigned int length);
|
|
static unsigned int stb_decompress(unsigned char* output, const unsigned char* input, unsigned int length);
|
|
|
|
+#ifndef IMGUI_DISABLE_DEFAULT_FONT
|
|
static const char* GetDefaultCompressedFontDataTTFBase85();
|
|
static const char* GetDefaultCompressedFontDataTTFBase85();
|
|
|
|
+#endif
|
|
static unsigned int Decode85Byte(char c) { return c >= '\\' ? c-36 : c-35; }
|
|
static unsigned int Decode85Byte(char c) { return c >= '\\' ? c-36 : c-35; }
|
|
static void Decode85(const unsigned char* src, unsigned char* dst)
|
|
static void Decode85(const unsigned char* src, unsigned char* dst)
|
|
{
|
|
{
|
|
@@ -2576,6 +2578,7 @@ static void Decode85(const unsigned char* src, unsigned char* dst)
|
|
// Load embedded ProggyClean.ttf at size 13, disable oversampling
|
|
// Load embedded ProggyClean.ttf at size 13, disable oversampling
|
|
ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
|
|
ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
|
|
{
|
|
{
|
|
|
|
+#ifndef IMGUI_DISABLE_DEFAULT_FONT
|
|
ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
|
|
ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
|
|
if (!font_cfg_template)
|
|
if (!font_cfg_template)
|
|
{
|
|
{
|
|
@@ -2593,6 +2596,11 @@ ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
|
|
const ImWchar* glyph_ranges = font_cfg.GlyphRanges != NULL ? font_cfg.GlyphRanges : GetGlyphRangesDefault();
|
|
const ImWchar* glyph_ranges = font_cfg.GlyphRanges != NULL ? font_cfg.GlyphRanges : GetGlyphRangesDefault();
|
|
ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, glyph_ranges);
|
|
ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, glyph_ranges);
|
|
return font;
|
|
return font;
|
|
|
|
+#else
|
|
|
|
+ IM_ASSERT(0 && "AddFontDefault() disabled in this build.");
|
|
|
|
+ IM_UNUSED(font_cfg_template);
|
|
|
|
+ return NULL;
|
|
|
|
+#endif // #ifndef IMGUI_DISABLE_DEFAULT_FONT
|
|
}
|
|
}
|
|
|
|
|
|
ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
|
|
ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
|
|
@@ -4578,6 +4586,8 @@ static unsigned int stb_decompress(unsigned char *output, const unsigned char *i
|
|
// Exported using misc/fonts/binary_to_compressed_c.cpp (with compression + base85 string encoding).
|
|
// Exported using misc/fonts/binary_to_compressed_c.cpp (with compression + base85 string encoding).
|
|
// The purpose of encoding as base85 instead of "0x00,0x01,..." style is only save on _source code_ size.
|
|
// The purpose of encoding as base85 instead of "0x00,0x01,..." style is only save on _source code_ size.
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
+
|
|
|
|
+#ifndef IMGUI_DISABLE_DEFAULT_FONT
|
|
static const char proggy_clean_ttf_compressed_data_base85[11980 + 1] =
|
|
static const char proggy_clean_ttf_compressed_data_base85[11980 + 1] =
|
|
"7])#######hV0qs'/###[),##/l:$#Q6>##5[n42>c-TH`->>#/e>11NNV=Bv(*:.F?uu#(gRU.o0XGH`$vhLG1hxt9?W`#,5LsCp#-i>.r$<$6pD>Lb';9Crc6tgXmKVeU2cD4Eo3R/"
|
|
"7])#######hV0qs'/###[),##/l:$#Q6>##5[n42>c-TH`->>#/e>11NNV=Bv(*:.F?uu#(gRU.o0XGH`$vhLG1hxt9?W`#,5LsCp#-i>.r$<$6pD>Lb';9Crc6tgXmKVeU2cD4Eo3R/"
|
|
"2*>]b(MC;$jPfY.;h^`IWM9<Lh2TlS+f-s$o6Q<BWH`YiU.xfLq$N;$0iR/GX:U(jcW2p/W*q?-qmnUCI;jHSAiFWM.R*kU@C=GH?a9wp8f$e.-4^Qg1)Q-GL(lf(r/7GrRgwV%MS=C#"
|
|
"2*>]b(MC;$jPfY.;h^`IWM9<Lh2TlS+f-s$o6Q<BWH`YiU.xfLq$N;$0iR/GX:U(jcW2p/W*q?-qmnUCI;jHSAiFWM.R*kU@C=GH?a9wp8f$e.-4^Qg1)Q-GL(lf(r/7GrRgwV%MS=C#"
|
|
@@ -4670,5 +4680,6 @@ static const char* GetDefaultCompressedFontDataTTFBase85()
|
|
{
|
|
{
|
|
return proggy_clean_ttf_compressed_data_base85;
|
|
return proggy_clean_ttf_compressed_data_base85;
|
|
}
|
|
}
|
|
|
|
+#endif // #ifndef IMGUI_DISABLE_DEFAULT_FONT
|
|
|
|
|
|
#endif // #ifndef IMGUI_DISABLE
|
|
#endif // #ifndef IMGUI_DISABLE
|