1
0
mirror of synced 2024-11-28 01:20:51 +01:00

impr: Only load a limited subset of unicode characters by default

This commit is contained in:
WerWolv 2023-06-24 10:58:42 +02:00
parent cabe9cf995
commit ade05f8e12
11 changed files with 16 additions and 16 deletions

View File

@ -205,13 +205,13 @@ namespace hex::init {
// Setup basic font configuration
auto fonts = IM_NEW(ImFontAtlas)();
ImFontConfig cfg = {};
cfg.OversampleH = cfg.OversampleV = 2, cfg.PixelSnapH = true;
cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true;
cfg.SizePixels = fontSize;
fonts->Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight;
// Configure font glyph ranges that should be loaded from the default font and unifont
ImVector<ImWchar> ranges;
static ImVector<ImWchar> ranges;
{
ImFontGlyphRangesBuilder glyphRangesBuilder;
@ -241,12 +241,12 @@ namespace hex::init {
}
// Glyph range for font awesome icons
ImWchar fontAwesomeRange[] = {
static ImWchar fontAwesomeRange[] = {
ICON_MIN_FA, ICON_MAX_FA, 0
};
// Glyph range for codicons icons
ImWchar codiconsRange[] = {
static ImWchar codiconsRange[] = {
ICON_MIN_VS, ICON_MAX_VS, 0
};
@ -284,7 +284,7 @@ namespace hex::init {
IM_DELETE(fonts);
// Disable unicode support in settings
ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.enable_unicode", false);
ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.load_all_unicode_chars", false);
// Try to load the font atlas again
return loadFontsImpl(false);
@ -305,7 +305,7 @@ namespace hex::init {
// Check if unicode support is enabled in the settings and that the user doesn't use the No GPU version on Windows
// The Mesa3D software renderer on Windows identifies itself as "VMware, Inc."
bool shouldLoadUnicode =
ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.enable_unicode", true) &&
ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.load_all_unicode_chars", false) &&
ImHexApi::System::getGPUVendor() != "VMware, Inc.";
return loadFontsImpl(shouldLoadUnicode);

View File

@ -444,7 +444,7 @@
"hex.builtin.setting.general": "Allgemein",
"hex.builtin.setting.general.auto_load_patterns": "Automatisches Laden unterstützter Pattern",
"hex.builtin.setting.general.server_contact": "Update checks und Statistiken zulassen",
"hex.builtin.setting.general.enable_unicode": "Alle Unicode Zeichen laden",
"hex.builtin.setting.general.load_all_unicode_chars": "Alle Unicode Zeichen laden",
"hex.builtin.setting.general.network_interface": "",
"hex.builtin.setting.general.save_recent_providers": "",
"hex.builtin.setting.general.show_tips": "Tipps beim Start anzeigen",

View File

@ -450,7 +450,7 @@
"hex.builtin.setting.general": "General",
"hex.builtin.setting.general.auto_load_patterns": "Auto-load supported pattern",
"hex.builtin.setting.general.server_contact": "Enable update checks and usage statistics",
"hex.builtin.setting.general.enable_unicode": "Load all unicode characters",
"hex.builtin.setting.general.load_all_unicode_chars": "Load all unicode characters",
"hex.builtin.setting.general.network_interface": "Enable network interface",
"hex.builtin.setting.general.save_recent_providers": "Save recently used providers",
"hex.builtin.setting.general.show_tips": "Show tips on startup",

View File

@ -442,7 +442,7 @@
"hex.builtin.setting.general": "General",
"hex.builtin.setting.general.auto_load_patterns": "Cargar automáticamente patterns soportados",
"hex.builtin.setting.general.server_contact": "",
"hex.builtin.setting.general.enable_unicode": "Cargar todos los caracteres unicode",
"hex.builtin.setting.general.load_all_unicode_chars": "Cargar todos los caracteres unicode",
"hex.builtin.setting.general.network_interface": "",
"hex.builtin.setting.general.save_recent_providers": "Guardar proveedores recientemente utilizados",
"hex.builtin.setting.general.show_tips": "Mostrar consejos al inicio",

View File

@ -442,7 +442,7 @@
"hex.builtin.setting.general": "Generali",
"hex.builtin.setting.general.auto_load_patterns": "Auto-caricamento del pattern supportato",
"hex.builtin.setting.general.server_contact": "",
"hex.builtin.setting.general.enable_unicode": "",
"hex.builtin.setting.general.load_all_unicode_chars": "",
"hex.builtin.setting.general.network_interface": "",
"hex.builtin.setting.general.save_recent_providers": "",
"hex.builtin.setting.general.show_tips": "Mostra consigli all'avvio",

View File

@ -442,7 +442,7 @@
"hex.builtin.setting.general": "基本",
"hex.builtin.setting.general.auto_load_patterns": "対応するパターンを自動で読み込む",
"hex.builtin.setting.general.server_contact": "",
"hex.builtin.setting.general.enable_unicode": "",
"hex.builtin.setting.general.load_all_unicode_chars": "",
"hex.builtin.setting.general.network_interface": "",
"hex.builtin.setting.general.save_recent_providers": "",
"hex.builtin.setting.general.show_tips": "起動時に豆知識を表示",

View File

@ -442,7 +442,7 @@
"hex.builtin.setting.general": "일반",
"hex.builtin.setting.general.auto_load_patterns": "지원하는 패턴 자동으로 로드",
"hex.builtin.setting.general.server_contact": "",
"hex.builtin.setting.general.enable_unicode": "",
"hex.builtin.setting.general.load_all_unicode_chars": "",
"hex.builtin.setting.general.network_interface": "",
"hex.builtin.setting.general.save_recent_providers": "",
"hex.builtin.setting.general.show_tips": "시작 시 팁 표시",

View File

@ -442,7 +442,7 @@
"hex.builtin.setting.general": "General",
"hex.builtin.setting.general.auto_load_patterns": "Padrão compatível com carregamento automático",
"hex.builtin.setting.general.server_contact": "",
"hex.builtin.setting.general.enable_unicode": "",
"hex.builtin.setting.general.load_all_unicode_chars": "",
"hex.builtin.setting.general.network_interface": "",
"hex.builtin.setting.general.save_recent_providers": "",
"hex.builtin.setting.general.show_tips": "Mostrar dicas na inicialização",

View File

@ -442,7 +442,7 @@
"hex.builtin.setting.general": "通用",
"hex.builtin.setting.general.auto_load_patterns": "自动加载支持的模式",
"hex.builtin.setting.general.server_contact": "",
"hex.builtin.setting.general.enable_unicode": "加载所有 Unicode 字符",
"hex.builtin.setting.general.load_all_unicode_chars": "加载所有 Unicode 字符",
"hex.builtin.setting.general.network_interface": "",
"hex.builtin.setting.general.save_recent_providers": "",
"hex.builtin.setting.general.show_tips": "在启动时显示每日提示",

View File

@ -442,7 +442,7 @@
"hex.builtin.setting.general": "一般",
"hex.builtin.setting.general.auto_load_patterns": "自動載入支援的模式",
"hex.builtin.setting.general.server_contact": "",
"hex.builtin.setting.general.enable_unicode": "載入所有 unicode 字元",
"hex.builtin.setting.general.load_all_unicode_chars": "載入所有 unicode 字元",
"hex.builtin.setting.general.network_interface": "",
"hex.builtin.setting.general.save_recent_providers": "",
"hex.builtin.setting.general.show_tips": "啟動時顯示提示",

View File

@ -73,7 +73,7 @@ namespace hex::plugin::builtin {
return false;
});
ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.enable_unicode", 1, [](auto name, nlohmann::json &setting) {
ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.load_all_unicode_chars", 0, [](auto name, nlohmann::json &setting) {
static bool enabled = static_cast<int>(setting);
if (ImGui::Checkbox(name.data(), &enabled)) {