0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-08-03 09:36:32 +03:00

Added small bold font option

This commit is contained in:
OneOfEleven
2023-09-24 01:36:43 +01:00
parent 8b44428ea5
commit b2015430ea
11 changed files with 282 additions and 137 deletions

View File

@@ -91,7 +91,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
Start += (((End - Start) - (Length * 8)) + 1) / 2;
const unsigned int char_width = ARRAY_SIZE(gFontSmall[0]);
const unsigned int char_spacing = char_width + 0;
const unsigned int char_spacing = char_width + 1;
uint8_t *pFb = gFrameBuffer[Line] + Start;
for (i = 0; i < Length; i++)
{
@@ -99,23 +99,47 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
{
const unsigned int index = (unsigned int)pString[i] - 32;
if (index < ARRAY_SIZE(gFontSmall))
memmove(pFb + (i * char_spacing), &gFontSmall[index], char_width);
memmove(pFb + (i * char_spacing) + 1, &gFontSmall[index], char_width);
}
}
}
#ifdef ENABLE_SMALL_BOLD
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line)
{
const size_t Length = strlen(pString);
size_t i;
if (End > Start)
Start += (((End - Start) - (Length * 8)) + 1) / 2;
const unsigned int char_width = ARRAY_SIZE(gFontSmallBold[0]);
const unsigned int char_spacing = char_width + 1;
uint8_t *pFb = gFrameBuffer[Line] + Start;
for (i = 0; i < Length; i++)
{
if (pString[i] >= 32)
{
const unsigned int index = (unsigned int)pString[i] - 32;
if (index < ARRAY_SIZE(gFontSmallBold))
memmove(pFb + (i * char_spacing) + 1, &gFontSmallBold[index], char_width);
}
}
}
#endif
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer)
{
size_t i;
const unsigned int char_width = ARRAY_SIZE(gFontSmall[0]);
const unsigned int char_spacing = char_width + 0;
const unsigned int char_spacing = char_width + 1;
for (i = 0; i < strlen(pString); i++)
{
if (pString[i] >= 32)
{
const unsigned int index = (unsigned int)pString[i] - 32;
if (index < ARRAY_SIZE(gFontSmall))
memmove(buffer + (i * char_spacing), &gFontSmall[index], char_width);
memmove(buffer + (i * char_spacing) + 1, &gFontSmall[index], char_width);
}
}
}

View File

@@ -24,6 +24,9 @@ void UI_GenerateChannelString(char *pString, const uint8_t Channel);
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber);
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width);
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
#ifdef ENABLE_SMALL_BOLD
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
#endif
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer);
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag);
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero);

View File

@@ -340,7 +340,12 @@ void UI_DisplayMain(void)
}
else
{
UI_PrintStringSmall(String, 32 + 4, 0, Line);
#ifdef ENABLE_SMALL_BOLD
UI_PrintStringSmallBold(String, 32 + 4, 0, Line);
#else
UI_PrintStringSmall(String, 32 + 4, 0, Line);
#endif
// show the channel frequency below the channel number/name
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
UI_PrintStringSmall(String, 32 + 4, 0, Line + 1);