mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
impr: Move Jetbrains mono into regular font selector, allow it to be scaled
This commit is contained in:
@@ -263,23 +263,7 @@ namespace hex::fonts {
|
||||
}
|
||||
|
||||
float getFontSize() {
|
||||
float fontSize = ImHexApi::Fonts::DefaultFontSize;
|
||||
|
||||
if (auto scaling = ImHexApi::System::getGlobalScale(); u32(scaling) * 10 == u32(scaling * 10))
|
||||
fontSize *= scaling;
|
||||
else
|
||||
fontSize *= scaling * 0.75F;
|
||||
|
||||
// Fall back to the default font if the global scale is 0
|
||||
if (fontSize == 0.0F)
|
||||
fontSize = ImHexApi::Fonts::DefaultFontSize;
|
||||
|
||||
// If a custom font is used, adjust the font size
|
||||
if (!ImHexApi::Fonts::getCustomFontPath().empty()) {
|
||||
fontSize = float(ContentRegistry::Settings::read<int>("hex.builtin.setting.font", "hex.builtin.setting.font.font_size", 13)) * ImHexApi::System::getGlobalScale();
|
||||
}
|
||||
|
||||
return fontSize;
|
||||
return float(ContentRegistry::Settings::read<int>("hex.builtin.setting.font", "hex.builtin.setting.font.font_size", 13)) * ImHexApi::System::getGlobalScale();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -330,7 +314,7 @@ namespace hex::fonts {
|
||||
if (pixelPerfectFont)
|
||||
defaultFont = fontAtlas.addDefaultFont();
|
||||
else
|
||||
defaultFont = fontAtlas.addFontFromRomFs("fonts/JetBrainsMono.ttf", 14 * ImHexApi::System::getGlobalScale(), true, ImVec2());
|
||||
defaultFont = fontAtlas.addFontFromRomFs("fonts/JetBrainsMono.ttf", fontSize, true, ImVec2());
|
||||
|
||||
if (!fontAtlas.build()) {
|
||||
log::fatal("Failed to load default font!");
|
||||
|
||||
Reference in New Issue
Block a user