MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / AddFontDefault

Method AddFontDefault

KBotExt/imgui/imgui_draw.cpp:2169–2188  ·  view source on GitHub ↗

Load embedded ProggyClean.ttf at size 13, disable oversampling

Source from the content-addressed store, hash-verified

2167
2168// Load embedded ProggyClean.ttf at size 13, disable oversampling
2169ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
2170{
2171 ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
2172 if (!font_cfg_template)
2173 {
2174 font_cfg.OversampleH = font_cfg.OversampleV = 1;
2175 font_cfg.PixelSnapH = true;
2176 }
2177 if (font_cfg.SizePixels <= 0.0f)
2178 font_cfg.SizePixels = 13.0f * 1.0f;
2179 if (font_cfg.Name[0] == '\0')
2180 ImFormatString(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "ProggyClean.ttf, %dpx", (int)font_cfg.SizePixels);
2181 font_cfg.EllipsisChar = (ImWchar)0x0085;
2182 font_cfg.GlyphOffset.y = 1.0f * IM_FLOOR(font_cfg.SizePixels / 13.0f); // Add +1 offset per 13 units
2183
2184 const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();
2185 const ImWchar* glyph_ranges = font_cfg.GlyphRanges != NULL ? font_cfg.GlyphRanges : GetGlyphRangesDefault();
2186 ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, glyph_ranges);
2187 return font;
2188}
2189
2190ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
2191{

Callers 1

InitializeFontsMethod · 0.80

Calls 3

ImFontConfigClass · 0.85
ImFormatStringFunction · 0.85

Tested by

no test coverage detected