diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index 60893bc3c..d960fcb11 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -1868,7 +1868,7 @@ FT_Error MyFaceRequester(FTC_FaceID face_id, FT_Library plibrary, FT_Pointer /*r /****************************************************************************** * Init * ******************************************************************************/ -extern std::string ttx_font_file; +extern std::string font_file_monospace; static bool ft_init_done = false; static int oldfontheight = 0; int Init(int source) @@ -2083,7 +2083,7 @@ int Init(int source) } } #endif - if(!ft_init_done || font_file != ttx_font_file || fontheight != oldfontheight) { + if(!ft_init_done || font_file != font_file_monospace || fontheight != oldfontheight) { printf("TuxTxt: init fontlibrary\n"); if(ft_init_done) { FTC_Manager_Done(manager); @@ -2113,8 +2113,8 @@ int Init(int source) } if (usettf) { - printf("TuxTxt: using font %s\n", ttx_font_file.c_str()); - typettf.face_id = (FTC_FaceID) ttx_font_file.c_str(); + printf("TuxTxt: using font %s\n", font_file_monospace.c_str()); + typettf.face_id = (FTC_FaceID) font_file_monospace.c_str(); typettf.height = (FT_UShort) fontheight * TTFHeightFactor16 / 16; } else { typettf.face_id = (FTC_FaceID) TUXTXTOTB; @@ -2131,7 +2131,7 @@ int Init(int source) FT_Done_FreeType(library); return 0; } - font_file = ttx_font_file; + font_file = font_file_monospace; ft_init_done = true; oldfontheight = fontheight; diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 8119e5d80..39c78f02d 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -78,7 +78,7 @@ extern CRemoteControl * g_RemoteControl; extern const char * locale_real_names[]; -extern std::string ttx_font_file; +extern std::string font_file_monospace; extern CTimeOSD *FileTimeOSD; COsdSetup::COsdSetup(int wizard_mode) @@ -274,10 +274,10 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey) CFileFilter fileFilter; fileFilter.addFilter("ttf"); fileBrowser.Filter = &fileFilter; - if (fileBrowser.exec(getPathName(g_settings.ttx_font_file).c_str()) == true) + if (fileBrowser.exec(getPathName(g_settings.font_file_monospace).c_str()) == true) { - g_settings.ttx_font_file = fileBrowser.getSelectedFile()->Name; - ttx_font_file = fileBrowser.getSelectedFile()->Name; + g_settings.font_file_monospace = fileBrowser.getSelectedFile()->Name; + font_file_monospace = fileBrowser.getSelectedFile()->Name; printf("[neutrino] ttx font file %s\n", fileBrowser.getSelectedFile()->Name.c_str()); CNeutrinoApp::getInstance()->SetupFonts(CNeutrinoFonts::FONTSETUP_NEUTRINO_FONT | CNeutrinoFonts::FONTSETUP_NEUTRINO_FONT_INST); osdTtxFontFile = "(" + getBaseName(fileBrowser.getSelectedFile()->Name) + ")"; @@ -1102,7 +1102,7 @@ void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts) fontSettings->addItem(mfFontFile); // select teletext font file - osdTtxFontFile = g_settings.ttx_font_file; + osdTtxFontFile = g_settings.font_file_monospace; osdTtxFontFile = "(" + getBaseName(osdTtxFontFile) + ")"; mfTtxFontFile = new CMenuForwarder(LOCALE_COLORMENU_FONT_TTX, true, osdTtxFontFile.c_str(), this, "ttx_font", CRCInput::RC_green); mfTtxFontFile->setHint("", LOCALE_MENU_HINT_FONT_TTX); diff --git a/src/gui/widget/yaft/yaft_priv.cpp b/src/gui/widget/yaft/yaft_priv.cpp index ccf243b61..d222ef062 100644 --- a/src/gui/widget/yaft/yaft_priv.cpp +++ b/src/gui/widget/yaft/yaft_priv.cpp @@ -81,7 +81,7 @@ void YaFT_p::parse_arg(std::string &buf, struct parm_t *pt, int delim, int (is_v logging(DEBUG, "argc:%d\n", pt->argc); } -extern std::string ttx_font_file; +extern std::string font_file_monospace; /* constructor, Paint == false means "quiet mode, just execute * a command but don't display anything */ YaFT_p::YaFT_p(bool Paint) @@ -127,7 +127,7 @@ bool YaFT_p::init() */ std::string shell_ttf = CNeutrinoFonts::getInstance()->getShellTTF(); if (shell_ttf.empty()) - shell_ttf = ttx_font_file; + shell_ttf = font_file_monospace; if (paint) { for (int i = 0; i < 2; i++) { delete font; font = NULL; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index e50be7d77..7f31d3eb7 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -353,7 +353,7 @@ static SNeutrinoSettings::usermenu_t usermenu_default[] = { * CNeutrinoApp - loadSetup, load the application-settings * **************************************************************************************/ -std::string ttx_font_file = ""; +std::string font_file_monospace = ""; int CNeutrinoApp::loadSetup(const char *fname) { @@ -1094,13 +1094,13 @@ int CNeutrinoApp::loadSetup(const char *fname) // fonts g_settings.font_file = configfile.getString("font_file", FONTDIR"/neutrino.ttf"); - g_settings.ttx_font_file = configfile.getString("ttx_font_file", FONTDIR"/tuxtxt.ttf"); - if (access(g_settings.ttx_font_file, F_OK) != 0) + g_settings.font_file_monospace = configfile.getString("font_file_monospace", FONTDIR"/tuxtxt.ttf"); + if (access(g_settings.font_file_monospace, F_OK) != 0) { - g_settings.ttx_font_file = FONTDIR "/tuxtxt.ttf"; + g_settings.font_file_monospace = FONTDIR "/tuxtxt.ttf"; configfile.setUnknownKeyQueryedFlag(true); // force saving config } - ttx_font_file = g_settings.ttx_font_file.c_str(); + font_file_monospace = g_settings.font_file_monospace.c_str(); g_settings.font_scaling_x = configfile.getInt32("font_scaling_x", 100); g_settings.font_scaling_y = configfile.getInt32("font_scaling_y", 100); @@ -1476,6 +1476,12 @@ void CNeutrinoApp::upgradeSetup(const char * fname) //remove easymenu configfile.deleteKey("easymenu"); } + if (g_settings.version_pseudo < "20180123160000") + { + // apply tuxtxt font changes + if (g_settings.font_file_monospace == FONTDIR "/DejaVuLGCSansMono-Bold.ttf") + g_settings.font_file_monospace = FONTDIR "/tuxtxt.ttf"; + } if (g_settings.version_pseudo < "20181216000000") { // apply key changes; KEY_EXIT => KEY_HOME @@ -1586,6 +1592,13 @@ void CNeutrinoApp::upgradeSetup(const char * fname) { configfile.deleteKey("weather_country"); } + if (g_settings.version_pseudo < "20220130200000") + { + g_settings.font_file_monospace = configfile.getString("ttx_font_file", FONTDIR"/tuxtxt.ttf"); + if (access(g_settings.font_file_monospace, F_OK) != 0) + g_settings.font_file_monospace = FONTDIR "/tuxtxt.ttf"; + configfile.deleteKey("ttx_font_file"); + } g_settings.version_pseudo = NEUTRINO_VERSION_PSEUDO; configfile.setString("version_pseudo", g_settings.version_pseudo); @@ -2095,7 +2108,7 @@ void CNeutrinoApp::saveSetup(const char *fname) // fonts configfile.setString("font_file", g_settings.font_file); - configfile.setString("ttx_font_file", g_settings.ttx_font_file); + configfile.setString("font_file_monospace", g_settings.font_file_monospace); configfile.setInt32("font_scaling_x", g_settings.font_scaling_x); configfile.setInt32("font_scaling_y", g_settings.font_scaling_y); diff --git a/src/system/settings.h b/src/system/settings.h index 005e178a8..c7cb6f86a 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -847,7 +847,7 @@ struct SNeutrinoSettings // fonts std::string font_file; - std::string ttx_font_file; + std::string font_file_monospace; int font_scaling_x; int font_scaling_y; diff --git a/version_pseudo.h b/version_pseudo.h index 6252b8a54..82c617df5 100644 --- a/version_pseudo.h +++ b/version_pseudo.h @@ -1 +1 @@ -#define NEUTRINO_VERSION_PSEUDO "20220114220000" +#define NEUTRINO_VERSION_PSEUDO "20220130200000"