[DEBUG] Display details for a single font, called by ShowStyleEditor().
| 23276 | |
| 23277 | // [DEBUG] Display details for a single font, called by ShowStyleEditor(). |
| 23278 | void ImGui::DebugNodeFont(ImFont* font) |
| 23279 | { |
| 23280 | ImGuiContext& g = *GImGui; |
| 23281 | ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; |
| 23282 | ImFontAtlas* atlas = font->OwnerAtlas; |
| 23283 | bool opened = TreeNode(font, "Font: \"%s\": %d sources(s)", font->GetDebugName(), font->Sources.Size); |
| 23284 | |
| 23285 | // Display preview text |
| 23286 | if (!opened) |
| 23287 | Indent(); |
| 23288 | Indent(); |
| 23289 | if (cfg->ShowFontPreview) |
| 23290 | { |
| 23291 | PushFont(font, 0.0f); |
| 23292 | Text("The quick brown fox jumps over the lazy dog"); |
| 23293 | PopFont(); |
| 23294 | } |
| 23295 | if (!opened) |
| 23296 | { |
| 23297 | Unindent(); |
| 23298 | Unindent(); |
| 23299 | return; |
| 23300 | } |
| 23301 | if (SmallButton("Set as default")) |
| 23302 | GetIO().FontDefault = font; |
| 23303 | SameLine(); |
| 23304 | BeginDisabled(atlas->Fonts.Size <= 1 || atlas->Locked); |
| 23305 | if (SmallButton("Remove")) |
| 23306 | atlas->RemoveFont(font); |
| 23307 | EndDisabled(); |
| 23308 | SameLine(); |
| 23309 | if (SmallButton("Clear bakes")) |
| 23310 | ImFontAtlasFontDiscardBakes(atlas, font, 0); |
| 23311 | SameLine(); |
| 23312 | if (SmallButton("Clear unused")) |
| 23313 | ImFontAtlasFontDiscardBakes(atlas, font, 2); |
| 23314 | |
| 23315 | // Display details |
| 23316 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
| 23317 | SetNextItemWidth(GetFontSize() * 8); |
| 23318 | DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); |
| 23319 | /*SameLine(); MetricsHelpMarker( |
| 23320 | "Note that the default embedded font is NOT meant to be scaled.\n\n" |
| 23321 | "Font are currently rendered into bitmaps at a given size at the time of building the atlas. " |
| 23322 | "You may oversample them to get some flexibility with scaling. " |
| 23323 | "You can also render at multiple sizes and select which one to use at runtime.\n\n" |
| 23324 | "(Glimmer of hope: the atlas system will be rewritten in the future to make scaling more flexible.)");*/ |
| 23325 | #endif |
| 23326 | |
| 23327 | char c_str[5]; |
| 23328 | ImTextCharToUtf8(c_str, font->FallbackChar); |
| 23329 | Text("Fallback character: '%s' (U+%04X)", c_str, font->FallbackChar); |
| 23330 | ImTextCharToUtf8(c_str, font->EllipsisChar); |
| 23331 | Text("Ellipsis character: '%s' (U+%04X)", c_str, font->EllipsisChar); |
| 23332 | |
| 23333 | for (int src_n = 0; src_n < font->Sources.Size; src_n++) |
| 23334 | { |
| 23335 | ImFontConfig* src = font->Sources[src_n]; |
nothing calls this directly
no test coverage detected