MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / AddFontDefault

Method AddFontDefault

plugins/Cardinal/src/DearImGui/imgui_draw.cpp:2123–2142  ·  view source on GitHub ↗

Load embedded ProggyClean.ttf at size 13, disable oversampling

Source from the content-addressed store, hash-verified

2121
2122// Load embedded ProggyClean.ttf at size 13, disable oversampling
2123ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
2124{
2125 ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
2126 if (!font_cfg_template)
2127 {
2128 font_cfg.OversampleH = font_cfg.OversampleV = 1;
2129 font_cfg.PixelSnapH = true;
2130 }
2131 if (font_cfg.SizePixels <= 0.0f)
2132 font_cfg.SizePixels = 13.0f * 1.0f;
2133 if (font_cfg.Name[0] == '\0')
2134 ImFormatString(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "ProggyClean.ttf, %dpx", (int)font_cfg.SizePixels);
2135 font_cfg.EllipsisChar = (ImWchar)0x0085;
2136 font_cfg.GlyphOffset.y = 1.0f * IM_FLOOR(font_cfg.SizePixels / 13.0f); // Add +1 offset per 13 units
2137
2138 const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();
2139 const ImWchar* glyph_ranges = font_cfg.GlyphRanges != NULL ? font_cfg.GlyphRanges : GetGlyphRangesDefault();
2140 ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, glyph_ranges);
2141 return font;
2142}
2143
2144ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
2145{

Callers

nothing calls this directly

Calls 3

ImFontConfigClass · 0.85
ImFormatStringFunction · 0.85

Tested by

no test coverage detected