mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
Add UI_PrintStringYOffset to shift big-font
This commit is contained in:
1 parent
2f0852cd03
commit
d5edba1fc2
3 files changed
+46
-3
No files matched your search
@@ -98,6 +98,46 @@ void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Lin
|
||||
}
|
||||
}
|
||||
|
||||
// Same as UI_PrintString but shifts the glyph down by YOffset pixels (0..7).
|
||||
// When YOffset > 0, a third page (Line+2) is also written. Bits are OR-ed
|
||||
// so existing framebuffer content outside the glyph footprint is preserved.
|
||||
void UI_PrintStringYOffset(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width, uint8_t YOffset)
|
||||
{
|
||||
size_t i;
|
||||
size_t Length = strlen(pString);
|
||||
|
||||
if (End > Start)
|
||||
Start += (((End - Start) - (Length * Width)) + 1) / 2;
|
||||
|
||||
YOffset &= 7;
|
||||
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
const unsigned int ofs = (unsigned int)Start + (i * Width);
|
||||
if (pString[i] > ' ' && pString[i] < 127)
|
||||
{
|
||||
const unsigned int index = pString[i] - ' ' - 1;
|
||||
|
||||
if (YOffset == 0)
|
||||
{
|
||||
memcpy(gFrameBuffer[Line + 0] + ofs, &gFontBig[index][0], 7);
|
||||
memcpy(gFrameBuffer[Line + 1] + ofs, &gFontBig[index][7], 7);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int x = 0; x < 7; x++)
|
||||
{
|
||||
const uint8_t top = gFontBig[index][x];
|
||||
const uint8_t bot = gFontBig[index][7 + x];
|
||||
gFrameBuffer[Line + 0][ofs + x] |= (uint8_t)(top << YOffset);
|
||||
gFrameBuffer[Line + 1][ofs + x] |= (uint8_t)(top >> (8 - YOffset)) | (uint8_t)(bot << YOffset);
|
||||
gFrameBuffer[Line + 2][ofs + x] |= (uint8_t)(bot >> (8 - YOffset));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t char_width, const uint8_t *font)
|
||||
{
|
||||
const size_t Length = strlen(pString);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
void UI_GenerateChannelString(char *pString, const uint16_t Channel);
|
||||
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint16_t ChannelNumber);
|
||||
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width);
|
||||
void UI_PrintStringYOffset(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width, uint8_t YOffset);
|
||||
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
||||
void UI_PrintStringSmallNormalInverse(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
||||
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
||||
|
||||
+5
-3
@@ -1597,7 +1597,8 @@ void UI_DisplayMain(void)
|
||||
|
||||
case MDF_CHANNEL: // show the channel number
|
||||
sprintf(String, "CH-%04u", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||
UI_PrintString(String, 36, 0, line, 8);
|
||||
//UI_PrintString(String, 36, 0, line, 8);
|
||||
UI_PrintStringYOffset(String, 36, 0, line, 8, 3);
|
||||
break;
|
||||
|
||||
case MDF_NAME: // show the channel name
|
||||
@@ -1611,14 +1612,15 @@ void UI_DisplayMain(void)
|
||||
|
||||
if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME) {
|
||||
String[10] = 0;
|
||||
UI_PrintString(String, 33, 0, line, 8);
|
||||
UI_PrintStringYOffset(String, 33, 0, line, 8, 3);
|
||||
}
|
||||
else {
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if (isMainOnly())
|
||||
{
|
||||
String[10] = 0;
|
||||
UI_PrintString(String, 33, 0, line, 8);
|
||||
//UI_PrintString(String, 33, 0, line, 8);
|
||||
UI_PrintStringYOffset(String, 33, 0, line, 8, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user