mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 00:41:09 +02:00
neutrinofonts: allow monospaced font for shellwindow widget
Font is initialized at runtime and uses FONTDIR_VAR "/shell.ttf" or FONTDIR "/shell.ttf"
Origin commit data
------------------
Branch: ni/coolstream
Commit: 721300f60b
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-01-27 (Sat, 27 Jan 2018)
Origin message was:
------------------
- neutrinofonts: allow monospaced font for shellwindow widget
Font is initialized at runtime and uses FONTDIR_VAR "/shell.ttf" or FONTDIR "/shell.ttf"
------------------
This commit was generated by Migit
This commit is contained in:
@@ -49,6 +49,7 @@ extern font_sizes_struct neutrino_font[];
|
||||
extern const char * locale_real_names[]; /* #include <system/locals_intern.h> */
|
||||
|
||||
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()) {
|
||||
|
@@ -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;}
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user