MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / setup_ui_fonts

Function setup_ui_fonts

src/host/ui_fonts.cpp:53–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51} // namespace
52
53void setup_ui_fonts(const float content_scale) {
54 ImGuiIO& io = ImGui::GetIO();
55 const float px = kUiFontSizeBase * content_scale;
56
57 ImFontConfig roboto_cfg{};
58 io.Fonts->AddFontFromMemoryTTF(
59 imgui_owned_font_copy(fonts::kRobotoRegular,
60 sizeof(fonts::kRobotoRegular)),
61 static_cast<int>(sizeof(fonts::kRobotoRegular)),
62 px,
63 &roboto_cfg);
64
65 // Fontello icon glyphs merged into the same font (the legacy Qt
66 // frontend applied these same codepoints as QToolButton text via
67 // setFontIcon; see tag legacy-qt).
68 static constexpr std::array<ImWchar, 5> kIconRanges = {
69 0xE800, 0xE808, 0xF031, 0xF031, 0};
70 ImFontConfig icon_cfg{};
71 icon_cfg.MergeMode = true;
72 io.Fonts->AddFontFromMemoryTTF(
73 imgui_owned_font_copy(fonts::kFontello, sizeof(fonts::kFontello)),
74 static_cast<int>(sizeof(fonts::kFontello)),
75 px,
76 &icon_cfg,
77 kIconRanges.data());
78
79 // Rasterized at content_scale, displayed at logical size: crisp HiDPI.
80 io.FontGlobalScale = 1.0f / content_scale;
81}
82
83} // namespace oid::host

Callers 2

initializeMethod · 0.85
begin_frameMethod · 0.85

Calls 2

imgui_owned_font_copyFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected