diff --git a/src/driver/neutrinofonts.cpp b/src/driver/neutrinofonts.cpp index 64da5fe44..997880b8b 100644 --- a/src/driver/neutrinofonts.cpp +++ b/src/driver/neutrinofonts.cpp @@ -49,6 +49,7 @@ extern font_sizes_struct neutrino_font[]; extern const char * locale_real_names[]; /* #include */ const font_sizes_struct signal_font = {NONEXISTANT_LOCALE, 14, CNeutrinoFonts::FONT_STYLE_REGULAR, 1}; +const font_sizes_struct shell_font = {NONEXISTANT_LOCALE, 18, CNeutrinoFonts::FONT_STYLE_REGULAR, 1}; CNeutrinoFonts::CNeutrinoFonts() { @@ -65,6 +66,7 @@ CNeutrinoFonts::CNeutrinoFonts() g_Font[i] = NULL; g_SignalFont = NULL; + g_ShellFont = NULL; InitDynFonts(); } @@ -191,6 +193,30 @@ void CNeutrinoFonts::SetupNeutrinoFonts(bool initRenderClass/*=true*/) g_SignalFont = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[signal_font.style].c_str(), fontSize); } +void CNeutrinoFonts::SetupShellFont() +{ + if (g_ShellFont) + { + delete g_ShellFont; + g_ShellFont = NULL; + } + + std::string shell_ttf = FONTDIR_VAR "/shell.ttf"; + if (access(shell_ttf.c_str(), F_OK) != 0) + shell_ttf = FONTDIR "/shell.ttf"; + if (access(shell_ttf.c_str(), F_OK) != 0) + return; + + if (g_shellFontRenderer != NULL) + delete g_shellFontRenderer; + g_shellFontRenderer = new FBFontRenderClass(72 * g_settings.font_scaling_x / 100, 72 * g_settings.font_scaling_y / 100); + g_shellFontRenderer->AddFont(shell_ttf.c_str()); + + std::string shell_font_name = g_shellFontRenderer->getFamily(shell_ttf.c_str()); + int shell_font_size = CFrameBuffer::getInstance()->scale2Res(shell_font.defaultsize)/* + shell_font.size_offset * fontDescr.size_offset*/; + g_ShellFont = g_shellFontRenderer->getFont(shell_font_name.c_str(), fontStyle[shell_font.style].c_str(), shell_font_size); +} + void CNeutrinoFonts::refreshDynFonts() { if (!v_share_fonts.empty()) { diff --git a/src/driver/neutrinofonts.h b/src/driver/neutrinofonts.h index 9be5cff4f..5f3f8eb0f 100644 --- a/src/driver/neutrinofonts.h +++ b/src/driver/neutrinofonts.h @@ -130,6 +130,7 @@ class CNeutrinoFonts void SetupNeutrinoFonts(bool initRenderClass = true); void SetupDynamicFonts(bool initRenderClass = true); + void SetupShellFont(); void refreshDynFonts(); Font **getDynFont(int &dx, int &dy, std::string text="", int style=FONT_STYLE_REGULAR, int share=FONT_ID_SHARE); void setFontUseDigitHeight(bool set=true) {useDigitOffset = set;} diff --git a/src/global.h b/src/global.h index b7f06daaf..1d934597e 100644 --- a/src/global.h +++ b/src/global.h @@ -70,10 +70,12 @@ NEUTRINO_CPP CTimerdClient *g_Timerd; class FBFontRenderClass; NEUTRINO_CPP FBFontRenderClass *g_fontRenderer; NEUTRINO_CPP FBFontRenderClass *g_dynFontRenderer; +NEUTRINO_CPP FBFontRenderClass *g_shellFontRenderer; class Font; NEUTRINO_CPP Font * g_Font[SNeutrinoSettings::FONT_TYPE_COUNT]; NEUTRINO_CPP Font * g_SignalFont; +NEUTRINO_CPP Font * g_ShellFont; class CRCInput; NEUTRINO_CPP CRCInput *g_RCInput; diff --git a/src/gui/widget/shellwindow.cpp b/src/gui/widget/shellwindow.cpp index 023390d46..4d8829a1c 100644 --- a/src/gui/widget/shellwindow.cpp +++ b/src/gui/widget/shellwindow.cpp @@ -118,7 +118,8 @@ void CShellWindow::exec() return; } - Font *font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]; + CNeutrinoFonts::getInstance()->SetupShellFont(); + Font *font = g_ShellFont ? g_ShellFont : g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]; int h_shell = frameBuffer->getScreenHeight(); int w_shell = frameBuffer->getScreenWidth(); unsigned int lines_max = h_shell / font->getHeight(); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index cded5c48a..dd12bbc92 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -4775,6 +4775,7 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) delete g_RemoteControl; delete g_fontRenderer; delete g_dynFontRenderer; + delete g_shellFontRenderer; delete hint; @@ -5326,6 +5327,7 @@ void CNeutrinoApp::Cleanup() printf("cleanup 11\n");fflush(stdout); delete g_fontRenderer; g_fontRenderer = NULL; delete g_dynFontRenderer; g_dynFontRenderer = NULL; + delete g_shellFontRenderer; g_shellFontRenderer = NULL; printf("cleanup 12\n");fflush(stdout); delete g_PicViewer; g_PicViewer = NULL; printf("cleanup 13\n");fflush(stdout); @@ -5378,6 +5380,7 @@ void CNeutrinoApp::Cleanup() } printf("cleanup 2\n");fflush(stdout); delete g_SignalFont; g_SignalFont = NULL; + delete g_ShellFont; g_ShellFont = NULL; printf("cleanup 3\n");fflush(stdout); configfile.clear();