mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
impr: Allow ImHex to be used without subpixel rendering on Windows if only OpenGL 3 is available
This commit is contained in:
@@ -13,18 +13,33 @@ namespace hex::fonts {
|
||||
|
||||
class AntialiasPicker : public ContentRegistry::Settings::Widgets::DropDown {
|
||||
public:
|
||||
AntialiasPicker() : DropDown(
|
||||
// Only allow subpixel rendering on Windows and Linux
|
||||
#if defined(OS_WINDOWS) || defined(OS_LINUX)
|
||||
std::vector<UnlocalizedString>({"hex.fonts.setting.font.antialias_none", "hex.fonts.setting.font.antialias_grayscale", "hex.fonts.setting.font.antialias_subpixel"}),
|
||||
std::vector<nlohmann::json>({"none", "grayscale" , "subpixel"}),
|
||||
nlohmann::json("subpixel")
|
||||
#else
|
||||
std::vector<UnlocalizedString>({"hex.fonts.setting.font.antialias_none", "hex.fonts.setting.font.antialias_grayscale"}),
|
||||
std::vector<nlohmann::json>({"none", "grayscale"}),
|
||||
nlohmann::json("grayscale")
|
||||
#endif
|
||||
){}
|
||||
|
||||
AntialiasPicker() : DropDown(create()) { }
|
||||
|
||||
private:
|
||||
static bool isSubpixelRenderingSupported() {
|
||||
#if defined(OS_WINDOWS) || defined(OS_LINUX)
|
||||
return ImHexApi::System::getGLVersion() >= SemanticVersion(4,1,0);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static DropDown create() {
|
||||
if (isSubpixelRenderingSupported()) {
|
||||
return DropDown(
|
||||
std::vector<UnlocalizedString>{ "hex.fonts.setting.font.antialias_none", "hex.fonts.setting.font.antialias_grayscale", "hex.fonts.setting.font.antialias_subpixel" },
|
||||
{ "none", "grayscale" , "subpixel" },
|
||||
"subpixel"
|
||||
);
|
||||
} else {
|
||||
return DropDown(
|
||||
std::vector<UnlocalizedString>{ "hex.fonts.setting.font.antialias_none", "hex.fonts.setting.font.antialias_grayscale" },
|
||||
{ "none", "grayscale" },
|
||||
"grayscale"
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class FontFilePicker : public ContentRegistry::Settings::Widgets::FilePicker {
|
||||
|
||||
Reference in New Issue
Block a user