refactor(smallerfonts): simplify to Disabled/Enabled, drop 2pt for Noto and Bookerly, skip OpenDyslexic
This commit is contained in:
@@ -5,9 +5,8 @@ namespace SmallerFontsPlugin {
|
||||
|
||||
const char* modeName(SmallerFontsMode mode) {
|
||||
switch (mode) {
|
||||
case SmallerFontsMode::SMALLER: return "Smaller";
|
||||
case SmallerFontsMode::SMALLEST: return "Smallest";
|
||||
default: return "Disabled";
|
||||
case SmallerFontsMode::ENABLED: return "Enabled";
|
||||
default: return "Disabled";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,46 +14,19 @@ int resolveReaderFontId(int baseFontId, SmallerFontsMode mode) {
|
||||
if (mode == SmallerFontsMode::MODE_OFF) return baseFontId;
|
||||
|
||||
if (baseFontId == NOTOSERIF_12_FONT_ID) return NOTOSERIF_12_FONT_ID;
|
||||
if (baseFontId == NOTOSERIF_14_FONT_ID) {
|
||||
if (mode == SmallerFontsMode::SMALLER) return NOTOSERIF_12_FONT_ID;
|
||||
if (mode == SmallerFontsMode::SMALLEST) return NOTOSERIF_12_FONT_ID;
|
||||
}
|
||||
if (baseFontId == NOTOSERIF_16_FONT_ID) {
|
||||
if (mode == SmallerFontsMode::SMALLER) return NOTOSERIF_14_FONT_ID;
|
||||
if (mode == SmallerFontsMode::SMALLEST) return NOTOSERIF_12_FONT_ID;
|
||||
}
|
||||
if (baseFontId == NOTOSERIF_18_FONT_ID) {
|
||||
if (mode == SmallerFontsMode::SMALLER) return NOTOSERIF_16_FONT_ID;
|
||||
if (mode == SmallerFontsMode::SMALLEST) return NOTOSERIF_14_FONT_ID;
|
||||
}
|
||||
if (baseFontId == NOTOSERIF_14_FONT_ID) return NOTOSERIF_12_FONT_ID;
|
||||
if (baseFontId == NOTOSERIF_16_FONT_ID) return NOTOSERIF_14_FONT_ID;
|
||||
if (baseFontId == NOTOSERIF_18_FONT_ID) return NOTOSERIF_16_FONT_ID;
|
||||
|
||||
if (baseFontId == NOTOSANS_12_FONT_ID) return NOTOSANS_12_FONT_ID;
|
||||
if (baseFontId == NOTOSANS_14_FONT_ID) {
|
||||
if (mode == SmallerFontsMode::SMALLER) return NOTOSANS_12_FONT_ID;
|
||||
if (mode == SmallerFontsMode::SMALLEST) return NOTOSANS_12_FONT_ID;
|
||||
}
|
||||
if (baseFontId == NOTOSANS_16_FONT_ID) {
|
||||
if (mode == SmallerFontsMode::SMALLER) return NOTOSANS_14_FONT_ID;
|
||||
if (mode == SmallerFontsMode::SMALLEST) return NOTOSANS_12_FONT_ID;
|
||||
}
|
||||
if (baseFontId == NOTOSANS_18_FONT_ID) {
|
||||
if (mode == SmallerFontsMode::SMALLER) return NOTOSANS_16_FONT_ID;
|
||||
if (mode == SmallerFontsMode::SMALLEST) return NOTOSANS_14_FONT_ID;
|
||||
}
|
||||
if (baseFontId == NOTOSANS_14_FONT_ID) return NOTOSANS_12_FONT_ID;
|
||||
if (baseFontId == NOTOSANS_16_FONT_ID) return NOTOSANS_14_FONT_ID;
|
||||
if (baseFontId == NOTOSANS_18_FONT_ID) return NOTOSANS_16_FONT_ID;
|
||||
|
||||
if (baseFontId == OPENDYSLEXIC_8_FONT_ID) return OPENDYSLEXIC_8_FONT_ID;
|
||||
if (baseFontId == OPENDYSLEXIC_10_FONT_ID) {
|
||||
if (mode == SmallerFontsMode::SMALLER) return OPENDYSLEXIC_8_FONT_ID;
|
||||
if (mode == SmallerFontsMode::SMALLEST) return OPENDYSLEXIC_8_FONT_ID;
|
||||
}
|
||||
if (baseFontId == OPENDYSLEXIC_12_FONT_ID) {
|
||||
if (mode == SmallerFontsMode::SMALLER) return OPENDYSLEXIC_10_FONT_ID;
|
||||
if (mode == SmallerFontsMode::SMALLEST) return OPENDYSLEXIC_8_FONT_ID;
|
||||
}
|
||||
if (baseFontId == OPENDYSLEXIC_14_FONT_ID) {
|
||||
if (mode == SmallerFontsMode::SMALLER) return OPENDYSLEXIC_12_FONT_ID;
|
||||
if (mode == SmallerFontsMode::SMALLEST) return OPENDYSLEXIC_10_FONT_ID;
|
||||
}
|
||||
if (baseFontId == BOOKERLY_12_FONT_ID) return BOOKERLY_12_FONT_ID;
|
||||
if (baseFontId == BOOKERLY_14_FONT_ID) return BOOKERLY_12_FONT_ID;
|
||||
if (baseFontId == BOOKERLY_16_FONT_ID) return BOOKERLY_14_FONT_ID;
|
||||
if (baseFontId == BOOKERLY_18_FONT_ID) return BOOKERLY_16_FONT_ID;
|
||||
|
||||
return baseFontId;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
enum class SmallerFontsMode : uint8_t {
|
||||
MODE_OFF = 0,
|
||||
SMALLER = 1,
|
||||
SMALLEST = 2,
|
||||
MODE_OFF = 0,
|
||||
ENABLED = 1,
|
||||
};
|
||||
|
||||
namespace SmallerFontsPlugin {
|
||||
|
||||
@@ -108,7 +108,7 @@ def patch_settings_list_h(repo_dir):
|
||||
|
||||
entry = (
|
||||
' SettingInfo::Enum(StrId::STR_NONE_OPT, &CrossPointSettings::smallerFontsMode,\n'
|
||||
' {StrId::STR_NONE_OPT, StrId::STR_NONE_OPT, StrId::STR_NONE_OPT}, "smallerFontsMode"),\n'
|
||||
' {StrId::STR_NONE_OPT, StrId::STR_NONE_OPT}, "smallerFontsMode"),\n'
|
||||
)
|
||||
|
||||
content = content.replace(
|
||||
@@ -183,14 +183,14 @@ def patch_settings_cpp(repo_dir):
|
||||
' ));\n'
|
||||
' pluginsSettings.push_back(SettingInfo::Enum(\n'
|
||||
' StrId::STR_NONE_OPT, &CrossPointSettings::smallerFontsMode,\n'
|
||||
' {StrId::STR_NONE_OPT, StrId::STR_NONE_OPT, StrId::STR_NONE_OPT}, "smallerFontsMode"\n'
|
||||
' {StrId::STR_NONE_OPT, StrId::STR_NONE_OPT}, "smallerFontsMode"\n'
|
||||
' ));\n'
|
||||
)
|
||||
|
||||
sf_only_block = (
|
||||
' pluginsSettings.push_back(SettingInfo::Enum(\n'
|
||||
' StrId::STR_NONE_OPT, &CrossPointSettings::smallerFontsMode,\n'
|
||||
' {StrId::STR_NONE_OPT, StrId::STR_NONE_OPT, StrId::STR_NONE_OPT}, "smallerFontsMode"\n'
|
||||
' {StrId::STR_NONE_OPT, StrId::STR_NONE_OPT}, "smallerFontsMode"\n'
|
||||
' ));\n'
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user