Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,24 @@ void Menu::Init()
font_config.RasterizerMultiply = 1.1f; // Slightly darker font rendering
font_config.FontBuilderFlags = 0; // No additional flags needed

// Add high-quality font with improved settings
imgui_io.Fonts->AddFontFromFileTTF("Data\\Interface\\CommunityShaders\\Fonts\\Jost-Regular.ttf", 36, &font_config);

DXGI_SWAP_CHAIN_DESC desc;
globals::d3d::swapChain->GetDesc(&desc);
// Load font
DXGI_SWAP_CHAIN_DESC desc{};
if (FAILED(globals::d3d::swapChain->GetDesc(&desc)) || desc.BufferDesc.Height == 0) {
logger::warn("Failed to get swap chain description. Using default 1080p font size.");
desc.BufferDesc.Height = 1080;
}
uint32_t height = desc.BufferDesc.Height; // Screen pixel height
// Calculate base font size based on screen height (e.g., 2% of screen height)
const float baseFontSize = height * 0.02f;
// Clamp between reasonable min/max values
const float fontSize = std::clamp(baseFontSize, 24.0f, 48.0f);

// Add font with dynamic size
if (!imgui_io.Fonts->AddFontFromFileTTF("Data\\Interface\\CommunityShaders\\Fonts\\Jost-Regular.ttf",
std::round(fontSize), &font_config)) {
logger::warn("Failed to load custom font. Using default font.");
imgui_io.Fonts->AddFontDefault();
}

// Setup Platform/Renderer backends
ImGui_ImplWin32_Init(desc.OutputWindow);
Expand Down