MCPcopy Create free account
hub / github.com/cinder/Cinder / ShowFontSelector

Method ShowFontSelector

src/imgui/imgui.cpp:17894–17922  ·  view source on GitHub ↗

Demo helper function to select among loaded fonts. Here we use the regular BeginCombo()/EndCombo() api which is the more flexible one.

Source from the content-addressed store, hash-verified

17892// Demo helper function to select among loaded fonts.
17893// Here we use the regular BeginCombo()/EndCombo() api which is the more flexible one.
17894void ImGui::ShowFontSelector(const char* label)
17895{
17896 ImGuiIO& io = GetIO();
17897 ImFont* font_current = GetFont();
17898 if (BeginCombo(label, font_current->GetDebugName()))
17899 {
17900 for (ImFont* font : io.Fonts->Fonts)
17901 {
17902 PushID((void*)font);
17903 if (Selectable(font->GetDebugName(), font == font_current, ImGuiSelectableFlags_SelectOnNav))
17904 io.FontDefault = font;
17905 if (font == font_current)
17906 SetItemDefaultFocus();
17907 PopID();
17908 }
17909 EndCombo();
17910 }
17911 SameLine();
17912 if (io.BackendFlags & ImGuiBackendFlags_RendererHasTextures)
17913 MetricsHelpMarker(
17914 "- Load additional fonts with io.Fonts->AddFontXXX() functions.\n"
17915 "- Read FAQ and docs/FONTS.md for more details.");
17916 else
17917 MetricsHelpMarker(
17918 "- Load additional fonts with io.Fonts->AddFontXXX() functions.\n"
17919 "- The font atlas is built when calling io.Fonts->GetTexDataAsXXXX() or io.Fonts->Build().\n"
17920 "- Read FAQ and docs/FONTS.md for more details.\n"
17921 "- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame().");
17922}
17923#endif // #if !defined(IMGUI_DISABLE_DEMO_WINDOWS) || !defined(IMGUI_DISABLE_DEBUG_TOOLS)
17924
17925//-----------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 2

MetricsHelpMarkerFunction · 0.85
GetDebugNameMethod · 0.80

Tested by

no test coverage detected