Looking for TTF fonts, first on the VULKAN SDK, then Windows default fonts.
Set Nicer fonts.
Set Nicer fonts.
128 {
130
131 ImGuiIO& io = ImGui::GetIO();
133
137 ImFont* font = nullptr;
139 {
140 if (font == nullptr)
141 {
142 const std::string p = R"(C:/Windows/Fonts/consola.ttf)";
144 {
145 font = io.Fonts->AddFontFromFileTTF(p.c_str(), 12.0f * high_dpi_scale);
146 }
147 }
148 }
150 {
151 const char* vk_path = getenv("VK_SDK_PATH");
152 if (vk_path)
153 {
154 const std::string p = std::string(vk_path) + R"(/Samples/Layer-Samples/data/FreeSans.ttf)";
156 font = io.Fonts->AddFontFromFileTTF(p.c_str(), 16.0f * high_dpi_scale);
157 }
158 if (font == nullptr)
159 {
160 const std::string p = R"(C:/Windows/Fonts/segoeui.ttf)";
162 font = io.Fonts->AddFontFromFileTTF(p.c_str(), 16.0f * high_dpi_scale);
163 }
164 }
165
166 if (font == nullptr)
167 {
168 ImFontConfig font_config = ImFontConfig();
169 font_config.SizePixels = 13.0f * ((fontmode ==
FONT_FIXED) ? 1 : high_dpi_scale);
170 io.Fonts->AddFontDefault(&font_config);
171 }
172
173 float iconFontSize = 15.0f * high_dpi_scale;
174
175
176 static constexpr ImWchar icons_ranges[] = { ICON_MIN_MD, ICON_MAX_16_MD, 0 };
177 ImFontConfig icons_config;
178 icons_config.MergeMode = true;
179 icons_config.PixelSnapH = true;
180 icons_config.GlyphMinAdvanceX = iconFontSize;
181 icons_config.GlyphOffset.y = 3.0f;
182
183 std::stringstream ss;
184 ss << SPICES_ENGINE_ASSETS_PATH << "Fonts/" << FONT_ICON_FILE_NAME_MD;
186 {
187 io.Fonts->AddFontFromFileTTF(ss.str().c_str(), iconFontSize, &icons_config, icons_ranges);
188 }
189 }
#define SPICES_PROFILE_ZONE
static bool FileLibrary_Exists(const char *path)
Determine whether the given string is existing a file.
static float GetDPIScale()
Get GLFW DPI Scale.
@ FONT_PROPORTIONAL_SCALED