Skip to content

Commit

Permalink
- rename ttx_font_file => font_file_monospace
Browse files Browse the repository at this point in the history
  • Loading branch information
vanhofen committed Jan 30, 2022
1 parent 7d30c9f commit 6906870
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 22 deletions.
10 changes: 5 additions & 5 deletions lib/libtuxtxt/tuxtxt.cpp
Expand Up @@ -1866,7 +1866,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)
Expand Down Expand Up @@ -2081,7 +2081,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);
Expand Down Expand Up @@ -2111,8 +2111,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;
Expand All @@ -2129,7 +2129,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;

Expand Down
10 changes: 5 additions & 5 deletions src/gui/osd_setup.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -278,10 +278,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) + ")";
Expand Down Expand Up @@ -1105,7 +1105,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);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/widget/yaft/yaft_priv.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
23 changes: 15 additions & 8 deletions src/neutrino.cpp
Expand Up @@ -357,7 +357,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)
{
Expand Down Expand Up @@ -1096,13 +1096,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", 105);
g_settings.font_scaling_y = configfile.getInt32("font_scaling_y", 105);
Expand Down Expand Up @@ -1520,8 +1520,8 @@ void CNeutrinoApp::upgradeSetup(const char * fname)
if (g_settings.version_pseudo < "20180123160000")
{
// apply tuxtxt font changes
if (g_settings.ttx_font_file == FONTDIR "/DejaVuLGCSansMono-Bold.ttf")
g_settings.ttx_font_file = FONTDIR "/tuxtxt.ttf";
if (g_settings.font_file_monospace == FONTDIR "/DejaVuLGCSansMono-Bold.ttf")
g_settings.font_file_monospace = FONTDIR "/tuxtxt.ttf";
}
if (g_settings.version_pseudo < "20181216000000")
{
Expand Down Expand Up @@ -1628,6 +1628,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);
Expand Down Expand Up @@ -2137,7 +2144,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);
Expand Down
2 changes: 1 addition & 1 deletion src/system/settings.h
Expand Up @@ -850,7 +850,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;
Expand Down
2 changes: 1 addition & 1 deletion version_pseudo.h
@@ -1 +1 @@
#define NEUTRINO_VERSION_PSEUDO "20220114220000"
#define NEUTRINO_VERSION_PSEUDO "20220130200000"

0 comments on commit 6906870

Please sign in to comment.