Load embedded ProggyClean.ttf at size 13, disable oversampling If you want a similar font which may be better scaled, consider using ProggyVector from the same author!
| 3100 | // Load embedded ProggyClean.ttf at size 13, disable oversampling |
| 3101 | // If you want a similar font which may be better scaled, consider using ProggyVector from the same author! |
| 3102 | ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template) |
| 3103 | { |
| 3104 | #ifndef IMGUI_DISABLE_DEFAULT_FONT |
| 3105 | ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig(); |
| 3106 | if (!font_cfg_template) |
| 3107 | { |
| 3108 | font_cfg.OversampleH = font_cfg.OversampleV = 1; |
| 3109 | font_cfg.PixelSnapH = true; |
| 3110 | } |
| 3111 | if (font_cfg.SizePixels <= 0.0f) |
| 3112 | font_cfg.SizePixels = 13.0f * 1.0f; |
| 3113 | if (font_cfg.Name[0] == '\0') |
| 3114 | ImFormatString(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "ProggyClean.ttf"); |
| 3115 | font_cfg.EllipsisChar = (ImWchar)0x0085; |
| 3116 | font_cfg.GlyphOffset.y += 1.0f * IM_TRUNC(font_cfg.SizePixels / 13.0f); // Add +1 offset per 13 units |
| 3117 | |
| 3118 | int ttf_compressed_size = 0; |
| 3119 | const char* ttf_compressed = GetDefaultCompressedFontDataTTF(&ttf_compressed_size); |
| 3120 | return AddFontFromMemoryCompressedTTF(ttf_compressed, ttf_compressed_size, font_cfg.SizePixels, &font_cfg); |
| 3121 | #else |
| 3122 | IM_ASSERT(0 && "AddFontDefault() disabled in this build."); |
| 3123 | IM_UNUSED(font_cfg_template); |
| 3124 | return NULL; |
| 3125 | #endif // #ifndef IMGUI_DISABLE_DEFAULT_FONT |
| 3126 | } |
| 3127 | |
| 3128 | ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges) |
| 3129 | { |
no test coverage detected