neutrinofonts: introduce fixed (non user scalable) fonts

Origin commit data
------------------
Branch: ni/coolstream
Commit: c9403a04f3
Author: vanhofen <vanhofen@gmx.de>
Date: 2019-03-08 (Fri, 08 Mar 2019)

Origin message was:
------------------
- neutrinofonts: introduce fixed (non user scalable) fonts

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2019-03-08 23:16:46 +01:00
parent 3de0547953
commit 9fa45105a1
4 changed files with 62 additions and 8 deletions

View File

@@ -48,6 +48,19 @@ extern font_sizes_groups_struct font_sizes_groups[];
extern font_sizes_struct neutrino_font[];
extern const char * locale_real_names[]; /* #include <system/locals_intern.h> */
font_sizes_struct fixed_font[SNeutrinoSettings::FONT_TYPE_FIXED_COUNT] =
{
{NONEXISTANT_LOCALE, 30, CNeutrinoFonts::FONT_STYLE_BOLD, 1},
{NONEXISTANT_LOCALE, 30, CNeutrinoFonts::FONT_STYLE_REGULAR, 1},
{NONEXISTANT_LOCALE, 30, CNeutrinoFonts::FONT_STYLE_ITALIC, 1},
{NONEXISTANT_LOCALE, 20, CNeutrinoFonts::FONT_STYLE_BOLD, 1},
{NONEXISTANT_LOCALE, 20, CNeutrinoFonts::FONT_STYLE_REGULAR, 1},
{NONEXISTANT_LOCALE, 20, CNeutrinoFonts::FONT_STYLE_ITALIC, 1},
{NONEXISTANT_LOCALE, 16, CNeutrinoFonts::FONT_STYLE_BOLD, 1},
{NONEXISTANT_LOCALE, 16, CNeutrinoFonts::FONT_STYLE_REGULAR, 1},
{NONEXISTANT_LOCALE, 16, CNeutrinoFonts::FONT_STYLE_ITALIC, 1},
};
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};
@@ -64,6 +77,8 @@ CNeutrinoFonts::CNeutrinoFonts()
for (int i = 0; i < SNeutrinoSettings::FONT_TYPE_COUNT; i++)
g_Font[i] = NULL;
for (int i = 0; i < SNeutrinoSettings::FONT_TYPE_FIXED_COUNT; i++)
g_FixedFont[i] = NULL;
g_SignalFont = NULL;
g_ShellFont = NULL;
@@ -180,15 +195,32 @@ void CNeutrinoFonts::SetupNeutrinoFonts(bool initRenderClass/*=true*/)
g_fontRenderer->AddFont(fontDescr.filename.c_str(), true); // make italics
fontStyle[2] = "Italic";
if (g_fixedFontRenderer != NULL)
delete g_fixedFontRenderer;
g_fixedFontRenderer = new FBFontRenderClass();
g_fixedFontRenderer->AddFont(fontDescr.filename.c_str());
g_fixedFontRenderer->AddFont(fontDescr.filename.c_str(), true); // make italics
}
int fontSize;
for (int i = 0; i < SNeutrinoSettings::FONT_TYPE_COUNT; i++) {
if (g_Font[i]) delete g_Font[i];
for (int i = 0; i < SNeutrinoSettings::FONT_TYPE_COUNT; i++)
{
if (g_Font[i])
delete g_Font[i];
fontSize = CFrameBuffer::getInstance()->scale2Res(CNeutrinoApp::getInstance()->getConfigFile()->getInt32(locale_real_names[neutrino_font[i].name], neutrino_font[i].defaultsize)) + neutrino_font[i].size_offset * fontDescr.size_offset;
g_Font[i] = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[neutrino_font[i].style].c_str(), fontSize);
}
if (g_SignalFont) delete g_SignalFont;
for (int i = 0; i < SNeutrinoSettings::FONT_TYPE_FIXED_COUNT; i++)
{
if (g_FixedFont[i])
delete g_FixedFont[i];
fontSize = CFrameBuffer::getInstance()->scale2Res(fixed_font[i].defaultsize) + fixed_font[i].size_offset * fontDescr.size_offset;
g_FixedFont[i] = g_fixedFontRenderer->getFont(fontDescr.name.c_str(), fontStyle[fixed_font[i].style].c_str(), fontSize);
}
if (g_SignalFont)
delete g_SignalFont;
fontSize = CFrameBuffer::getInstance()->scale2Res(signal_font.defaultsize) + signal_font.size_offset * fontDescr.size_offset;
g_SignalFont = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[signal_font.style].c_str(), fontSize);
}

View File

@@ -69,11 +69,13 @@ NEUTRINO_CPP CTimerdClient *g_Timerd;
class FBFontRenderClass;
NEUTRINO_CPP FBFontRenderClass *g_fontRenderer;
NEUTRINO_CPP FBFontRenderClass *g_fixedFontRenderer;
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_FixedFont[SNeutrinoSettings::FONT_TYPE_FIXED_COUNT];
NEUTRINO_CPP Font * g_SignalFont;
NEUTRINO_CPP Font * g_ShellFont;

View File

@@ -4965,6 +4965,7 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey)
delete g_Sectionsd;
delete g_RemoteControl;
delete g_fontRenderer;
delete g_fixedFontRenderer;
delete g_dynFontRenderer;
delete g_shellFontRenderer;
@@ -5522,6 +5523,7 @@ void CNeutrinoApp::Cleanup()
printf("cleanup 11\n");fflush(stdout);
delete g_fontRenderer; g_fontRenderer = NULL;
delete g_fixedFontRenderer; g_fixedFontRenderer = NULL;
delete g_dynFontRenderer; g_dynFontRenderer = NULL;
delete g_shellFontRenderer; g_shellFontRenderer = NULL;
printf("cleanup 12\n");fflush(stdout);
@@ -5563,20 +5565,25 @@ void CNeutrinoApp::Cleanup()
delete RADIOsatList; RADIOsatList = NULL;
printf("cleanup 1\n");fflush(stdout);
for (int i = 0; i < SNeutrinoSettings::FONT_TYPE_COUNT; i++) {
for (int i = 0; i < SNeutrinoSettings::FONT_TYPE_COUNT; i++)
{
delete g_Font[i];
g_Font[i] = NULL;
}
for (int i = 0; i < SNeutrinoSettings::FONT_TYPE_FIXED_COUNT; i++)
{
delete g_FixedFont[i];
g_FixedFont[i] = NULL;
}
delete g_SignalFont; g_SignalFont = NULL;
delete g_ShellFont; g_ShellFont = NULL;
printf("cleanup 2\n");fflush(stdout);
for(unsigned int i=0; i<g_settings.usermenu.size();++i){
delete g_settings.usermenu[i];
g_settings.usermenu[i] = NULL;
}
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();
printf("cleanup 4\n");fflush(stdout);
delete CZapit::getInstance();
printf("cleanup 5\n");fflush(stdout);

View File

@@ -773,6 +773,19 @@ struct SNeutrinoSettings
FONT_TYPE_COUNT
};
enum FONT_TYPES_FIXED {
FONT_TYPE_FIXED_30_BOLD = 0,
FONT_TYPE_FIXED_30_REGULAR,
FONT_TYPE_FIXED_30_ITALIC,
FONT_TYPE_FIXED_20_BOLD,
FONT_TYPE_FIXED_20_REGULAR,
FONT_TYPE_FIXED_20_ITALIC,
FONT_TYPE_FIXED_16_BOLD,
FONT_TYPE_FIXED_16_REGULAR,
FONT_TYPE_FIXED_16_ITALIC,
FONT_TYPE_FIXED_COUNT
};
int infoClockFontSize;
int infoClockSeconds;
int infoClockBackground;