Skip to content

Commit bfa6520

Browse files
authored
Create imgui.cpp
1 parent 15a0666 commit bfa6520

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

imgui.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Heres the code for loading the font from momory using imgui
2+
// for more info on imgui you can reach out here https://github.com/ocornut/imgui
3+
4+
ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
5+
{
6+
ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
7+
if (!font_cfg_template)
8+
{
9+
font_cfg.OversampleH = font_cfg.OversampleV = 1;
10+
font_cfg.PixelSnapH = true;
11+
}
12+
if (font_cfg.Name[0] == '\0') strcpy(font_cfg.Name, "Courirer New.ttf, 13px"); //change font name
13+
if (font_cfg.SizePixels <= 0.0f) font_cfg.SizePixels = 13.0f;
14+
15+
const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();
16+
ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, GetGlyphRangesDefault());
17+
return font;
18+
}

0 commit comments

Comments
 (0)